Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- XHCI updates to support MIPS better
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index c3eb887..adcc0fb 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -2,7 +2,7 @@
   windows_vm: vs2017-win2016
   ubuntu_vm: ubuntu-18.04
   macos_vm: macOS-10.15
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200526-18Jun2020
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200713-05Aug2020
   # Add '-u 0' options for Azure pipelines, otherwise we get "permission
   # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
   # since our $(ci_runner_image) user is not root.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 43f9d3b..b0d7679 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@
 
 # Grab our configured image.  The source for this is found at:
 # https://gitlab.denx.de/u-boot/gitlab-ci-runner
-image: trini/u-boot-gitlab-ci-runner:bionic-20200526-18Jun2020
+image: trini/u-boot-gitlab-ci-runner:bionic-20200713-05Aug2020
 
 # We run some tests in different order, to catch some failures quicker.
 stages:
diff --git a/Kconfig b/Kconfig
index 1c408b6..372425e 100644
--- a/Kconfig
+++ b/Kconfig
@@ -379,6 +379,31 @@
 	  by the UEFI sub-system. On some boards initrd_high is calculated as
 	  base stack pointer minus this stack size.
 
+config SYS_HAS_SRAM
+	bool
+	default y if TARGET_PIC32MZDASK
+	default y if TARGET_DEVKIT8000
+	default y if TARGET_TRICORDER
+	default n
+	help
+	  Enable this to allow support for the on board SRAM.
+	  SRAM base address is controlled by CONFIG_SYS_SRAM_BASE.
+	  SRAM size is controlled by CONFIG_SYS_SRAM_SIZE.
+
+config SYS_SRAM_BASE
+	hex
+	default 0x80000000 if TARGET_PIC32MZDASK
+	default 0x40200000 if TARGET_DEVKIT8000
+	default 0x40200000 if TARGET_TRICORDER
+	default 0x0
+
+config SYS_SRAM_SIZE
+	hex
+	default 0x00080000 if TARGET_PIC32MZDASK
+	default 0x10000 if TARGET_DEVKIT8000
+	default 0x10000 if TARGET_TRICORDER
+	default 0x0
+
 endmenu		# General setup
 
 menu "Boot images"
diff --git a/README b/README
index d4bf74c..121dc49 100644
--- a/README
+++ b/README
@@ -3444,6 +3444,11 @@
 		  downloads succeed with high packet loss rates, or with
 		  unreliable TFTP servers or client hardware.
 
+  tftpwindowsize	- if this is set, the value is used for TFTP's
+		  window size as described by RFC 7440.
+		  This means the count of blocks we can receive before
+		  sending ack to server.
+
   vlan		- When set to a value < 4095 the traffic over
 		  Ethernet is encapsulated/received over 802.1q
 		  VLAN tagged frames.
diff --git a/arch/Kconfig b/arch/Kconfig
index 7f3cbe2..e4a0a02 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -10,7 +10,6 @@
 
 config ARC
 	bool "ARC architecture"
-	select ARCH_EARLY_INIT_R
 	select ARC_TIMER
 	select CLK
 	select HAVE_PRIVATE_LIBGCC
@@ -139,6 +138,7 @@
 	imply ACPI_PMC
 	imply ACPI_PMC_SANDBOX
 	imply CMD_PMC
+	imply CMD_CLONE
 
 config SH
 	bool "SuperH architecture"
diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c
index 27b5832..d66a8c8 100644
--- a/arch/arc/lib/cpu.c
+++ b/arch/arc/lib/cpu.c
@@ -25,13 +25,6 @@
 	return 0;
 }
 
-int arch_early_init_r(void)
-{
-	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-	return 0;
-}
-
 /* This is a dummy function on arc */
 int dram_init(void)
 {
diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
index 8eee801..60bb0a9 100644
--- a/arch/arm/cpu/armv7/Kconfig
+++ b/arch/arm/cpu/armv7/Kconfig
@@ -44,6 +44,7 @@
 choice
 	prompt "Supported PSCI version"
 	depends on ARMV7_PSCI
+	default ARMV7_PSCI_0_1 if ARCH_SUNXI
 	default ARMV7_PSCI_1_0
 	help
 	  Select the supported PSCI version.
@@ -53,6 +54,9 @@
 
 config ARMV7_PSCI_0_2
 	bool "PSCI V0.2"
+
+config ARMV7_PSCI_0_1
+	bool "PSCI V0.1"
 endchoice
 
 config ARMV7_PSCI_NR_CPUS
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 43a2ee1..8ecf63e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -219,6 +219,11 @@
 	armada-8040-db.dtb			\
 	armada-8040-mcbin.dtb			\
 	armada-xp-crs305-1g-4s.dtb		\
+	armada-xp-crs305-1g-4s-bit.dtb		\
+	armada-xp-crs326-24g-2s.dtb		\
+	armada-xp-crs326-24g-2s-bit.dtb		\
+	armada-xp-crs328-4c-20s-4s.dtb		\
+	armada-xp-crs328-4c-20s-4s-bit.dtb	\
 	armada-xp-db-xc3-24g4xg.dtb		\
 	armada-xp-gp.dtb			\
 	armada-xp-maxbcm.dtb			\
diff --git a/arch/arm/dts/armada-xp-crs305-1g-4s-bit.dts b/arch/arm/dts/armada-xp-crs305-1g-4s-bit.dts
new file mode 100644
index 0000000..059bf48
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs305-1g-4s-bit.dts
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for MikroTik CRS305-1G-4S+ Bit board
+ *
+ * Copyright (C) 2020 Sartura Ltd.
+ * Author: Luka Kovacic <luka.kovacic@sartura.hr>
+ */
+
+#include "armada-xp-crs305-1g-4s.dtsi"
+
+/ {
+	model = "MikroTik CRS305-1G-4S+ Bit";
+};
+
+&spi0 {
+	status = "okay";
+
+	spi-flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-flash", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+		m25p,fast-read;
+
+		partition@u-boot {
+			reg = <0x00000000 0x001f0000>;
+			label = "u-boot";
+		};
+		partition@u-boot-env {
+			reg = <0x001f0000 0x00010000>;
+			label = "u-boot-env";
+		};
+		partition@ubi1 {
+			reg = <0x00200000 0x03f00000>;
+			label = "ubi1";
+		};
+		partition@ubi2 {
+			reg = <0x04100000 0x03f00000>;
+			label = "ubi2";
+		};
+	};
+};
diff --git a/arch/arm/dts/armada-xp-crs305-1g-4s.dtsi b/arch/arm/dts/armada-xp-crs305-1g-4s.dtsi
index c8839ea..1a74ecd 100644
--- a/arch/arm/dts/armada-xp-crs305-1g-4s.dtsi
+++ b/arch/arm/dts/armada-xp-crs305-1g-4s.dtsi
@@ -95,16 +95,16 @@
 		m25p,fast-read;
 
 		partition@u-boot {
-			reg = <0x00000000 0x00080000>;
+			reg = <0x00000000 0x001f0000>;
 			label = "u-boot";
 		};
 		partition@u-boot-env {
-			reg = <0x00080000 0x00010000>;
+			reg = <0x001f0000 0x00010000>;
 			label = "u-boot-env";
 		};
-		partition@firmware {
-			reg = <0x00090000 0x00f70000>;
-			label = "firmware";
+		partition@ubi1 {
+			reg = <0x00200000 0x00e00000>;
+			label = "ubi1";
 		};
 
 	};
