Merge branch '2022-01-06-assorted-important-fixes'

- Revert a clk change, to enable some platforms to work again
- Updates to the udoo NEO family of boards to work correctly
- Fix SiFive Unleashes/Unmatched boards booting
- Update rockchip maintainer entry
diff --git a/arch/arm/dts/imx6sx-udoo-neo-u-boot.dtsi b/arch/arm/dts/imx6sx-udoo-neo-u-boot.dtsi
deleted file mode 100644
index daf2489..0000000
--- a/arch/arm/dts/imx6sx-udoo-neo-u-boot.dtsi
+++ /dev/null
@@ -1,7 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-
-/ {
-	aliases {
-		mmc0 = &usdhc2;
-	};
-};
diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c
index 3c3e0e1..f8aad86 100644
--- a/board/sifive/unleashed/unleashed.c
+++ b/board/sifive/unleashed/unleashed.c
@@ -117,7 +117,7 @@
 void *board_fdt_blob_setup(int *err)
 {
 	*err = 0;
-	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
+	if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD)) {
 		if (gd->arch.firmware_fdt_addr)
 			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
 	}
diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
index 4895909..6295dee 100644
--- a/board/sifive/unmatched/unmatched.c
+++ b/board/sifive/unmatched/unmatched.c
@@ -14,7 +14,7 @@
 void *board_fdt_blob_setup(int *err)
 {
 	*err = 0;
-	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
+	if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD)) {
 		if (gd->arch.firmware_fdt_addr)
 			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
 	}
diff --git a/board/theobroma-systems/lion_rk3368/MAINTAINERS b/board/theobroma-systems/lion_rk3368/MAINTAINERS
index 857f784d..a5b4cb3 100644
--- a/board/theobroma-systems/lion_rk3368/MAINTAINERS
+++ b/board/theobroma-systems/lion_rk3368/MAINTAINERS
@@ -1,5 +1,5 @@
 LION-RK3368 (RK3368-uQ7 system-on-module)
-M:	Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+M:	Quentin Schulz <quentin.schulz@theobroma-systems.com>
 M:	Klaus Goger <klaus.goger@theobroma-systems.com>
 S:	Maintained
 F:	board/theobroma-systems/lion_rk3368
diff --git a/board/theobroma-systems/puma_rk3399/MAINTAINERS b/board/theobroma-systems/puma_rk3399/MAINTAINERS
index ccec09c..1ec2dd7 100644
--- a/board/theobroma-systems/puma_rk3399/MAINTAINERS
+++ b/board/theobroma-systems/puma_rk3399/MAINTAINERS
@@ -1,5 +1,5 @@
 PUMA-RK3399
-M:	Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+M:	Quentin Schulz <quentin.schulz@theobroma-systems.com>
 M:	Klaus Goger <klaus.goger@theobroma-systems.com>
 S:	Maintained
 F:	board/theobroma-systems/puma_rk3399
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index ce005d3..5e40583 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -19,6 +19,8 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <dm.h>
 #include <env.h>
+#include <mmc.h>
+#include <fsl_esdhc_imx.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/io.h>
 #include <asm/mach-imx/mxc_i2c.h>
@@ -73,6 +75,8 @@
 #define BOARD_DETECT_PAD_CFG (MUX_PAD_CTRL(BOARD_DETECT_PAD_CTRL) |	\
 	MUX_MODE_SION)
 
