Merge branch '2022-08-20-assorted-updates'

- Assorted updates including some updates to the rx_51 platform
diff --git a/.mailmap b/.mailmap
index f27f366..8acce4b 100644
--- a/.mailmap
+++ b/.mailmap
@@ -49,6 +49,7 @@
 Michal Simek <michal.simek@xilinx.com> <monstr@monstr.eu>
 Michal Simek <michal.simek@xilinx.com> <Monstr@seznam.cz>
 Michal Simek <michal.simek@xilinx.com> <root@monstr.eu>
+Neil Armstrong <neil.armstrong@linaro.org> <narmstrong@baylibre.com>
 Nicolas Saenz Julienne <nsaenz@kernel.org> <nsaenzjulienne@suse.de>
 Patrice Chotard <patrice.chotard@foss.st.com> <patrice.chotard@st.com>
 Patrick Delaunay <patrick.delaunay@foss.st.com> <patrick.delaunay@st.com>
diff --git a/MAINTAINERS b/MAINTAINERS
index 5857fbf..36a2b69 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -143,7 +143,7 @@
 F:	drivers/sysreset/sysreset_socfpga*
 
 ARM AMLOGIC SOC SUPPORT
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 T:	git https://source.denx.de/u-boot/custodians/u-boot-amlogic.git
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 949ebb4..0b72e4f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2126,6 +2126,7 @@
 
 config STATIC_MACH_TYPE
 	bool "Statically define the Machine ID number"
+	default y if TARGET_DS109 || TARGET_NOKIA_RX51 || TARGET_DS414 || DEFAULT_DEVICE_TREE = "sun7i-a20-icnova-swac"
 	help
 	  When booting via ATAGs, enable this option if we know the correct
 	  machine ID number to use at compile time.  Some systems will be
@@ -2134,6 +2135,10 @@
 config MACH_TYPE
 	int "Machine ID number"
 	depends on STATIC_MACH_TYPE
+	default 527 if TARGET_DS109
+	default 1955 if TARGET_NOKIA_RX51
+	default 3036 if TARGET_DS414
+	default 4283 if DEFAULT_DEVICE_TREE = "sun7i-a20-icnova-swac"
 	help
 	  When booting via ATAGs, the machine type must be passed as a number.
 	  For the full list see https://www.arm.linux.org.uk/developer/machines
diff --git a/arch/arm/cpu/armv8/config.mk b/arch/arm/cpu/armv8/config.mk
index 6f90931..ca06ed3 100644
--- a/arch/arm/cpu/armv8/config.mk
+++ b/arch/arm/cpu/armv8/config.mk
@@ -3,6 +3,7 @@
 # (C) Copyright 2002
 # Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
 PLATFORM_RELFLAGS += -fno-common -ffixed-x18
+PLATFORM_RELFLAGS += $(call cc-option,-mbranch-protection=none)
 
 PF_NO_UNALIGNED := $(call cc-option, -mstrict-align)
 PLATFORM_CPPFLAGS += $(PF_NO_UNALIGNED)
diff --git a/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi b/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi
index 28fd62e..b3f21e7 100644
--- a/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi
+++ b/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi
@@ -16,6 +16,18 @@
 
 	ocp {
 		u-boot,dm-pre-reloc;
+
+		l4_wkup@44c00000 {
+			u-boot,dm-pre-reloc;
+
+			segment@200000 {
+				u-boot,dm-pre-reloc;
+
+				target-module@9000 {
+					u-boot,dm-pre-reloc;
+				};
+			};
+		};
 	};
 };
 
diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig
index 81c898b..3e97ec2 100644
--- a/arch/arm/mach-omap2/omap3/Kconfig
+++ b/arch/arm/mach-omap2/omap3/Kconfig
@@ -107,6 +107,12 @@
 
 config TARGET_NOKIA_RX51
 	bool "Nokia RX51"
+	select POSITION_INDEPENDENT
+	select SKIP_LOWLEVEL_INIT
+	select SUPPORT_PASSING_ATAGS
+	select CMDLINE_TAG
+	select INITRD_TAG
+	select REVISION_TAG
 
 config TARGET_TAO3530
 	bool "TAO3530"