diff --git a/arch/arm/dts/armada-xp-crs326-24g-2s-bit.dts b/arch/arm/dts/armada-xp-crs326-24g-2s-bit.dts
new file mode 100644
index 0000000..b340eed
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs326-24g-2s-bit.dts
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for MikroTik CRS326-24G-2S+ Bit board
+ *
+ * Copyright (C) 2020 Sartura Ltd.
+ * Author: Luka Kovacic <luka.kovacic@sartura.hr>
+ */
+
+#include "armada-xp-crs326-24g-2s.dtsi"
+
+/ {
+	model = "MikroTik CRS326-24G-2S+ Bit";
+};
+
+&spi0 {
+	status = "okay";
+
+	spi-flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-flash", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+		m25p,fast-read;
+
+		partition@u-boot {
+			reg = <0x00000000 0x001f0000>;
+			label = "u-boot";
+		};
+		partition@u-boot-env {
+			reg = <0x001f0000 0x00010000>;
+			label = "u-boot-env";
+		};
+		partition@ubi1 {
+			reg = <0x00200000 0x03f00000>;
+			label = "ubi1";
+		};
+		partition@ubi2 {
+			reg = <0x04100000 0x03f00000>;
+			label = "ubi2";
+		};
+	};
+};
diff --git a/arch/arm/dts/armada-xp-crs326-24g-2s-u-boot.dtsi b/arch/arm/dts/armada-xp-crs326-24g-2s-u-boot.dtsi
new file mode 100644
index 0000000..8576a02
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs326-24g-2s-u-boot.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&spi0 {
+	u-boot,dm-pre-reloc;
+
+	spi-flash@0 {
+		u-boot,dm-pre-reloc;
+	};
+};
diff --git a/arch/arm/dts/armada-xp-crs326-24g-2s.dts b/arch/arm/dts/armada-xp-crs326-24g-2s.dts
new file mode 100644
index 0000000..83aef43
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs326-24g-2s.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for MikroTik CRS326-24G-2S+ board
+ *
+ * Copyright (C) 2020 Sartura Ltd.
+ * Author: Luka Kovacic <luka.kovacic@sartura.hr>
+ */
+
+#include "armada-xp-crs326-24g-2s.dtsi"
+
+/ {
+	model = "MikroTik CRS326-24G-2S+";
+};
+
+&spi0 {
+	status = "okay";
+};
diff --git a/arch/arm/dts/armada-xp-crs326-24g-2s.dtsi b/arch/arm/dts/armada-xp-crs326-24g-2s.dtsi
new file mode 100644
index 0000000..e50f3ea
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs326-24g-2s.dtsi
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for CRS326-24G-2S board
+ *
+ * Copyright (C) 2016 Allied Telesis Labs
+ * Copyright (C) 2020 Sartura Ltd.
+ *
+ * Based on armada-xp-db.dts
+ *
+ * Note: this Device Tree assumes that the bootloader has remapped the
+ * internal registers to 0xf1000000 (instead of the default
+ * 0xd0000000). The 0xf1000000 is the default used by the recent,
+ * DT-capable, U-Boot bootloaders provided by Marvell. Some earlier
+ * boards were delivered with an older version of the bootloader that
+ * left internal registers mapped at 0xd0000000. If you are in this
+ * situation, you should either update your bootloader (preferred
+ * solution) or the below Device Tree should be adjusted.
+ */
+
+/dts-v1/;
+#include "armada-xp-98dx3236.dtsi"
+#include "armada-xp-crs326-24g-2s-u-boot.dtsi"
+
+/ {
+	model = "CRS326-24G-2S+";
+	compatible = "marvell,armadaxp-98dx3236", "marvell,armadaxp-mv78260", "marvell,armadaxp", "marvell,armada-370-xp";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+		bootargs = "console=ttyS0,115200 earlyprintk";
+	};
+
+	aliases {
+		spi0 = &spi0;
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x00000000 0 0x20000000>; /* 512 MB */
+	};
+};
+
+&L2 {
+	arm,parity-enable;
+	marvell,ecc-enable;
+};
+
+&devbus_bootcs {
+	status = "okay";
+
+	/* Device Bus parameters are required */
+
+	/* Read parameters */
+	devbus,bus-width    = <16>;
+	devbus,turn-off-ps  = <60000>;
+	devbus,badr-skew-ps = <0>;
+	devbus,acc-first-ps = <124000>;
+	devbus,acc-next-ps  = <248000>;
+	devbus,rd-setup-ps  = <0>;
+	devbus,rd-hold-ps   = <0>;
+
+	/* Write parameters */
+	devbus,sync-enable = <0>;
+	devbus,wr-high-ps  = <60000>;
+	devbus,wr-low-ps   = <60000>;
+	devbus,ale-wr-ps   = <60000>;
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&uart1 {
+	status = "okay";
+};
+
+&i2c0 {
+	clock-frequency = <100000>;
+	status = "okay";
+};
+
+&usb0 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	spi-flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-flash", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+		m25p,fast-read;
+
+		partition@u-boot {
+			reg = <0x00000000 0x001f0000>;
+			label = "u-boot";
+		};
+		partition@u-boot-env {
+			reg = <0x001f0000 0x00010000>;
+			label = "u-boot-env";
+		};
+		partition@ubi1 {
+			reg = <0x00200000 0x00e00000>;
+			label = "ubi1";
+		};
+	};
+};
diff --git a/arch/arm/dts/armada-xp-crs328-4c-20s-4s-bit.dts b/arch/arm/dts/armada-xp-crs328-4c-20s-4s-bit.dts
new file mode 100644
index 0000000..d684c89
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs328-4c-20s-4s-bit.dts
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for MikroTik CRS328-4C-20S-4S+ Bit board
+ *
+ * Copyright (C) 2020 Sartura Ltd.
+ * Author: Luka Kovacic <luka.kovacic@sartura.hr>
+ */
+
+#include "armada-xp-crs328-4c-20s-4s.dtsi"
+
+/ {
+	model = "MikroTik CRS328-4C-20S-4S+ Bit";
+};
+
+&spi0 {
+	status = "okay";
+
+	spi-flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-flash", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+		m25p,fast-read;
+
+		partition@u-boot {
+			reg = <0x00000000 0x001f0000>;
+			label = "u-boot";
+		};
+		partition@u-boot-env {
+			reg = <0x001f0000 0x00010000>;
+			label = "u-boot-env";
+		};
+		partition@ubi1 {
+			reg = <0x00200000 0x03f00000>;
+			label = "ubi1";
+		};
+		partition@ubi2 {
+			reg = <0x04100000 0x03f00000>;
+			label = "ubi2";
+		};
+	};
+};
diff --git a/arch/arm/dts/armada-xp-crs328-4c-20s-4s-u-boot.dtsi b/arch/arm/dts/armada-xp-crs328-4c-20s-4s-u-boot.dtsi
new file mode 100644
index 0000000..8576a02
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs328-4c-20s-4s-u-boot.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&spi0 {
+	u-boot,dm-pre-reloc;
+
+	spi-flash@0 {
+		u-boot,dm-pre-reloc;
+	};
+};
diff --git a/arch/arm/dts/armada-xp-crs328-4c-20s-4s.dts b/arch/arm/dts/armada-xp-crs328-4c-20s-4s.dts
new file mode 100644
index 0000000..665757f
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs328-4c-20s-4s.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for MikroTik CRS328-4C-20S-4S+ board
+ *
+ * Copyright (C) 2020 Sartura Ltd.
+ * Author: Luka Kovacic <luka.kovacic@sartura.hr>
+ */
+
+#include "armada-xp-crs328-4c-20s-4s.dtsi"
+
+/ {
+	model = "MikroTik CRS328-4C-20S-4S+";
+};
+
+&spi0 {
+	status = "okay";
+};
diff --git a/arch/arm/dts/armada-xp-crs328-4c-20s-4s.dtsi b/arch/arm/dts/armada-xp-crs328-4c-20s-4s.dtsi
new file mode 100644
index 0000000..daff1af
--- /dev/null
+++ b/arch/arm/dts/armada-xp-crs328-4c-20s-4s.dtsi
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for CRS328-4C-20S-4S+ board
+ *
+ * Copyright (C) 2016 Allied Telesis Labs
+ * Copyright (C) 2020 Sartura Ltd.
+ *
+ * Based on armada-xp-db.dts
+ *
+ * Note: this Device Tree assumes that the bootloader has remapped the
+ * internal registers to 0xf1000000 (instead of the default
+ * 0xd0000000). The 0xf1000000 is the default used by the recent,
+ * DT-capable, U-Boot bootloaders provided by Marvell. Some earlier
+ * boards were delivered with an older version of the bootloader that
+ * left internal registers mapped at 0xd0000000. If you are in this
+ * situation, you should either update your bootloader (preferred
+ * solution) or the below Device Tree should be adjusted.
+ */
+
+/dts-v1/;
+#include "armada-xp-98dx3236.dtsi"
+#include "armada-xp-crs328-4c-20s-4s-u-boot.dtsi"
+
+/ {
+	model = "CRS328-4C-20S-4S+";
+	compatible = "marvell,armadaxp-98dx3236", "marvell,armadaxp-mv78260", "marvell,armadaxp", "marvell,armada-370-xp";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+		bootargs = "console=ttyS0,115200 earlyprintk";
+	};
+
+	aliases {
+		spi0 = &spi0;
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x00000000 0 0x20000000>; /* 512 MB */
+	};
+};
+
+&L2 {
+	arm,parity-enable;
+	marvell,ecc-enable;
+};
+
+&devbus_bootcs {
+	status = "okay";
+
+	/* Device Bus parameters are required */
+
+	/* Read parameters */
+	devbus,bus-width    = <16>;
+	devbus,turn-off-ps  = <60000>;
+	devbus,badr-skew-ps = <0>;
+	devbus,acc-first-ps = <124000>;
+	devbus,acc-next-ps  = <248000>;
+	devbus,rd-setup-ps  = <0>;
+	devbus,rd-hold-ps   = <0>;
+
+	/* Write parameters */
+	devbus,sync-enable = <0>;
+	devbus,wr-high-ps  = <60000>;
+	devbus,wr-low-ps   = <60000>;
+	devbus,ale-wr-ps   = <60000>;
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&uart1 {
+	status = "okay";
+};
+
+&i2c0 {
+	clock-frequency = <100000>;
+	status = "okay";
+};
+
+&usb0 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	spi-flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-flash", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+		m25p,fast-read;
+
+		partition@u-boot {
+			reg = <0x00000000 0x001f0000>;
+			label = "u-boot";
+		};
+		partition@u-boot-env {
+			reg = <0x001f0000 0x00010000>;
+			label = "u-boot-env";
+		};
+		partition@ubi1 {
+			reg = <0x00200000 0x00e00000>;
+			label = "ubi1";
+		};
+	};
+};
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index df9dd83..46b6be2 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -64,7 +64,7 @@
  * can afford it due to sufficient memory being available early.
  */
 
-.macro SPL_CLEAR_BSS
+.macro CLEAR_BSS
 	ldr	r0, =__bss_start	/* this is auto-relocated! */
 
 #ifdef CONFIG_USE_ARCH_MEMSET
@@ -109,8 +109,8 @@
 	mov	r9, r0
 	bl	board_init_f_init_reserve
 
-#if defined(CONFIG_SPL_EARLY_BSS)
-	SPL_CLEAR_BSS
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_EARLY_BSS)
+	CLEAR_BSS
 #endif
 
 	mov	r0, #0
@@ -150,8 +150,8 @@
 #endif
 #if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(FRAMEWORK)
 
-#if !defined(CONFIG_SPL_EARLY_BSS)
-	SPL_CLEAR_BSS
+#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_EARLY_BSS)
+	CLEAR_BSS
 #endif
 
 # ifdef CONFIG_SPL_BUILD
diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
index fb4d1a5..404e5f1 100644
--- a/arch/m68k/lib/bdinfo.c
+++ b/arch/m68k/lib/bdinfo.c
@@ -11,14 +11,31 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int arch_setup_bdinfo(void)
+{
+	struct bd_info *bd = gd->bd;
+
+	bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
+
+	bd->bi_intfreq = gd->cpu_clk;	/* Internal Freq, in Hz */
+	bd->bi_busfreq = gd->bus_clk;	/* Bus Freq,      in Hz */
+
+	if (IS_ENABLED(CONFIG_PCI))
+		bd->bi_pcifreq = gd->pci_clk;
+
+#if defined(CONFIG_EXTRA_CLOCK)
+	bd->bi_inpfreq = gd->arch.inp_clk;	/* input Freq in Hz */
+	bd->bi_vcofreq = gd->arch.vco_clk;	/* vco Freq in Hz */
+	bd->bi_flbfreq = gd->arch.flb_clk;	/* flexbus Freq in Hz */
+#endif
+
+	return 0;
+}
+
 void arch_print_bdinfo(void)
 {
 	struct bd_info *bd = gd->bd;
 
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
-	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
-#endif
 	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 #if defined(CONFIG_SYS_MBAR)
 	bdinfo_print_num("mbar", bd->bi_mbar_base);
diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
index 75611e2..36c9c99 100644
--- a/arch/powerpc/lib/bdinfo.c
+++ b/arch/powerpc/lib/bdinfo.c
@@ -11,6 +11,31 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int arch_setup_bdinfo(void)
+{
+	struct bd_info *bd = gd->bd;
+
+#if defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
+	bd->bi_immr_base = CONFIG_SYS_IMMR;	/* base  of IMMR register     */
+#endif
+
+#if defined(CONFIG_MPC83xx)
+	bd->bi_immrbar = CONFIG_SYS_IMMR;
+#endif
+
+	bd->bi_intfreq = gd->cpu_clk;	/* Internal Freq, in Hz */
+	bd->bi_busfreq = gd->bus_clk;	/* Bus Freq,      in Hz */
+
+#if defined(CONFIG_CPM2)
+	bd->bi_cpmfreq = gd->arch.cpm_clk;
+	bd->bi_brgfreq = gd->arch.brg_clk;
+	bd->bi_sccfreq = gd->arch.scc_clk;
+	bd->bi_vco = gd->arch.vco_out;
+#endif /* CONFIG_CPM2 */
+
+	return 0;
+}
+
 void __weak board_detail(void)
 {
 	/* Please define board_detail() for your PPC platform */
@@ -20,10 +45,6 @@
 {
 	struct bd_info *bd = gd->bd;
 
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
-	bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
-#endif
 	bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
 	bdinfo_print_num("immr_base", bd->bi_immr_base);
diff --git a/arch/sh/dts/sh7751-r2dplus.dts b/arch/sh/dts/sh7751-r2dplus.dts
index efaeb33..da0648c 100644
--- a/arch/sh/dts/sh7751-r2dplus.dts
+++ b/arch/sh/dts/sh7751-r2dplus.dts
@@ -10,6 +10,29 @@
 	model = "R2D";
 	compatible = "renesas,r2d", "renesas,sh7751";
 
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	aliases {
+		serial0 = &scif1;
+	};
+
+	scif_clks: scif60 {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <60000000>;
+		u-boot,dm-pre-reloc;
+	};
+
+	scif1: serial@ffe80000 {
+		compatible = "renesas,scif";
+		reg = <0 0xffe80000 0 0x1000>;
+		clocks = <&scif_clks>;
+		clock-names = "fck";
+		status = "okay";
+		u-boot,dm-pre-reloc;
+	};
+
 	pci@fe200000 {
 		compatible = "renesas,pci-sh7751";
 		device_type = "pci";
diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S
index f9f26d3..ddb9aa9 100644
--- a/arch/sh/lib/start.S
+++ b/arch/sh/lib/start.S
@@ -53,7 +53,10 @@
 
 	mov.l	._gd_init, r13		/* global data */
 	mov.l	._stack_init, r15	/* stack */
-
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+	mov.l	._gd_malloc_base, r14
+	mov.l	r15, @r14
+#endif
 	mov.l	._sh_generic_init, r0
 	jsr	@r0
 	mov     #0, r4
@@ -70,5 +73,8 @@
 ._bss_start:		.long	bss_start
 ._bss_end:		.long	bss_end
 ._gd_init:		.long	(_start - GENERATED_GBL_DATA_SIZE)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+._gd_malloc_base:	.long	(_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE)
+#endif
 ._stack_init:		.long	(_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
 ._sh_generic_init:	.long	board_init_f
diff --git a/arch/xtensa/lib/Makefile b/arch/xtensa/lib/Makefile
index c59df7d..ceee59b 100644
--- a/arch/xtensa/lib/Makefile
+++ b/arch/xtensa/lib/Makefile
@@ -5,4 +5,4 @@
 
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 
-obj-y 	+= cache.o misc.o relocate.o time.o
+obj-y 	+= cache.o misc.o relocate.o time.o bdinfo.o
diff --git a/arch/xtensa/lib/bdinfo.c b/arch/xtensa/lib/bdinfo.c
new file mode 100644
index 0000000..4ec8529
--- /dev/null
+++ b/arch/xtensa/lib/bdinfo.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * XTENSA-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#include <common.h>
+#include <init.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int arch_setup_bdinfo(void)
+{
+	struct bd_info *bd = gd->bd;
+
+	bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
+	bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+
+	return 0;
+}
diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
index 2869e5c..4b49b6e 100644
--- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c
@@ -51,9 +51,6 @@
 
 int dram_init_banksize(void)
 {
-	gd->bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
-	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-
 	return 0;
 }
 
diff --git a/board/mikrotik/crs3xx-98dx3236/MAINTAINERS b/board/mikrotik/crs3xx-98dx3236/MAINTAINERS
index 127e0ea..906ff98 100644
--- a/board/mikrotik/crs3xx-98dx3236/MAINTAINERS
+++ b/board/mikrotik/crs3xx-98dx3236/MAINTAINERS
@@ -1,11 +1,33 @@
 CRS3XX-98DX3236 BOARD
 M:	Luka Kovacic <luka.kovacic@sartura.hr>
+M:	Luka Perkov <luka.perkov@sartura.hr>
 S:	Maintained
 F:	board/mikrotik/crs3xx-98dx3236/
 F:	include/configs/crs3xx-98dx3236.h
 
 CRS305-1G-4S BOARD
 M:	Luka Kovacic <luka.kovacic@sartura.hr>
+M:	Luka Perkov <luka.perkov@sartura.hr>
 S:	Maintained
 F:	configs/crs305-1g-4s_defconfig
+F:	configs/crs305-1g-4s-bit_defconfig
 F:	arch/arm/dts/armada-xp-crs305-1g-4s.dts
+F:	arch/arm/dts/armada-xp-crs305-1g-4s-bit.dts
+
+CRS326-24G-2S BOARD
+M:	Luka Kovacic <luka.kovacic@sartura.hr>
+M:	Luka Perkov <luka.perkov@sartura.hr>
+S:	Maintained
+F:	configs/crs326-24g-2s_defconfig
+F:	configs/crs326-24g-2s-bit_defconfig
+F:	arch/arm/dts/armada-xp-crs326-24g-2s.dts
+F:	arch/arm/dts/armada-xp-crs326-24g-2s-bit.dts
+
+CRS328-4C-20S-4S BOARD
+M:	Luka Kovacic <luka.kovacic@sartura.hr>
+M:	Luka Perkov <luka.perkov@sartura.hr>
+S:	Maintained
+F:	configs/crs328-4c-20s-4s_defconfig
+F:	configs/crs328-4c-20s-4s-bit_defconfig
+F:	arch/arm/dts/armada-xp-crs328-4c-20s-4s.dts
+F:	arch/arm/dts/armada-xp-crs328-4c-20s-4s-bit.dts
diff --git a/cmd/Kconfig b/cmd/Kconfig
index d7136b0..e111764 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1148,6 +1148,14 @@
 
 endif
 
+config CMD_CLONE
+	bool "clone"
+	depends on BLK
+	help
+	  Enable storage cloning over block devices, useful for
+	  initial flashing by external block device without network
+	  or usb support.
+
 config CMD_MTD
 	bool "mtd"
 	depends on MTD
diff --git a/cmd/Makefile b/cmd/Makefile
index 6e0086b..7075037 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -98,6 +98,7 @@
 obj-$(CONFIG_MP) += mp.o
 obj-$(CONFIG_CMD_MTD) += mtd.o
 obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o
+obj-$(CONFIG_CMD_CLONE) += clone.o
 ifneq ($(CONFIG_CMD_NAND)$(CONFIG_CMD_SF),)
 obj-y += legacy-mtd-utils.o
 endif
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 8b2c105..9593b34 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <lmb.h>
 #include <net.h>
 #include <vsprintf.h>
 #include <asm/cache.h>
@@ -33,9 +34,10 @@
 	printf("%-12s= %s\n", name, val);
 }
 
-static void print_lnum(const char *name, unsigned long long value)
+static void print_phys_addr(const char *name, phys_addr_t value)
 {
-	printf("%-12s= 0x%.8llX\n", name, value);
+	printf("%-12s= 0x%.*llx\n", name, 2 * (int)sizeof(ulong),
+	       (unsigned long long)value);
 }
 
 void bdinfo_print_mhz(const char *name, unsigned long hz)
@@ -74,7 +76,11 @@
 	bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params);
 	print_bi_dram(bd);
 	bdinfo_print_num("memstart", (ulong)bd->bi_memstart);
-	print_lnum("memsize", (u64)bd->bi_memsize);
+	print_phys_addr("memsize", bd->bi_memsize);
+	if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
+		bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
+		bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
+	}
 	bdinfo_print_num("flashstart", (ulong)bd->bi_flashstart);
 	bdinfo_print_num("flashsize", (ulong)bd->bi_flashsize);
 	bdinfo_print_num("flashoffset", (ulong)bd->bi_flashoffset);
@@ -96,6 +102,12 @@
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
 	bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
 #endif
+	if (gd->fdt_blob) {
+		struct lmb lmb;
+
+		lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
+		lmb_dump_all_force(&lmb);
+	}
 
 	arch_print_bdinfo();
 
diff --git a/cmd/bootz.c b/cmd/bootz.c
index 1c8b0cf..7556cd2 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -54,7 +54,7 @@
 	 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
 	 * have a header that provide this informaiton.
 	 */
-	if (bootm_find_images(flag, argc, argv, zi_start, zi_end - zi_start))
+	if (bootm_find_images(flag, argc, argv, images->ep, zi_end - zi_start))
 		return 1;
 
 	return 0;
diff --git a/cmd/clone.c b/cmd/clone.c
new file mode 100644
index 0000000..97747f8
--- /dev/null
+++ b/cmd/clone.c
@@ -0,0 +1,126 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 John Chau <john@harmon.hk>
+ *
+ */
+
+#include <common.h>
+#include <command.h>
+#include <malloc.h>
+#include <part.h>
+#include <blk.h>
+#include <vsprintf.h>
+
+#define BUFSIZE (1 * 1024 * 1024)
+static int do_clone(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+	int srcdev, destdev;
+	struct blk_desc *srcdesc, *destdesc;
+	int srcbz, destbz, ret;
+	char *unit, *buf;
+	unsigned long wrcnt, rdcnt, requested, srcblk, destblk;
+	unsigned long timer;
+	const unsigned long buffersize = 1024 * 1024;
+
+	if (argc < 6)
+		return CMD_RET_USAGE;
+
+	srcdev = blk_get_device_by_str(argv[1], argv[2], &srcdesc);
+	destdev = blk_get_device_by_str(argv[3], argv[4], &destdesc);
+	if (srcdev < 0) {
+		printf("Unable to open source device\n");
+		return 1;
+	} else if (destdev < 0) {
+		printf("Unable to open destination device\n");
+		return 1;
+	}
+	requested = simple_strtoul(argv[5], &unit, 10);
+	srcbz = srcdesc->blksz;
+	destbz = destdesc->blksz;
+
+	if ((srcbz * (buffersize / srcbz) != buffersize) &&
+	    (destbz * (buffersize / destbz) != buffersize)) {
+		printf("failed: cannot match device block sizes\n");
+		return 1;
+	}
+	if (requested == 0) {
+		unsigned long a = srcdesc->lba * srcdesc->blksz;
+		unsigned long b = destdesc->lba * destdesc->blksz;
+
+		if (a > b)
+			requested = a;
+		else
+			requested = b;
+	} else {
+		switch (unit[0]) {
+		case 'g':
+		case 'G':
+			requested *= 1024;
+		case 'm':
+		case 'M':
+			requested *= 1024;
+		case 'k':
+		case 'K':
+			requested *= 1024;
+			break;
+		}
+	}
+	printf("Copying %ld bytes from %s:%s to %s:%s\n",
+	       requested, argv[1], argv[2], argv[3], argv[4]);
+	wrcnt = 0;
+	rdcnt = 0;
+	buf = (char *)malloc(BUFSIZE);
+	srcblk = 0;
+	destblk = 0;
+	timer = get_timer(0);
+	while (wrcnt < requested) {
+		unsigned long toread = BUFSIZE / srcbz;
+		unsigned long towrite = BUFSIZE / destbz;
+		unsigned long offset = 0;
+
+read:
+		ret = blk_dread(srcdesc, srcblk, toread, buf + offset);
+		if (ret < 0) {
+			printf("Src read error @blk %ld\n", srcblk);
+			goto exit;
+		}
+		rdcnt += ret * srcbz;
+		srcblk += ret;
+		if (ret < toread) {
+			toread -= ret;
+			offset += ret * srcbz;
+			goto read;
+		}
+		offset = 0;
+write:
+		ret = blk_dwrite(destdesc, destblk, towrite, buf + offset);
+		if (ret < 0) {
+			printf("Dest write error @blk %ld\n", srcblk);
+			goto exit;
+		}
+		wrcnt += ret * destbz;
+		destblk += ret;
+		if (ret < towrite) {
+			towrite -= ret;
+			offset += ret * destbz;
+			goto write;
+		}
+	}
+
+exit:
+	timer = get_timer(timer);
+	timer = 1000 * timer / CONFIG_SYS_HZ;
+	printf("%ld read\n", rdcnt);
+	printf("%ld written\n", wrcnt);
+	printf("%ldms, %ldkB/s\n", timer, wrcnt / timer);
+	free(buf);
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	clone, 6, 1, do_clone,
+	"simple storage cloning",
+	"<src interface> <src dev> <dest interface> <dest dev> <size[K/M/G]>\n"
+	"clone storage from 'src dev' on 'src interface' to 'dest dev' on 'dest interface' with maximum 'size' bytes (or 0 for clone to end)"
+);
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index a27b0df..0d52be8 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -176,16 +176,6 @@
 		return err;
 	}
 
-#ifdef CONFIG_SYS_MMC_ENV_PART
-	if (mmc->part_num != CONFIG_SYS_MMC_ENV_PART) {
-		err = mmc_switch_part(mmc_dev_num, CONFIG_SYS_MMC_ENV_PART);
-		if (err) {
-			printf("MMC partition switch failed\n");
-			return err;
-		}
-	}
-#endif
-
 	/* SD reserves LBA-0 for MBR and boots from LBA-1,
 	 * MMC/eMMC boots from LBA-0
 	 */
@@ -217,11 +207,6 @@
 	}
 	printf("Done!\n");
 