+#define OCRAM_START	0x8f8000
+
 int dram_init(void)
 {
 	gd->ram_size = imx_ddr_size();
@@ -214,19 +218,25 @@
 	MX6_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
+static iomux_v3_cfg_t const usdhc2_pads[] = {
+	MX6_PAD_SD2_CLK__USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD2_CMD__USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD2_DATA0__USDHC2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD2_DATA1__USDHC2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD2_DATA2__USDHC2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD2_DATA3__USDHC2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	/* CD pin */
+	MX6_PAD_SD1_DATA0__GPIO6_IO_2 | MUX_PAD_CTRL(NO_PAD_CTRL),
+	/* Power */
+	MX6_PAD_SD1_CMD__GPIO6_IO_1 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
 static iomux_v3_cfg_t const phy_control_pads[] = {
 	/* 25MHz Ethernet PHY Clock */
 	MX6_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M |
 	MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
 };
 
-static iomux_v3_cfg_t const board_recognition_pads[] = {
-	/*Connected to R184*/
-	MX6_PAD_NAND_READY_B__GPIO4_IO_13 | BOARD_DETECT_PAD_CFG,
-	/*Connected to R185*/
-	MX6_PAD_NAND_ALE__GPIO4_IO_0 | BOARD_DETECT_PAD_CFG,
-};
-
 static iomux_v3_cfg_t const wdog_b_pad = {
 	MX6_PAD_GPIO1_IO13__GPIO1_IO_13 | MUX_PAD_CTRL(WDOG_PAD_CTRL),
 };
@@ -249,6 +259,7 @@
 					 ARRAY_SIZE(phy_control_pads));
 
 	/* Reset PHY */
+	gpio_request(IMX_GPIO_NR(2, 1), "enet_rst");
 	gpio_direction_output(IMX_GPIO_NR(2, 1) , 0);
 	udelay(10000);
 	gpio_set_value(IMX_GPIO_NR(2, 1), 1);
@@ -280,52 +291,53 @@
 					 ARRAY_SIZE(peri_3v3_pads));
 
 	/* Active high for ncp692 */
+	gpio_request(IMX_GPIO_NR(4, 16), "ncp692");
 	gpio_direction_output(IMX_GPIO_NR(4, 16) , 1);
 
 #ifdef CONFIG_SYS_I2C_MXC
 	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
 #endif
 
+	setup_fec();
+
 	return 0;
 }
 
-static int get_board_value(void)
+int board_early_init_f(void)
 {
-	int r184, r185;
-
-	imx_iomux_v3_setup_multiple_pads(board_recognition_pads,
-					 ARRAY_SIZE(board_recognition_pads));
+	setup_iomux_uart();
 
-	gpio_direction_input(IMX_GPIO_NR(4, 13));
-	gpio_direction_input(IMX_GPIO_NR(4, 0));
+	return 0;
+}
 
-	r184 = gpio_get_value(IMX_GPIO_NR(4, 13));
-	r185 = gpio_get_value(IMX_GPIO_NR(4, 0));
+static struct fsl_esdhc_cfg usdhc_cfg[1] = {
+	{USDHC2_BASE_ADDR},
+};
 
-	/*
-	 * Machine selection -
-	 * Machine          r184,    r185
-	 * ---------------------------------
-	 * Basic              0        0
-	 * Basic Ks           0        1
-	 * Full               1        0
-	 * Extended           1        1
-	 */
+#define USDHC2_PWR_GPIO IMX_GPIO_NR(6, 1)
+#define USDHC2_CD_GPIO	IMX_GPIO_NR(6, 2)
 
-	return (r184 << 1) + r185;
+int board_mmc_getcd(struct mmc *mmc)
+{
+	return !gpio_get_value(USDHC2_CD_GPIO);
 }
 
-int board_early_init_f(void)
+int board_mmc_init(struct bd_info *bis)
 {
-	setup_iomux_uart();
-	setup_fec();
+	SETUP_IOMUX_PADS(usdhc2_pads);
+	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+	usdhc_cfg[0].max_bus_width = 4;
+	gpio_request(IMX_GPIO_NR(6, 1), "usdhc2_pwr");
+	gpio_request(IMX_GPIO_NR(6, 2), "usdhc2_cd");
+	gpio_direction_input(USDHC2_CD_GPIO);
+	gpio_direction_output(USDHC2_PWR_GPIO, 1);
 
-	return 0;
+	return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
 }
 