diff --git a/board/amlogic/odroid-n2/MAINTAINERS b/board/amlogic/odroid-n2/MAINTAINERS
index 43724e6..23cc8e7 100644
--- a/board/amlogic/odroid-n2/MAINTAINERS
+++ b/board/amlogic/odroid-n2/MAINTAINERS
@@ -1,5 +1,5 @@
 ODROID-N2
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/odroid-n2/
diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
index 1df9b8b..33ca3df 100644
--- a/board/amlogic/p200/MAINTAINERS
+++ b/board/amlogic/p200/MAINTAINERS
@@ -1,6 +1,6 @@
 P200
 M:	Beniamino Galvani <b.galvani@gmail.com>
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/p200/
diff --git a/board/amlogic/p201/MAINTAINERS b/board/amlogic/p201/MAINTAINERS
index 1501b62..4549d01 100644
--- a/board/amlogic/p201/MAINTAINERS
+++ b/board/amlogic/p201/MAINTAINERS
@@ -1,5 +1,5 @@
 P201
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/p201/
diff --git a/board/amlogic/p212/MAINTAINERS b/board/amlogic/p212/MAINTAINERS
index 3d622af..b2e3205 100644
--- a/board/amlogic/p212/MAINTAINERS
+++ b/board/amlogic/p212/MAINTAINERS
@@ -1,5 +1,5 @@
 P212
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/p212/
diff --git a/board/amlogic/q200/MAINTAINERS b/board/amlogic/q200/MAINTAINERS
index ba7c12b..9c84cca 100644
--- a/board/amlogic/q200/MAINTAINERS
+++ b/board/amlogic/q200/MAINTAINERS
@@ -1,5 +1,5 @@
 Q200
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/q200/
diff --git a/board/amlogic/s400/MAINTAINERS b/board/amlogic/s400/MAINTAINERS
index fb46b1b..ca51bb6 100644
--- a/board/amlogic/s400/MAINTAINERS
+++ b/board/amlogic/s400/MAINTAINERS
@@ -1,5 +1,5 @@
 S400
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/s400/
diff --git a/board/amlogic/sei510/MAINTAINERS b/board/amlogic/sei510/MAINTAINERS
index c01c1d6..c6039bc 100644
--- a/board/amlogic/sei510/MAINTAINERS
+++ b/board/amlogic/sei510/MAINTAINERS
@@ -1,5 +1,5 @@
 SEI510
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/sei510/
diff --git a/board/amlogic/sei610/MAINTAINERS b/board/amlogic/sei610/MAINTAINERS
index 092178b..799ad68 100644
--- a/board/amlogic/sei610/MAINTAINERS
+++ b/board/amlogic/sei610/MAINTAINERS
@@ -1,5 +1,5 @@
 SEI610
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/sei610/
diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
index a259d12..47cec23 100644
--- a/board/amlogic/u200/MAINTAINERS
+++ b/board/amlogic/u200/MAINTAINERS
@@ -1,5 +1,5 @@
 U200
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/u200/
diff --git a/board/amlogic/vim3/MAINTAINERS b/board/amlogic/vim3/MAINTAINERS
index d884849..c5f8d9c 100644
--- a/board/amlogic/vim3/MAINTAINERS
+++ b/board/amlogic/vim3/MAINTAINERS
@@ -1,5 +1,5 @@
 VIM3
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/vim3/
diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 991590d..96ccda2 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -1,5 +1,5 @@
 W400
-M:	Neil Armstrong <narmstrong@baylibre.com>
+M:	Neil Armstrong <neil.armstrong@linaro.org>
 S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/w400/
diff --git a/board/nokia/rx51/Kconfig b/board/nokia/rx51/Kconfig
index ec6a571..7cf0507 100644
--- a/board/nokia/rx51/Kconfig
+++ b/board/nokia/rx51/Kconfig
@@ -1,5 +1,8 @@
 if TARGET_NOKIA_RX51
 
+config NR_DRAM_BANKS
+	default 2
+
 config SYS_BOARD
 	default "rx51"
 
@@ -9,4 +12,7 @@
 config SYS_CONFIG_NAME
 	default "nokia_rx51"
 
+config SYS_PROMPT
+	default "Nokia RX-51 # "
+
 endif
diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S
index 11c2cbe..c1785bc 100644
--- a/board/nokia/rx51/lowlevel_init.S
+++ b/board/nokia/rx51/lowlevel_init.S
@@ -6,11 +6,8 @@
 
 #include <config.h>
 