-#ifdef CONFIG_SYS_MMC_ENV_PART
-	if (mmc->part_num != CONFIG_SYS_MMC_ENV_PART)
-		mmc_switch_part(mmc_dev_num, mmc->part_num);
-#endif
-
 	return 0;
 }
 
@@ -299,9 +284,6 @@
 		return -ENOMEDIUM;
 	}
 
-#ifdef CONFIG_SPI_FLASH_PROTECTION
-	spi_flash_protect(flash, 0);
-#endif
 	erase_bytes = image_size +
 		(flash->erase_size - image_size % flash->erase_size);
 	printf("Erasing %d bytes (%d blocks) at offset 0 ...",
@@ -320,10 +302,6 @@
 	else
 		printf("Done!\n");
 
-#ifdef CONFIG_SPI_FLASH_PROTECTION
-	spi_flash_protect(flash, 1);
-#endif
-
 	return ret;
 }
 
diff --git a/common/Kconfig b/common/Kconfig
index 67b3818..62d78c5 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -403,6 +403,7 @@
 
 config USE_PREBOOT
 	bool "Enable preboot"
+	default "usb start" if USB_KEYBOARD
 	help
 	  When this option is enabled, the existence of the environment
 	  variable "preboot" will be checked immediately before starting the
diff --git a/common/board_f.c b/common/board_f.c
index 88ff042..79532f4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -598,62 +598,25 @@
 	return 0;
 }
 
-#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
-	defined(CONFIG_SH)
-static int setup_board_part1(void)
+__weak int arch_setup_bdinfo(void)
+{
+	return 0;
+}
+
+int setup_bdinfo(void)
 {
 	struct bd_info *bd = gd->bd;
 
-	/*
-	 * Save local variables to board info struct
-	 */
-	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;	/* start of memory */
-	bd->bi_memsize = gd->ram_size;			/* size in bytes */
+	bd->bi_memstart = gd->ram_base;  /* start of memory */
+	bd->bi_memsize = gd->ram_size;   /* size in bytes */
 
-#ifdef CONFIG_SYS_SRAM_BASE
-	bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;	/* start of SRAM */
-	bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;		/* size  of SRAM */
-#endif
+	if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
+		bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
+		bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;  /* size  of SRAM */
+	}
 
-#if defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
-	bd->bi_immr_base = CONFIG_SYS_IMMR;	/* base  of IMMR register     */
-#endif
-#if defined(CONFIG_M68K)
-	bd->bi_mbar_base = CONFIG_SYS_MBAR;	/* base of internal registers */
-#endif
-#if defined(CONFIG_MPC83xx)
-	bd->bi_immrbar = CONFIG_SYS_IMMR;
-#endif
-
-	return 0;
+	return arch_setup_bdinfo();
 }
-#endif
-
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
-static int setup_board_part2(void)
-{
-	struct bd_info *bd = gd->bd;
-
-	bd->bi_intfreq = gd->cpu_clk;	/* Internal Freq, in Hz */
-	bd->bi_busfreq = gd->bus_clk;	/* Bus Freq,      in Hz */
-#if defined(CONFIG_CPM2)
-	bd->bi_cpmfreq = gd->arch.cpm_clk;
-	bd->bi_brgfreq = gd->arch.brg_clk;
-	bd->bi_sccfreq = gd->arch.scc_clk;
-	bd->bi_vco = gd->arch.vco_out;
-#endif /* CONFIG_CPM2 */
-#if defined(CONFIG_M68K) && defined(CONFIG_PCI)
-	bd->bi_pcifreq = gd->pci_clk;
-#endif
-#if defined(CONFIG_EXTRA_CLOCK)
-	bd->bi_inpfreq = gd->arch.inp_clk;	/* input Freq in Hz */
-	bd->bi_vcofreq = gd->arch.vco_clk;	/* vco Freq in Hz */
-	bd->bi_flbfreq = gd->arch.flb_clk;	/* flexbus Freq in Hz */
-#endif
-
-	return 0;
-}
-#endif
 
 #ifdef CONFIG_POST
 static int init_post(void)
@@ -975,14 +938,8 @@
 	reserve_stacks,
 	dram_init_banksize,
 	show_dram_config,
-#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
-	defined(CONFIG_SH)
-	setup_board_part1,
-#endif
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
 	INIT_FUNC_WATCHDOG_RESET
-	setup_board_part2,
-#endif
+	setup_bdinfo,
 	display_new_sp,
 #ifdef CONFIG_OF_BOARD_FIXUP
 	fix_fdt,
diff --git a/common/board_r.c b/common/board_r.c
index d9307f0..d48d2bb 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -187,12 +187,6 @@
 	return 0;
 }
 
-static int initr_serial(void)
-{
-	serial_initialize();
-	return 0;
-}
-
 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
 static int initr_trap(void)
 {
@@ -714,12 +708,15 @@
 #endif
 	initr_dm_devices,
 	stdio_init_tables,
-	initr_serial,
+	serial_initialize,
 	initr_announce,
 #if CONFIG_IS_ENABLED(WDT)
 	initr_watchdog,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
+#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE)
+	blkcache_init,
+#endif
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	initr_manual_reloc_cmdtable,
 #endif
@@ -854,9 +851,6 @@
 #if defined(CONFIG_PRAM)
 	initr_mem,
 #endif
-#if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
-	blkcache_init,
-#endif
 	run_main_loop,
 };
 
diff --git a/configs/crs305-1g-4s-bit_defconfig b/configs/crs305-1g-4s-bit_defconfig
new file mode 100644
index 0000000..0ecf11a
--- /dev/null
+++ b/configs/crs305-1g-4s-bit_defconfig
@@ -0,0 +1,54 @@
+CONFIG_ARM=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_SYS_TEXT_BASE=0x00800000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CRS3XX_98DX3236=y
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_OFFSET=0x1F0000
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+# CONFIG_EFI_LOADER is not set
+CONFIG_BUILD_TARGET="u-boot.kwb"
+CONFIG_USE_PREBOOT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, to stop use 's' key\n"
+CONFIG_AUTOBOOT_STOP_STR="s"
+CONFIG_AUTOBOOT_KEYED_CTRLC=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_I2C is not set
+CONFIG_CMD_SPI=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_DEFAULT_DEVICE_TREE="armada-xp-crs305-1g-4s-bit"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_BLK=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
+# CONFIG_DM_I2C is not set
+# CONFIG_SYS_I2C_MVTWSI is not set
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_MACRONIX=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_BEST_MATCH=y
+CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
+CONFIG_SYS_NS16550=y
+CONFIG_KIRKWOOD_SPI=y
diff --git a/configs/crs305-1g-4s_defconfig b/configs/crs305-1g-4s_defconfig
index 2afd26d..f50dab6 100644
--- a/configs/crs305-1g-4s_defconfig
+++ b/configs/crs305-1g-4s_defconfig
@@ -5,15 +5,18 @@
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_TARGET_CRS3XX_98DX3236=y
 CONFIG_ENV_SIZE=0x10000