-static char *board_string(void)
+static char *board_string(int type)
 {
-	switch (get_board_value()) {
+	switch (type) {
 	case UDOO_NEO_TYPE_BASIC:
 		return "BASIC";
 	case UDOO_NEO_TYPE_BASIC_KS:
@@ -338,16 +350,21 @@
 	return "UNDEFINED";
 }
 
-int checkboard(void)
+/* Override the default implementation, DT model is not accurate */
+int show_board_info(void)
 {
-	printf("Board: UDOO Neo %s\n", board_string());
+	int *board_type = (int *)OCRAM_START;
+
+	printf("Board: UDOO Neo %s\n", board_string(*board_type));
 	return 0;
 }
 
 int board_late_init(void)
 {
+	int *board_type = (int *)OCRAM_START;
+
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", board_string());
+	env_set("board_name", board_string(*board_type));
 #endif
 
 	return 0;
@@ -358,6 +375,41 @@
 #include <linux/libfdt.h>
 #include <asm/arch/mx6-ddr.h>
 
+static const iomux_v3_cfg_t board_recognition_pads[] = {
+	/*Connected to R184*/
+	MX6_PAD_NAND_READY_B__GPIO4_IO_13 | BOARD_DETECT_PAD_CFG,
+	/*Connected to R185*/
+	MX6_PAD_NAND_ALE__GPIO4_IO_0 | BOARD_DETECT_PAD_CFG,
+};
+
+static int get_board_value(void)
+{
+	int r184, r185;
+
+	imx_iomux_v3_setup_multiple_pads(board_recognition_pads,
+					 ARRAY_SIZE(board_recognition_pads));
+
+	gpio_request(IMX_GPIO_NR(4, 13), "r184");
+	gpio_request(IMX_GPIO_NR(4, 0), "r185");
+	gpio_direction_input(IMX_GPIO_NR(4, 13));
+	gpio_direction_input(IMX_GPIO_NR(4, 0));
+
+	r184 = gpio_get_value(IMX_GPIO_NR(4, 13));
+	r185 = gpio_get_value(IMX_GPIO_NR(4, 0));
+
+	/*
+	 * Machine selection -
+	 * Machine          r184,    r185
+	 * ---------------------------------
+	 * Basic              0        0
+	 * Basic Ks           0        1
+	 * Full               1        0
+	 * Extended           1        1
+	 */
+
+	return (r184 << 1) + r185;
+}
+
 static const struct mx6sx_iomux_ddr_regs mx6_ddr_ioregs = {
 	.dram_dqm0 = 0x00000028,
 	.dram_dqm1 = 0x00000028,
@@ -453,7 +505,7 @@
 
 static void spl_dram_init(void)
 {
-	int board = get_board_value();
+	int *board_type = (int *)OCRAM_START;
 
 	struct mx6_ddr_sysinfo sysinfo = {
 		.dsize = 1, /* width of data bus: 1 = 32 bits */
@@ -470,8 +522,11 @@
 		.rst_to_cke = 0x23,	/* 33 cycles, 500us (JEDEC default) */
 	};
 
+	*board_type = get_board_value();
+
 	mx6sx_dram_iocfg(32, &mx6_ddr_ioregs, &mx6_grp_ioregs);
-	if (board == UDOO_NEO_TYPE_BASIC || board == UDOO_NEO_TYPE_BASIC_KS)
+	if (*board_type == UDOO_NEO_TYPE_BASIC ||
+	    *board_type == UDOO_NEO_TYPE_BASIC_KS)
 		mx6_dram_cfg(&sysinfo, &neo_basic_mmcd_calib,
 			     &neo_basic_mem_ddr);
 	else
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index b2a3e9b..ca08de1 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -27,6 +27,7 @@
 CONFIG_SPL_WATCHDOG=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_PINMUX is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
@@ -35,6 +36,7 @@
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SYS_I2C_LEGACY=y
@@ -45,12 +47,18 @@
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
 CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_FEC_MXC=y
-CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_POWER_LEGACY=y
 CONFIG_POWER_I2C=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_ANATOP=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_STORAGE=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index f2d2642..094b1ab 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -846,17 +846,13 @@
 
 int clk_uclass_post_probe(struct udevice *dev)
 {
-	int ret;
-
 	/*
 	 * when a clock provider is probed. Call clk_set_defaults()
 	 * also after the device is probed. This takes care of cases
 	 * where the DT is used to setup default parents and rates
 	 * using assigned-clocks
 	 */
-	ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-	if (ret)
-		return log_ret(ret);
+	clk_set_defaults(dev, CLK_DEFAULTS_POST);
 
 	return 0;
 }
diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index b06abc9..3a7cb05 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -29,7 +29,7 @@
 	"fdt_addr=0x83000000\0" \
 	"fdt_addr_r=0x83000000\0" \
 	"ip_dyn=yes\0" \
-	"mmcdev=0\0" \
+	"mmcdev=1\0" \
 	"mmcrootfstype=ext4\0" \
 	"findfdt="\
 		"if test $board_name = BASIC; then " \
@@ -49,7 +49,8 @@
 	BOOTENV
 
 #define BOOT_TARGET_DEVICES(func) \
-	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1) \
+	func(USB, usb, 0) \
 	func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>