-relocaddr:		/* address of this relocaddr section after coping */
-	.word .		/* address of section (calculated at compile time) */
-
-startaddr:		/* address of u-boot after copying */
-	.word CONFIG_SYS_TEXT_BASE
+kernoffs:		/* offset of kernel image from this address */
+	.word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
 
 kernaddr:		/* address of kernel after copying */
 	.word KERNEL_ADDRESS
@@ -18,9 +15,6 @@
 kernsize:		/* maximal size of kernel image */
 	.word KERNEL_MAXSIZE
 
-kernoffs:		/* offset of kernel image in loaded u-boot */
-	.word KERNEL_OFFSET
-
 imagesize:		/* maximal size of image */
 	.word IMAGE_MAXSIZE
 
@@ -33,31 +27,29 @@
 /*
  * Routine: save_boot_params (called after reset from start.S)
  * Description: Copy attached kernel to address KERNEL_ADDRESS
- *              Copy u-boot to address CONFIG_SYS_TEXT_BASE
- *              Return to copied u-boot address
  */
 
 .global save_boot_params
 save_boot_params:
-	/* Get return address */
-	ldr	lr, =save_boot_params_ret
 
-/* Copy valid attached kernel to address KERNEL_ADDRESS */
+/*
+ * Copy valid attached kernel to absolute address KERNEL_ADDRESS
+ *
+ * Nokia X-Loader is loading secondary image to address 0x80400000.
+ * NOLO is loading boot image to random place, so it doesn't really
+ * matter what is set in CONFIG_SYS_TEXT_BASE. We have to detect
+ * KERNEL_OFFSET from the current execution address and copy it to
+ * absolute address KERNEL_ADDRESS.
+ *
+ * Note that U-Boot has to be compiled with CONFIG_POSITION_INDEPENDENT
+ * because it is loaded at random address and not to the fixed address
+ * (CONFIG_SYS_TEXT_BASE).
+ */
 
 copy_kernel_start:
-	adr	r0, relocaddr	/* r0 - address of section relocaddr */
-	ldr	r1, relocaddr	/* r1 - address of relocaddr after relocation */
-	cmp	r0, r1
-
-	/* r4 - calculated offset */
-	subhi	r4, r0, r1
-	sublo	r4, r1, r0
-
 	/* r0 - start of kernel before */
-	ldr	r0, startaddr
-	addhi	r0, r0, r4
-	sublo	r0, r0, r4
-	ldr	r1, kernoffs
+	adr	r0, kernoffs	/* r0 - current address of kernoffs section */
+	ldr	r1, kernoffs	/* r1 - offset of kernel image from kernoffs section */
 	add	r0, r0, r1
 
 	/* r3 - start of kernel after */
@@ -72,7 +64,8 @@
 
 	/* remove header in target kernel */
 	mov	r5, #0