-CONFIG_ENV_OFFSET=0x80000
+CONFIG_ENV_OFFSET=0x1F0000
 CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_BUILD_TARGET="u-boot.kwb"
 CONFIG_DEFAULT_DEVICE_TREE="armada-xp-crs305-1g-4s"
 CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_FIT_BEST_MATCH=y
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
 CONFIG_AUTOBOOT_KEYED=y
 CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, to stop use 's' key\n"
 CONFIG_AUTOBOOT_STOP_STR="s"
@@ -23,11 +26,15 @@
 CONFIG_CMD_MTD=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_CACHE=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_BLK=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
 # CONFIG_MMC is not set
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
diff --git a/configs/crs326-24g-2s-bit_defconfig b/configs/crs326-24g-2s-bit_defconfig
new file mode 100644
index 0000000..18f2d34
--- /dev/null
+++ b/configs/crs326-24g-2s-bit_defconfig
@@ -0,0 +1,54 @@
+CONFIG_ARM=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_SYS_TEXT_BASE=0x00800000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CRS3XX_98DX3236=y
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_OFFSET=0x1F0000
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+# CONFIG_EFI_LOADER is not set
+CONFIG_BUILD_TARGET="u-boot.kwb"
+CONFIG_USE_PREBOOT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, to stop use 's' key\n"
+CONFIG_AUTOBOOT_STOP_STR="s"
+CONFIG_AUTOBOOT_KEYED_CTRLC=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_I2C is not set
+CONFIG_CMD_SPI=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_DEFAULT_DEVICE_TREE="armada-xp-crs326-24g-2s-bit"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_BLK=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
+# CONFIG_DM_I2C is not set
+# CONFIG_SYS_I2C_MVTWSI is not set
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_MACRONIX=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_BEST_MATCH=y
+CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
+CONFIG_SYS_NS16550=y
+CONFIG_KIRKWOOD_SPI=y
diff --git a/configs/crs326-24g-2s_defconfig b/configs/crs326-24g-2s_defconfig
new file mode 100644
index 0000000..fec7922
--- /dev/null
+++ b/configs/crs326-24g-2s_defconfig
@@ -0,0 +1,54 @@
+CONFIG_ARM=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_SYS_TEXT_BASE=0x00800000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CRS3XX_98DX3236=y
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_OFFSET=0x1F0000
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+# CONFIG_EFI_LOADER is not set
+CONFIG_BUILD_TARGET="u-boot.kwb"
+CONFIG_USE_PREBOOT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, to stop use 's' key\n"
+CONFIG_AUTOBOOT_STOP_STR="s"
+CONFIG_AUTOBOOT_KEYED_CTRLC=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_I2C is not set
+CONFIG_CMD_SPI=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_DEFAULT_DEVICE_TREE="armada-xp-crs326-24g-2s"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_BLK=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
+# CONFIG_DM_I2C is not set
+# CONFIG_SYS_I2C_MVTWSI is not set
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_WINBOND=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_BEST_MATCH=y
+CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
+CONFIG_SYS_NS16550=y
+CONFIG_KIRKWOOD_SPI=y
diff --git a/configs/crs328-4c-20s-4s-bit_defconfig b/configs/crs328-4c-20s-4s-bit_defconfig
new file mode 100644
index 0000000..9b949e6
--- /dev/null
+++ b/configs/crs328-4c-20s-4s-bit_defconfig
@@ -0,0 +1,54 @@
+CONFIG_ARM=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_SYS_TEXT_BASE=0x00800000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CRS3XX_98DX3236=y
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_OFFSET=0x1F0000
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+# CONFIG_EFI_LOADER is not set
+CONFIG_BUILD_TARGET="u-boot.kwb"
+CONFIG_USE_PREBOOT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, to stop use 's' key\n"
+CONFIG_AUTOBOOT_STOP_STR="s"
+CONFIG_AUTOBOOT_KEYED_CTRLC=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_I2C is not set
+CONFIG_CMD_SPI=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_DEFAULT_DEVICE_TREE="armada-xp-crs328-4c-20s-4s-bit"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_BLK=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
+# CONFIG_DM_I2C is not set
+# CONFIG_SYS_I2C_MVTWSI is not set
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_MACRONIX=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_BEST_MATCH=y
+CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
+CONFIG_SYS_NS16550=y
+CONFIG_KIRKWOOD_SPI=y
diff --git a/configs/crs328-4c-20s-4s_defconfig b/configs/crs328-4c-20s-4s_defconfig
new file mode 100644
index 0000000..33eefbd
--- /dev/null
+++ b/configs/crs328-4c-20s-4s_defconfig
@@ -0,0 +1,54 @@
+CONFIG_ARM=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_SYS_TEXT_BASE=0x00800000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CRS3XX_98DX3236=y
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_OFFSET=0x1F0000
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+# CONFIG_EFI_LOADER is not set
+CONFIG_BUILD_TARGET="u-boot.kwb"
+CONFIG_USE_PREBOOT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds, to stop use 's' key\n"
+CONFIG_AUTOBOOT_STOP_STR="s"
+CONFIG_AUTOBOOT_KEYED_CTRLC=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_I2C is not set
+CONFIG_CMD_SPI=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_UBI=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_DEFAULT_DEVICE_TREE="armada-xp-crs328-4c-20s-4s"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_BLK=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
+# CONFIG_DM_I2C is not set
+# CONFIG_SYS_I2C_MVTWSI is not set
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_WINBOND=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_FIT=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_BEST_MATCH=y
+CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
+CONFIG_SYS_NS16550=y
+CONFIG_KIRKWOOD_SPI=y
diff --git a/configs/libretech-ac_defconfig b/configs/libretech-ac_defconfig
index 62094f2..2ca169c 100644
--- a/configs/libretech-ac_defconfig
+++ b/configs/libretech-ac_defconfig
@@ -15,7 +15,6 @@
 CONFIG_DEBUG_UART=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/libretech-s905d-pc_defconfig b/configs/libretech-s905d-pc_defconfig
index 74e4c7f..c10e549 100644
--- a/configs/libretech-s905d-pc_defconfig
+++ b/configs/libretech-s905d-pc_defconfig
@@ -15,7 +15,6 @@
 CONFIG_DEBUG_UART=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_CMD_BDI is not set
diff --git a/configs/libretech-s912-pc_defconfig b/configs/libretech-s912-pc_defconfig
index 7fe00a9..fffca0f 100644
--- a/configs/libretech-s912-pc_defconfig
+++ b/configs/libretech-s912-pc_defconfig
@@ -14,7 +14,6 @@
 CONFIG_DEBUG_UART=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_CMD_BDI is not set
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 959c40c..3967863 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -13,7 +13,6 @@
 CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb"
 CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig
index 5263123..a2d666e 100644
--- a/configs/r2dplus_defconfig
+++ b/configs/r2dplus_defconfig
@@ -4,10 +4,11 @@
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="sh7751-r2dplus"
 CONFIG_TARGET_R2DPLUS=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_BOOTDELAY=-1
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttySC0,115200"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="pci enum"
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_IMLS=y
 CONFIG_CMD_DM=y
@@ -24,12 +25,20 @@
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0xA0040000
 CONFIG_DM=y
+CONFIG_CLK=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_DM_ETH=y
+CONFIG_E1000=y
+CONFIG_EEPRO100=y
+CONFIG_PCNET=y
 CONFIG_RTL8139=y
+CONFIG_TULIP=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
-CONFIG_DM_PCI_COMPAT=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_DM_SERIAL=y
+CONFIG_SERIAL_RX_BUFFER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
index 31d3095..a420372 100644
--- a/configs/rockpro64-rk3399_defconfig
+++ b/configs/rockpro64-rk3399_defconfig
@@ -13,7 +13,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64"
 CONFIG_DEBUG_UART=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb"
 CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig
index a8752f5..350a182 100644
--- a/configs/rpi_0_w_defconfig
+++ b/configs/rpi_0_w_defconfig
@@ -9,7 +9,6 @@
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index 867f59c..2ec3c4b 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -9,7 +9,6 @@
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
index 08643fa..8c3c980 100644
--- a/configs/rpi_3_32b_defconfig
+++ b/configs/rpi_3_32b_defconfig
@@ -10,7 +10,6 @@
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig
index c31ea55..1e2d4b1 100644
--- a/configs/rpi_3_b_plus_defconfig
+++ b/configs/rpi_3_b_plus_defconfig
@@ -10,7 +10,6 @@
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
index aa4770e..e992b64 100644
--- a/configs/rpi_3_defconfig
+++ b/configs/rpi_3_defconfig
@@ -10,7 +10,6 @@
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
index da767ef..8532cac 100644
--- a/configs/rpi_defconfig
+++ b/configs/rpi_defconfig
@@ -9,7 +9,6 @@
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/seaboard_defconfig b/configs/seaboard_defconfig
index cc47587..e440458 100644
--- a/configs/seaboard_defconfig
+++ b/configs/seaboard_defconfig
@@ -10,7 +10,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-seaboard"
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_SYS_PROMPT="Tegra20 (SeaBoard) # "
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_FLASH is not set
diff --git a/configs/ventana_defconfig b/configs/ventana_defconfig
index 33131ce..b51254a 100644
--- a/configs/ventana_defconfig
+++ b/configs/ventana_defconfig
@@ -10,7 +10,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-ventana"
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start"
 CONFIG_SYS_PROMPT="Tegra20 (Ventana) # "
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
diff --git a/doc/README.clang b/doc/README.clang
deleted file mode 100644
index 475bb1e..0000000
--- a/doc/README.clang
+++ /dev/null
@@ -1,55 +0,0 @@
-The biggest problem when trying to compile U-Boot with clang is that
-almost all archs rely on storing gd in a global register and clang user
-manual states: "clang does not support global register variables; this
-is unlikely to be implemented soon because it requires additional LLVM
-backend support."
-
-Since version 3.4 the ARM backend can be instructed to leave r9 alone.
-Global registers themselves are not supported so some inline assembly is
-used to get its value. This does lead to larger code then strictly
-necessary, but at least works.
-
-NOTE: target compilation only work for _some_ ARM boards at the moment.
-Also AArch64 is not supported currently due to a lack of private libgcc
-support.  Boards which reassign gd in c will also fail to compile, but there is
-in no strict reason to do so in the ARM world, since crt0.S takes care of this.
-These assignments can be avoided by changing the init calls but this is not in
-mainline yet.
-
-Debian (based)
---------------
-Binary packages can be installed as usual, e.g.:
-sudo apt-get install clang
-
-Note that we still use binutils for some tools so we must continue to set
-CROSS_COMPILE. To compile U-Boot with clang on linux without IAS use e.g.:
-make HOSTCC=clang rpi_2_defconfig
-make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- \
-    CC="clang -target arm-linux-gnueabi" -j8
-
-It can also be used to compile sandbox:
-make HOSTCC=clang sandbox_defconfig
-make HOSTCC=clang CC=clang -j8
-
-FreeBSD 11 (Current):
---------------------
-Since llvm 3.4 is currently in the base system, the integrated as is
-incapable of building U-Boot. Therefore gas from devel/arm-gnueabi-binutils
-is used instead. It needs a symlinks to be picked up correctly though:
-
-ln -s /usr/local/bin/arm-gnueabi-freebsd-as /usr/bin/arm-freebsd-eabi-as
-
-# The following commands compile U-Boot using the clang xdev toolchain.
-# NOTE: CROSS_COMPILE and target differ on purpose!
-export CROSS_COMPILE=arm-gnueabi-freebsd-
-gmake rpi_2_defconfig
-gmake CC="clang -target arm-freebsd-eabi --sysroot /usr/arm-freebsd" -j8
-
-Given that U-Boot will default to gcc, above commands can be
-simplified with a simple wrapper script, listed below.
-
-/usr/local/bin/arm-gnueabi-freebsd-gcc
----
-#!/bin/sh
-
-exec clang -target arm-freebsd-eabi --sysroot /usr/arm-freebsd "$@"
diff --git a/doc/build/clang.rst b/doc/build/clang.rst
new file mode 100644
index 0000000..1d35616
--- /dev/null
+++ b/doc/build/clang.rst
@@ -0,0 +1,76 @@
+Building with Clang
+===================
+
+The biggest problem when trying to compile U-Boot with Clang is that almost all
+archs rely on storing gd in a global register and the Clang 3.5 user manual
+states: "Clang does not support global register variables; this is unlikely to
+be implemented soon because it requires additional LLVM backend support."
+
+The ARM backend can be instructed not to use the r9 and x18 registers using
+-ffixed-r9 or -ffixed-x18 respectively. As global registers themselves are not
+supported inline assembly is needed to get and set the r9 or x18 value. This
+leads to larger code then strictly necessary, but at least works.
+
+**NOTE:** target compilation only work for _some_ ARM boards at the moment.
+Also AArch64 is not supported currently due to a lack of private libgcc
+support. Boards which reassign gd in c will also fail to compile, but there is
+in no strict reason to do so in the ARM world, since crt0.S takes care of this.
+These assignments can be avoided by changing the init calls but this is not in
+mainline yet.
+
+
+Debian based
+------------
+
+Required packages can be installed via apt, e.g.
+
+.. code-block:: bash
+
+    sudo apt-get install clang
+
+Note that we still use binutils for some tools so we must continue to set
+CROSS_COMPILE. To compile U-Boot with Clang on Linux without IAS use e.g.
+
+.. code-block:: bash
+
+    make HOSTCC=clang rpi_2_defconfig
+    make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- \
+         CC="clang -target arm-linux-gnueabi" -j8
+
+It can also be used to compile sandbox:
+
+.. code-block:: bash
+
+    make HOSTCC=clang sandbox_defconfig
+    make HOSTCC=clang CC=clang -j8
+
+
+FreeBSD 11
+----------
+
+Since llvm 3.4 is currently in the base system, the integrated assembler as
+is incapable of building U-Boot. Therefore gas from devel/arm-gnueabi-binutils
+is used instead. It needs a symlink to be picked up correctly though:
+
+.. code-block:: bash
+
+    ln -s /usr/local/bin/arm-gnueabi-freebsd-as /usr/bin/arm-freebsd-eabi-as
+
+The following commands compile U-Boot using the Clang xdev toolchain.
+
+**NOTE:** CROSS_COMPILE and target differ on purpose!
+
+.. code-block:: bash
+
+    export CROSS_COMPILE=arm-gnueabi-freebsd-
+    gmake rpi_2_defconfig
+    gmake CC="clang -target arm-freebsd-eabi --sysroot /usr/arm-freebsd" -j8
+
+Given that U-Boot will default to gcc, above commands can be
+simplified with a simple wrapper script - saved as
+/usr/local/bin/arm-gnueabi-freebsd-gcc - listed below:
+
+.. code-block:: bash
+
+    #!/bin/sh
+    exec clang -target arm-freebsd-eabi --sysroot /usr/arm-freebsd "$@"
diff --git a/doc/build/index.rst b/doc/build/index.rst
index e4e3411..e0072af 100644
--- a/doc/build/index.rst
+++ b/doc/build/index.rst
@@ -6,4 +6,5 @@
 .. toctree::
    :maxdepth: 2
 
+   clang
    tools
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index b19375c..b46a1ac 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -644,11 +644,12 @@
 
 static int blk_post_probe(struct udevice *dev)
 {
-#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
-	struct blk_desc *desc = dev_get_uclass_platdata(dev);
+	if (IS_ENABLED(CONFIG_PARTITIONS) &&
+	    IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) {
+		struct blk_desc *desc = dev_get_uclass_platdata(dev);
 
-	part_init(desc);
-#endif
+		part_init(desc);
+	}
 
 	return 0;
 }
diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c
index b6fc72f..eca6619 100644
--- a/drivers/block/blkcache.c
+++ b/drivers/block/blkcache.c
@@ -12,6 +12,10 @@
 #include <linux/ctype.h>
 #include <linux/list.h>
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 struct block_cache_node {
 	struct list_head lh;
 	int iftype;
@@ -22,21 +26,20 @@
 	char *cache;
 };
 
-#ifndef CONFIG_M68K
 static LIST_HEAD(block_cache);
-#else
-static struct list_head block_cache;
-#endif
 
 static struct block_cache_stats _stats = {
 	.max_blocks_per_entry = 8,
 	.max_entries = 32
 };
 
-#ifdef CONFIG_M68K
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
 int blkcache_init(void)
 {
-	INIT_LIST_HEAD(&block_cache);
+	struct list_head *head = &block_cache;
+
+	head->next = (uintptr_t)head->next + gd->reloc_off;
+	head->prev = (uintptr_t)head->prev + gd->reloc_off;
 
 	return 0;
 }
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index 23cf807..7d2e49f 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -25,7 +25,11 @@
 #define PSCI_METHOD_HVC 1
 #define PSCI_METHOD_SMC 2
 
+#if CONFIG_IS_ENABLED(EFI_LOADER)
 int __efi_runtime_data psci_method;
+#else
+int psci_method __attribute__ ((section(".data")));
+#endif
 
 unsigned long __efi_runtime invoke_psci_fn
 		(unsigned long function_id, unsigned long arg0,
diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c
index 84d60b8..294daee 100644
--- a/drivers/mtd/nand/bbt.c
+++ b/drivers/mtd/nand/bbt.c
@@ -127,7 +127,7 @@
 		unsigned int rbits = bits_per_block + offs - BITS_PER_LONG;
 
 		pos[1] &= ~GENMASK(rbits - 1, 0);
-		pos[1] |= val >> rbits;
+		pos[1] |= val >> (bits_per_block - rbits);
 	}
 
 	return 0;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 15030b8..ecd779d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -156,9 +156,30 @@
 	help
 	  This driver supports the Synopsys Designware Ethernet QOS (Quality
 	  Of Service) IP block. The IP supports many options for bus type,
-	  clocking/reset structure, and feature list. This driver currently
-	  supports the specific configuration used in NVIDIA's Tegra186 chip,
-	  but should be extensible to other combinations quite easily.
+	  clocking/reset structure, and feature list.
+
+config DWC_ETH_QOS_IMX
+	bool "Synopsys DWC Ethernet QOS device support for IMX"
+	depends on DWC_ETH_QOS
+	help
+	  The Synopsys Designware Ethernet QOS IP block with the specific
+	  configuration used in IMX soc.
+
+config DWC_ETH_QOS_STM32
+	bool "Synopsys DWC Ethernet QOS device support for STM32"
+	depends on DWC_ETH_QOS
+	default y if ARCH_STM32MP
+	help
+	  The Synopsys Designware Ethernet QOS IP block with the specific
+	  configuration used in STM32MP soc.
+
+config DWC_ETH_QOS_TEGRA186
+	bool "Synopsys DWC Ethernet QOS device support for TEGRA186"
+	depends on DWC_ETH_QOS
+	default y if TEGRA186
+	help
+	  The Synopsys Designware Ethernet QOS IP block with specific
+	  configuration used in NVIDIA's Tegra186 chip.
 
 config E1000
 	bool "Intel PRO/1000 Gigabit Ethernet support"
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 1d9eefb..810a2b9 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -2100,7 +2100,7 @@
 	.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_tegra186
 };
 