-	str	r5, [r3]
+	str	r5, [r3]	/* remove 4 bytes header of kernel uImage */
+	str	r5, [r3, #36]	/* remove 4 bytes header of kernel zImage */
 
 	/* check for valid kernel uImage */
 	ldr	r4, [r0]	/* r4 - 4 bytes header of kernel */
@@ -93,114 +86,11 @@
 	bhi	copy_kernel_loop
 
 copy_kernel_end:
+
+	/* remove header in source kernel image */
 	mov	r5, #0
 	str	r5, [r0]	/* remove 4 bytes header of kernel uImage */
 	str	r5, [r0, #36]	/* remove 4 bytes header of kernel zImage */
 
-
-/* Fix u-boot code */
-
-fix_start:
-	adr	r0, relocaddr	/* r0 - address of section relocaddr */
-	ldr	r1, relocaddr	/* r1 - address of relocaddr after relocation */
-	cmp	r0, r1
-
-	beq	copy_uboot_end	/* skip if u-boot is on correct address */
-
-	/* r5 - calculated offset */
-	subhi	r5, r0, r1
-	sublo	r5, r1, r0
-
-	/* r6 - maximal u-boot size */
-	ldr	r6, imagesize
-
-	/* r1 - start of u-boot after */
-	ldr	r1, startaddr
-
-	/* r0 - start of u-boot before */
-	addhi	r0, r1, r5
-	sublo	r0, r1, r5
-
-	/* check if we need to move uboot copy code before calling it */
-	cmp	r5, r6
-	bhi	copy_uboot_start /* now coping u-boot code directly is safe */
-
-
-copy_code_start:
-	/* r0 - start of u-boot before */
-	/* r1 - start of u-boot after */
-	/* r6 - maximal u-boot size */
-
-	/* r7 - maximal kernel size */
-	ldr	r7, kernsize
-
-	/* r4 - end of kernel before */
-	add	r4, r0, r6
-	add	r4, r4, r7
-
-	/* r5 - end of u-boot after */
-	ldr	r5, startaddr
-	add	r5, r5, r6
-
-	/* r2 - start of loop code after */
-	cmp	r4, r5		/* higher address (r4 or r5) */
-	movhs	r2, r4
-	movlo	r2, r5
-
-	/* r3 - end of loop code before */
-	adr	r3, end
-
-	/* r4 - end of loop code after */
-	adr	r4, copy_uboot_start
-	sub	r4, r3, r4
-	add	r4, r2, r4
-
-copy_code_loop:
-	ldmdb	r3!, {r7 - r10}
-	stmdb	r4!, {r7 - r10}
-	cmp	r4, r2
-	bhi	copy_code_loop
-
-copy_code_end:
-	mov	pc, r2
-
-
-/*
- * Copy u-boot to address CONFIG_SYS_TEXT_BASE
- *
- * Nokia X-Loader loading secondary image to address 0x80400000
- * NOLO loading boot image to random place, so it doesn't really
- * matter what is set in CONFIG_SYS_TEXT_BASE. We have to copy
- * u-boot to CONFIG_SYS_TEXT_BASE address.
- */
-
-copy_uboot_start:
-	/* r0 - start of u-boot before */
-	/* r1 - start of u-boot after */
-	/* r6 - maximal u-boot size */
-
-	/* r2 - end of u-boot after */
-	add	r2, r1, r6
-
-	/* condition for copying from left to right */
-	cmp	r0, r1
-	addlo	r1, r0, r6	/* r1 - end of u-boot before */
-	blo	copy_uboot_loop_right
-
-copy_uboot_loop_left:
-	ldmia	r0!, {r3 - r10}
-	stmia	r1!, {r3 - r10}
-	cmp	r1, r2
-	blo	copy_uboot_loop_left
-	b	copy_uboot_end
-
-copy_uboot_loop_right:
-	ldmdb	r1!, {r3 - r10}
-	stmdb	r2!, {r3 - r10}
-	cmp	r1, r0
-	bhi	copy_uboot_loop_right
-
-copy_uboot_end:
-	bx	lr
-
-end:
+	/* Returns */
+	b	save_boot_params_ret
diff --git a/board/phytec/phycore_am335x_r2/Kconfig b/board/phytec/phycore_am335x_r2/Kconfig
index 77055e0..4183c24 100644
--- a/board/phytec/phycore_am335x_r2/Kconfig
+++ b/board/phytec/phycore_am335x_r2/Kconfig
@@ -1,4 +1,4 @@
-if TARGET_PHYCORE_AM335X_R2
+if TARGET_PCM051 || TARGET_PHYCORE_AM335X_R2
 
 config SYS_BOARD
 	default "phycore_am335x_r2"
diff --git a/board/phytec/phycore_am335x_r2/MAINTAINERS b/board/phytec/phycore_am335x_r2/MAINTAINERS
index 8d02b0e..28c69cb 100644
--- a/board/phytec/phycore_am335x_r2/MAINTAINERS
+++ b/board/phytec/phycore_am335x_r2/MAINTAINERS
@@ -9,3 +9,8 @@
 F:	include/configs/phycore_am335x_r2.h
 F:	configs/phycore-am335x-r2-regor_defconfig
 F:	configs/phycore-am335x-r2-wega_defconfig
+
+phyCORE AM335x R3 WEGA BOARD
+M:	Matwey V. Kornilov <matwey.kornilov@gmail.com>
+S:	Maintained
+F:	configs/pcm051_rev3_defconfig
diff --git a/board/phytec/phycore_am335x_r2/board.c b/board/phytec/phycore_am335x_r2/board.c
index 5ca9415..d97ebd0 100644
--- a/board/phytec/phycore_am335x_r2/board.c
+++ b/board/phytec/phycore_am335x_r2/board.c
@@ -31,7 +31,11 @@
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
 /* DDR RAM defines */
+#if defined(CONFIG_TARGET_PCM051)
+#define DDR_CLK_MHZ		303 /* DDR_DPLL_MULT value */
+#else
 #define DDR_CLK_MHZ		400 /* DDR_DPLL_MULT value */
+#endif
 
 #define OSC	(V_OSCK / 1000000)
 const struct dpll_params dpll_ddr = {
@@ -65,6 +69,7 @@
 	PHYCORE_R2_MT41K128M16JT_256MB,
 	PHYCORE_R2_MT41K256M16TW107IT_512MB,
 	PHYCORE_R2_MT41K512M16HA125IT_1024MB,
+	PHYCORE_R13_MT41K256M16HA125E_256MB,
 };
 
 struct am335x_sdram_timings {
@@ -127,10 +132,30 @@
 			.datawrsratio0 = 0x82,
 		},
 	},
+	[PHYCORE_R13_MT41K256M16HA125E_256MB] = {
+		.ddr3_emif_reg_data = {
+			.sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
+			.ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
+			.sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
+			.sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
+			.sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
+			.zq_config = MT41K256M16HA125E_ZQ_CFG,
+			.emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY | PHY_EN_DYN_PWRDN,
+		},
+		.ddr3_data = {
+			.datardsratio0 = MT41K256M16HA125E_RD_DQS,
+			.datawdsratio0 = MT41K256M16HA125E_WR_DQS,
+			.datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
+			.datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
+		},
+	},
 };
 
 void sdram_init(void)
 {
+#if defined(CONFIG_TARGET_PCM051)
+	int ram_type_index = PHYCORE_R13_MT41K256M16HA125E_256MB;
+#else
 	/* Configure memory to maximum supported size for detection */
 	int ram_type_index = PHYCORE_R2_MT41K512M16HA125IT_1024MB;
 
@@ -157,6 +182,7 @@
 		ram_type_index = PHYCORE_R2_MT41K128M16JT_256MB;
 		break;
 	}
+#endif
 	config_ddr(DDR_CLK_MHZ, &ioregs,
 		   &physom_timings[ram_type_index].ddr3_data,
 		   &ddr3_cmd_ctrl_data,
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 43566b8..cac0b63 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -78,7 +78,7 @@
 
 	/* if we are passed a buffer use it, otherwise try the environment */
 	if (!env_hwconfig) {
-		if (!(gd->flags & GD_FLG_ENV_READY)) {
+		if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) {
 			printf("WARNING: Calling __hwconfig without a buffer "
 					"and before environment is ready\n");
 			return NULL;
diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig
index 3b559ab..b25e33e 100644
--- a/configs/nokia_rx51_defconfig
+++ b/configs/nokia_rx51_defconfig
@@ -1,17 +1,10 @@
 CONFIG_ARM=y
-CONFIG_SKIP_LOWLEVEL_INIT=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_SYS_L2CACHE_OFF=y
 CONFIG_ARCH_OMAP2PLUS=y
-CONFIG_SUPPORT_PASSING_ATAGS=y
-CONFIG_CMDLINE_TAG=y
-CONFIG_INITRD_TAG=y
-CONFIG_REVISION_TAG=y
 CONFIG_STATIC_MACH_TYPE=y
 CONFIG_MACH_TYPE=1955
-CONFIG_SYS_TEXT_BASE=0x80008000
 CONFIG_SYS_MALLOC_LEN=0xc0000
-CONFIG_NR_DRAM_BANKS=2
 CONFIG_TARGET_NOKIA_RX51=y
 CONFIG_SYS_LOAD_ADDR=0x80000000
 CONFIG_OPTIMIZE_INLINING=y
@@ -26,7 +19,6 @@
 CONFIG_USE_PREBOOT=y
 # CONFIG_SYS_DEVICE_NULLDEV is not set
 CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PROMPT="Nokia RX-51 # "
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=287
 # CONFIG_CMD_BDI is not set
diff --git a/configs/pcm051_rev3_defconfig b/configs/pcm051_rev3_defconfig
new file mode 100644
index 0000000..624113d
--- /dev/null
+++ b/configs/pcm051_rev3_defconfig
@@ -0,0 +1,69 @@
+CONFIG_ARM=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_OMAP2PLUS=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_DEFAULT_DEVICE_TREE="am335x-wega-rdk"
+CONFIG_AM33XX=y
+CONFIG_TARGET_PCM051=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL=y
+CONFIG_SPL_FS_FAT=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4030ff00
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_DEFAULT_FDT_FILE="am335x-wega-rdk.dtb"
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_ARCH_MISC_INIT=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_FS_EXT4=y
+CONFIG_SPL_I2C=y
+# CONFIG_SPL_NAND_SUPPORT is not set
+CONFIG_SPL_POWER=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_CMD_SPL=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_EEPROM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clocks clock-names interrupt-parent interrupt-controller interrupt-cells dma-names dmas "
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_CLK=y
+CONFIG_CLK_TI_CTRL=y
+CONFIG_DM_I2C=y
+CONFIG_MISC=y
+CONFIG_MMC_OMAP_HS=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SF_DEFAULT_SPEED=24000000
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_SMSC=y
+CONFIG_DM_ETH=y
+CONFIG_MII=y
+CONFIG_DRIVER_TI_CPSW=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_OMAP3_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_MUSB_TI=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_ETHER=y
diff --git a/include/dt-bindings/gpio/aspeed-gpio.h b/include/dt-bindings/gpio/aspeed-gpio.h
new file mode 100644
index 0000000..a49f5d5
--- /dev/null
+++ b/include/dt-bindings/gpio/aspeed-gpio.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2022 IBM Corp.
+ *
+ * This header provides constants for binding aspeed,*-gpio.
+ *
+ * The first cell in Aspeed's GPIO specifier is the GPIO ID. The macros below
+ * provide names for this.
+ *
+ * The second cell contains standard flag values specified in gpio.h.
+ */
+
+#ifndef _DT_BINDINGS_GPIO_ASPEED_GPIO_H
+#define _DT_BINDINGS_GPIO_ASPEED_GPIO_H
+
+#include <dt-bindings/gpio/gpio.h>
+
+#define ASPEED_GPIO_PORT_A 0
+#define ASPEED_GPIO_PORT_B 1
+#define ASPEED_GPIO_PORT_C 2
+#define ASPEED_GPIO_PORT_D 3
+#define ASPEED_GPIO_PORT_E 4
+#define ASPEED_GPIO_PORT_F 5
+#define ASPEED_GPIO_PORT_G 6
+#define ASPEED_GPIO_PORT_H 7
+#define ASPEED_GPIO_PORT_I 8
+#define ASPEED_GPIO_PORT_J 9
+#define ASPEED_GPIO_PORT_K 10
+#define ASPEED_GPIO_PORT_L 11
+#define ASPEED_GPIO_PORT_M 12
+#define ASPEED_GPIO_PORT_N 13
+#define ASPEED_GPIO_PORT_O 14
+#define ASPEED_GPIO_PORT_P 15
+#define ASPEED_GPIO_PORT_Q 16
+#define ASPEED_GPIO_PORT_R 17
+#define ASPEED_GPIO_PORT_S 18
+#define ASPEED_GPIO_PORT_T 19
+#define ASPEED_GPIO_PORT_U 20
+#define ASPEED_GPIO_PORT_V 21
+#define ASPEED_GPIO_PORT_W 22
+#define ASPEED_GPIO_PORT_X 23
+#define ASPEED_GPIO_PORT_Y 24
+#define ASPEED_GPIO_PORT_Z 25
+#define ASPEED_GPIO_PORT_AA 26
+#define ASPEED_GPIO_PORT_AB 27
+#define ASPEED_GPIO_PORT_AC 28
+
+#define ASPEED_GPIO(port, offset) \
+	((ASPEED_GPIO_PORT_##port * 8) + (offset))
+
+#endif
diff --git a/tools/k3_gen_x509_cert.sh b/tools/k3_gen_x509_cert.sh
index 24cfc4e..029247c 100755
--- a/tools/k3_gen_x509_cert.sh
+++ b/tools/k3_gen_x509_cert.sh
@@ -88,7 +88,10 @@
 }
 
 parse_key() {
-	sed '/\ \ \ \ /s/://g' key.txt | awk  '!/\ \ \ \ / {printf("\n%s\n", $0)}; /\ \ \ \ / {printf("%s", $0)}' | sed 's/\ \ \ \ //g' | awk "/$1:/{getline; print}"
+	sed '/    /s/://g' key.txt | \
+            awk  '!/    / {printf("\n%s\n", $0)}; /    / {printf("%s", $0)}' | \
+            sed 's/    //g' | \
+            awk "/$1:/{getline; print}"
 }
 
 gen_degen_key() {