-static const struct eqos_config eqos_tegra186_config = {
+static const struct eqos_config __maybe_unused eqos_tegra186_config = {
 	.reg_access_always_ok = false,
 	.mdio_wait = 10,
 	.swr_wait = 10,
@@ -2127,7 +2127,7 @@
 	.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32
 };
 
-static const struct eqos_config eqos_stm32_config = {
+static const struct eqos_config __maybe_unused eqos_stm32_config = {
 	.reg_access_always_ok = false,
 	.mdio_wait = 10000,
 	.swr_wait = 50,
@@ -2154,7 +2154,7 @@
 	.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx
 };
 
-struct eqos_config eqos_imx_config = {
+struct eqos_config __maybe_unused eqos_imx_config = {
 	.reg_access_always_ok = false,
 	.mdio_wait = 10000,
 	.swr_wait = 50,
@@ -2165,18 +2165,24 @@
 };
 
 static const struct udevice_id eqos_ids[] = {
+#if IS_ENABLED(CONFIG_DWC_ETH_QOS_TEGRA186)
 	{
 		.compatible = "nvidia,tegra186-eqos",
 		.data = (ulong)&eqos_tegra186_config
 	},
+#endif
+#if IS_ENABLED(CONFIG_DWC_ETH_QOS_STM32)
 	{
 		.compatible = "st,stm32mp1-dwmac",
 		.data = (ulong)&eqos_stm32_config
 	},
+#endif
+#if IS_ENABLED(CONFIG_DWC_ETH_QOS_IMX)
 	{
 		.compatible = "fsl,imx-eqos",
 		.data = (ulong)&eqos_imx_config
 	},
+#endif
 
 	{ }
 };
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index bd2061b..cdbccfd 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -276,13 +276,13 @@
 	  See the help of PINCTRL_STMFX for details.
 
 config ASPEED_AST2500_PINCTRL
-  bool "Aspeed AST2500 pin control driver"
-  depends on DM && PINCTRL_GENERIC && ASPEED_AST2500
-  default y
-  help
-    Support pin multiplexing control on Aspeed ast2500 SoC. The driver uses
-	Generic Pinctrl framework and is compatible with the Linux driver,
-	i.e. it uses the same device tree configuration.
+	bool "Aspeed AST2500 pin control driver"
+	depends on DM && PINCTRL_GENERIC && ASPEED_AST2500
+	default y
+	help
+	  Support pin multiplexing control on Aspeed ast2500 SoC. The driver
+	  uses Generic Pinctrl framework and is compatible with the Linux
+	  driver, i.e. it uses the same device tree configuration.
 
 endif
 
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index a0af0e6..0027625 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -170,9 +170,9 @@
 }
 
 /* Called after relocation */
-void serial_initialize(void)
+int serial_initialize(void)
 {
-	serial_init();
+	return serial_init();
 }
 
 static void _serial_putc(struct udevice *dev, char ch)
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index da017dc..53358ac 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -170,7 +170,7 @@
  * serial port to the serial core. That serial port is then used as a
  * default output.
  */
-void serial_initialize(void)
+int serial_initialize(void)
 {
 	atmel_serial_initialize();
 	mcf_serial_initialize();
@@ -183,6 +183,8 @@
 	mtk_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
+
+	return 0;
 }
 
 static int serial_stub_start(struct stdio_dev *sdev)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 9578b74..28aa5aa 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -278,7 +278,10 @@
 		}
 	} else {
 		idx = size / mydata->sect_size;
-		ret = disk_read(startsect, idx, buffer);
+		if (idx == 0)
+			ret = 0;
+		else
+			ret = disk_read(startsect, idx, buffer);
 		if (ret != idx) {
 			debug("Error reading data (got %d)\n", ret);
 			return -1;
diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h
index 5ef0fe7..87da441 100644
--- a/include/configs/devkit8000.h
+++ b/include/configs/devkit8000.h
@@ -137,10 +137,6 @@
 
 /* Boot Argument Buffer Size */
 
-/* SRAM config */
-#define CONFIG_SYS_SRAM_START              0x40200000
-#define CONFIG_SYS_SRAM_SIZE               0x10000
-
 /* Defines for SPL */
 
 /* NAND boot config */
diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h
index 73edd28..d50edc7 100644
--- a/include/configs/pic32mzdask.h
+++ b/include/configs/pic32mzdask.h
@@ -19,9 +19,6 @@
 /*----------------------------------------------------------------------
  * Memory Layout
  */
-#define CONFIG_SYS_SRAM_BASE		0x80000000
-#define CONFIG_SYS_SRAM_SIZE		0x00080000 /* 512K */
-
 /* Initial RAM for temporary stack, global data */
 #define CONFIG_SYS_INIT_RAM_SIZE	0x10000
 #define CONFIG_SYS_INIT_RAM_ADDR	\
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
index 4fdf0a5..61b6fb4 100644
--- a/include/configs/r2dplus.h
+++ b/include/configs/r2dplus.h
@@ -35,7 +35,6 @@
  * SuperH Clock setting
  */
 #define CONFIG_SYS_CLK_FREQ	60000000
-#define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ
 #define	CONFIG_SYS_PLL_SETTLING_TIME	100/* in us */
 
 /*
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5b0bec0..5d7544b 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -425,7 +425,6 @@
 
 #ifdef CONFIG_USB_KEYBOARD
 #define CONSOLE_STDIN_SETTINGS \
-	"preboot=usb start\0" \
 	"stdin=serial,usbkbd\0"
 #else
 #define CONSOLE_STDIN_SETTINGS \
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 02f5728..55f2585 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -197,10 +197,6 @@
 						CONFIG_SYS_INIT_RAM_SIZE - \
 						GENERATED_GBL_DATA_SIZE)
 
-/* SRAM config */
-#define CONFIG_SYS_SRAM_START		0x40200000
-#define CONFIG_SYS_SRAM_SIZE		0x10000
-
 /* Defines for SPL */
 
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME        "u-boot.img"
diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
index 6c90193..7e657da 100644
--- a/include/dt-bindings/phy/phy.h
+++ b/include/dt-bindings/phy/phy.h
@@ -15,5 +15,9 @@
 #define PHY_TYPE_PCIE		2
 #define PHY_TYPE_USB2		3
 #define PHY_TYPE_USB3		4
+#define PHY_TYPE_UFS		5
+#define PHY_TYPE_DP		6
+#define PHY_TYPE_XPCS		7
+#define PHY_TYPE_SGMII		8
 
 #endif /* _DT_BINDINGS_PHY */
diff --git a/include/init.h b/include/init.h
index de408ba..0f48ccb 100644
--- a/include/init.h
+++ b/include/init.h
@@ -142,6 +142,28 @@
 int arch_reserve_mmu(void);
 
 /**
+ * arch_setup_bdinfo() - Architecture dependent boardinfo setup
+ *
+ * Architecture-specific routine for populating various boardinfo fields of
+ * gd->bd. It is called during the generic board init sequence.
+ *
+ * If an implementation is not provided, it will just be a nop stub.
+ *
+ * Return: 0 if OK
+ */
+int arch_setup_bdinfo(void);
+
+/**
+ * setup_bdinfo() - Generic boardinfo setup
+ *
+ * Routine for populating various generic boardinfo fields of
+ * gd->bd. It is called during the generic board init sequence.
+ *
+ * Return: 0 if OK
+ */
+int setup_bdinfo(void);
+
+/**
  * init_cache_f_r() - Turn on the cache in preparation for relocation
  *
  * Return: 0 if OK, -ve on error
diff --git a/include/lmb.h b/include/lmb.h
index 73b7a5c..e9f19b16 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -49,6 +49,7 @@
 extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
 
 extern void lmb_dump_all(struct lmb *lmb);
+extern void lmb_dump_all_force(struct lmb *lmb);
 
 static inline phys_size_t
 lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
diff --git a/include/serial.h b/include/serial.h
index c590637..6d1e62c 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -42,10 +42,10 @@
 extern struct serial_device eserial6_device;
 
 extern void serial_register(struct serial_device *);
-extern void serial_initialize(void);
 extern void serial_stdio_init(void);
 extern int serial_assign(const char *name);
 extern void serial_reinit_all(void);
+int serial_initialize(void);
 
 /* For usbtty */
 #ifdef CONFIG_USB_TTY
diff --git a/lib/lmb.c b/lib/lmb.c
index 2d680d8..75082f3 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -14,33 +14,37 @@
 
 #define LMB_ALLOC_ANYWHERE	0
 
+void lmb_dump_all_force(struct lmb *lmb)
+{
+	unsigned long i;
+
+	printf("lmb_dump_all:\n");
+	printf("    memory.cnt		   = 0x%lx\n", lmb->memory.cnt);
+	printf("    memory.size		   = 0x%llx\n",
+	       (unsigned long long)lmb->memory.size);
+	for (i = 0; i < lmb->memory.cnt; i++) {
+		printf("    memory.reg[0x%lx].base   = 0x%llx\n", i,
+		       (unsigned long long)lmb->memory.region[i].base);
+		printf("		   .size   = 0x%llx\n",
+		       (unsigned long long)lmb->memory.region[i].size);
+	}
+
+	printf("\n    reserved.cnt	   = 0x%lx\n", lmb->reserved.cnt);
+	printf("    reserved.size	   = 0x%llx\n",
+	       (unsigned long long)lmb->reserved.size);
+	for (i = 0; i < lmb->reserved.cnt; i++) {
+		printf("    reserved.reg[0x%lx].base = 0x%llx\n", i,
+		       (unsigned long long)lmb->reserved.region[i].base);
+		printf("		     .size = 0x%llx\n",
+		       (unsigned long long)lmb->reserved.region[i].size);
+	}
+}
+
 void lmb_dump_all(struct lmb *lmb)
 {
 #ifdef DEBUG
-	unsigned long i;
-
-	debug("lmb_dump_all:\n");
-	debug("    memory.cnt		   = 0x%lx\n", lmb->memory.cnt);
-	debug("    memory.size		   = 0x%llx\n",
-	      (unsigned long long)lmb->memory.size);
-	for (i = 0; i < lmb->memory.cnt; i++) {
-		debug("    memory.reg[0x%lx].base   = 0x%llx\n", i,
-		      (unsigned long long)lmb->memory.region[i].base);
-		debug("		   .size   = 0x%llx\n",
-		      (unsigned long long)lmb->memory.region[i].size);
-	}
-
-	debug("\n    reserved.cnt	   = 0x%lx\n",
-		lmb->reserved.cnt);
-	debug("    reserved.size	   = 0x%llx\n",
-		(unsigned long long)lmb->reserved.size);
-	for (i = 0; i < lmb->reserved.cnt; i++) {
-		debug("    reserved.reg[0x%lx].base = 0x%llx\n", i,
-		      (unsigned long long)lmb->reserved.region[i].base);
-		debug("		     .size = 0x%llx\n",
-		      (unsigned long long)lmb->reserved.region[i].size);
-	}
-#endif /* DEBUG */
+	lmb_dump_all_force(lmb);
+#endif
 }
 
 static long lmb_addrs_overlap(phys_addr_t base1, phys_size_t size1,
diff --git a/net/Kconfig b/net/Kconfig
index 6c47b7d..6874b55 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -59,4 +59,13 @@
 	  almost-MTU block sizes.
 	  You can also activate CONFIG_IP_DEFRAG to set a larger block.
 
+config TFTP_WINDOWSIZE
+	int "TFTP window size"
+	default 1
+	help
+	  Default TFTP window size.
+	  RFC7440 defines an optional window size of transmits,
+	  before an ack response is required.
+	  The default TFTP implementation implies a window size of 1.
+
 endif   # if NET
diff --git a/net/net.c b/net/net.c
index 1e7f633..28d9eeb 100644
--- a/net/net.c
+++ b/net/net.c
@@ -409,6 +409,10 @@
 	int ret = -EINVAL;
 	enum net_loop_state prev_net_state = net_state;
 
+#if defined(CONFIG_CMD_PING)
+	if (protocol != PING)
+		net_ping_ip.s_addr = 0;
+#endif
 	net_restarted = 0;
 	net_dev_exists = 0;
 	net_try_count = 1;
diff --git a/net/tftp.c b/net/tftp.c
index c05b7b5..84e970b 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -5,7 +5,6 @@
  * Copyright 2011 Comelit Group SpA,
  *                Luca Ceresoli <luca.ceresoli@comelit.it>
  */
-
 #include <common.h>
 #include <command.h>
 #include <efi_loader.h>
@@ -98,6 +97,12 @@
 /* The number of hashes we printed */
 static short	tftp_tsize_num_hash;
 #endif
+/* The window size negotiated */
+static ushort	tftp_windowsize;
+/* Next block to send ack to */
+static ushort	tftp_next_ack;
+/* Last nack block we send */
+static ushort	tftp_last_nack;
 #ifdef CONFIG_CMD_TFTPPUT
 /* 1 if writing, else 0 */
 static int	tftp_put_active;
@@ -138,8 +143,19 @@
  * (but those using CONFIG_IP_DEFRAG may want to set a larger block in cfg file)
  */
 
+/* When windowsize is defined to 1,
+ * tftp behaves the same way as it was
+ * never declared
+ */
+#ifdef CONFIG_TFTP_WINDOWSIZE
+#define TFTP_WINDOWSIZE CONFIG_TFTP_WINDOWSIZE
+#else
+#define TFTP_WINDOWSIZE 1
+#endif
+
 static unsigned short tftp_block_size = TFTP_BLOCK_SIZE;
 static unsigned short tftp_block_size_option = CONFIG_TFTP_BLOCKSIZE;
+static unsigned short tftp_window_size_option = TFTP_WINDOWSIZE;
 
 static inline int store_block(int block, uchar *src, unsigned int len)
 {
@@ -356,6 +372,14 @@
 		/* try for more effic. blk size */
 		pkt += sprintf((char *)pkt, "blksize%c%d%c",
 				0, tftp_block_size_option, 0);
+
+		/* try for more effic. window size.
+		 * Implemented only for tftp get.
+		 * Don't bother sending if it's 1
+		 */
+		if (tftp_state == STATE_SEND_RRQ && tftp_window_size_option > 1)
+			pkt += sprintf((char *)pkt, "windowsize%c%d%c",
+					0, tftp_window_size_option, 0);
 		len = pkt - xp;
 		break;
 
@@ -550,7 +574,17 @@
 				      (char *)pkt + i + 6, tftp_tsize);
 			}
 #endif
+			if (strcasecmp((char *)pkt + i,  "windowsize") == 0) {
+				tftp_windowsize =
+					simple_strtoul((char *)pkt + i + 11,
+						       NULL, 10);
+				debug("windowsize = %s, %d\n",
+				      (char *)pkt + i + 11, tftp_windowsize);
+			}
 		}
+
+		tftp_next_ack = tftp_windowsize;
+
 #ifdef CONFIG_CMD_TFTPPUT
 		if (tftp_put_active && tftp_state == STATE_OACK) {
 			/* Get ready to send the first block */
@@ -564,7 +598,28 @@
 		if (len < 2)
 			return;
 		len -= 2;
-		tftp_cur_block = ntohs(*(__be16 *)pkt);
+
+		if (ntohs(*(__be16 *)pkt) != (ushort)(tftp_cur_block + 1)) {
+			debug("Received unexpected block: %d, expected: %d\n",
+			      ntohs(*(__be16 *)pkt),
+			      (ushort)(tftp_cur_block + 1));
+			/*
+			 * If one packet is dropped most likely
+			 * all other buffers in the window
+			 * that will arrive will cause a sending NACK.
+			 * This just overwellms the server, let's just send one.
+			 */
+			if (tftp_last_nack != tftp_cur_block) {
+				tftp_send();
+				tftp_last_nack = tftp_cur_block;
+				tftp_next_ack = (ushort)(tftp_cur_block +
+							 tftp_windowsize);
+			}
+			break;
+		}
+
+		tftp_cur_block++;
+		tftp_cur_block %= TFTP_SEQUENCE_SIZE;
 
 		if (tftp_state == STATE_SEND_RRQ)
 			debug("Server did not acknowledge any options!\n");
@@ -606,10 +661,15 @@
 		 *	Acknowledge the block just received, which will prompt
 		 *	the remote for the next one.
 		 */
-		tftp_send();
+		if (tftp_cur_block == tftp_next_ack) {
+			tftp_send();
+			tftp_next_ack += tftp_windowsize;
+		}
 
-		if (len < tftp_block_size)
+		if (len < tftp_block_size) {
+			tftp_send();
 			tftp_complete();
+		}
 		break;
 
 	case TFTP_ERROR:
@@ -683,6 +743,10 @@
 	if (ep != NULL)
 		tftp_block_size_option = simple_strtol(ep, NULL, 10);
 
+	ep = env_get("tftpwindowsize");
+	if (ep != NULL)
+		tftp_window_size_option = simple_strtol(ep, NULL, 10);
+
 	ep = env_get("tftptimeout");
 	if (ep != NULL)
 		timeout_ms = simple_strtol(ep, NULL, 10);
@@ -704,8 +768,8 @@
 	}
 #endif
 
-	debug("TFTP blocksize = %i, timeout = %ld ms\n",
-	      tftp_block_size_option, timeout_ms);
+	debug("TFTP blocksize = %i, TFTP windowsize = %d timeout = %ld ms\n",
+	      tftp_block_size_option, tftp_window_size_option, timeout_ms);
 
 	tftp_remote_ip = net_server_ip;
 	if (!net_parse_bootfile(&tftp_remote_ip, tftp_filename, MAX_LEN)) {
@@ -801,7 +865,8 @@
 		tftp_our_port = simple_strtol(ep, NULL, 10);
 #endif
 	tftp_cur_block = 0;
-
+	tftp_windowsize = 1;
+	tftp_last_nack = 0;
 	/* zero out server ether in case the server ip has changed */
 	memset(net_server_ethaddr, 0, 6);
 	/* Revert tftp_block_size to dflt */
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 734001c..56e9d54 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -311,7 +311,7 @@
 $(obj)/%.dtb.S: $(obj)/%.dtb
 	$(call cmd,dt_S_dtb)
 
-ifeq ($(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY),y)
+ifeq ($(CONFIG_OF_LIBFDT_OVERLAY),y)
 DTC_FLAGS += -@
 endif
 
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 958668d..6d59cf8 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -266,7 +266,7 @@
 		    (q - p == 9 && !memcmp(p, "IS_MODULE(", 10)) ||
 		    (q - p == 3 && !memcmp(p, "VAL(", 4))) {
 			p = q + 1;
-			q  = p;
+			q = p;
 			while (isalnum(*q) || *q == '_')
 				q++;
 			r = q;
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 6645d73..82f8f12 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -3715,9 +3715,6 @@
 CONFIG_SYS_SPL_MALLOC_SIZE
 CONFIG_SYS_SPL_MALLOC_START
 CONFIG_SYS_SPR
-CONFIG_SYS_SRAM_BASE
-CONFIG_SYS_SRAM_SIZE
-CONFIG_SYS_SRAM_START
 CONFIG_SYS_SRIO
 CONFIG_SYS_SRIO1_MEM_BASE
 CONFIG_SYS_SRIO1_MEM_BUS
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 326b2ac..1db5da4 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -17,6 +17,7 @@
 
 # Regexes for text we expect U-Boot to send to the console.
 pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
+pattern_u_boot_spl2_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
 pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))')
 pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ')
 pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
@@ -28,6 +29,7 @@
 
 bad_pattern_defs = (
     ('spl_signon', pattern_u_boot_spl_signon),
+    ('spl2_signon', pattern_u_boot_spl2_signon),
     ('main_signon', pattern_u_boot_main_signon),
     ('stop_autoboot_prompt', pattern_stop_autoboot_prompt),
     ('unknown_command', pattern_unknown_command),
@@ -353,12 +355,20 @@
                                                  'n') == 'y'
             env_spl_skipped = self.config.env.get('env__spl_skipped',
                                                   False)
+            env_spl2_skipped = self.config.env.get('env__spl2_skipped',
+                                                  True)
             if config_spl and config_spl_serial_support and not env_spl_skipped:
                 m = self.p.expect([pattern_u_boot_spl_signon] +
                                   self.bad_patterns)
                 if m != 0:
                     raise Exception('Bad pattern found on SPL console: ' +
                                     self.bad_pattern_ids[m - 1])
+            if not env_spl2_skipped:
+                m = self.p.expect([pattern_u_boot_spl2_signon] +
+                                  self.bad_patterns)
+                if m != 0:
+                    raise Exception('Bad pattern found on SPL2 console: ' +
+                                    self.bad_pattern_ids[m - 1])
             m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns)
             if m != 0:
                 raise Exception('Bad pattern found on console: ' +
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 3ab1ae6..66cb9d2 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -952,8 +952,8 @@
 			return -1;
 		}
 		if (rc != readlen) {
-			fprintf(stderr, "Read error on %s: "
-				"Attempted to read %d bytes but got %d\n",
+			fprintf(stderr,
+				"Read error on %s: Attempted to read %zd bytes but got %d\n",
 				DEVNAME(dev), readlen, rc);
 			return -1;
 		}
@@ -995,7 +995,7 @@
 				   of the data */
 	loff_t blockstart;	/* running start of the current block -
 				   MEMGETBADBLOCK needs 64 bits */
-	int was_locked;		/* flash lock flag */
+	int was_locked = 0;	/* flash lock flag */
 	int rc;
 
 	/*
diff --git a/tools/fit_image.c b/tools/fit_image.c
index df310b5..f7d2f56 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -388,7 +388,7 @@
 	size = fit_calc_size(params);
 	if (size < 0)
 		return -1;
-	buf = malloc(size);
+	buf = calloc(1, size);
 	if (!buf) {
 		fprintf(stderr, "%s: Out of memory (%d bytes)\n",
 			params->cmdname, size);
@@ -467,7 +467,7 @@
 	 * Allocate space to hold the image data we will extract,
 	 * extral space allocate for image alignment to prevent overflow.
 	 */
-	buf = malloc(fit_size + (align_size * image_number));
+	buf = calloc(1, fit_size + (align_size * image_number));
 	if (!buf) {
 		ret = -ENOMEM;
 		goto err_munmap;
@@ -572,7 +572,7 @@
 
 	/* Allocate space to hold the new FIT */
 	size = sbuf.st_size + 16384;
-	fdt = malloc(size);
+	fdt = calloc(1, size);
 	if (!fdt) {
 		fprintf(stderr, "%s: Failed to allocate memory (%d bytes)\n",
 			__func__, size);
@@ -673,7 +673,7 @@
 		goto out;
 	}
 
-	buf = malloc(512);
+	buf = calloc(1, 512);
 	if (!buf) {
 		printf("Can't allocate buffer to copy file\n");
 		goto out;