Skip to contentSkip to conversation

mmc: sunxi: support DM MMC in SPL

PATCH In review James Hilliard 2 participants 2 messages Jul 17 – Jul 20

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: sunxi: support DM MMC in SPL

sunxi SPL normally uses the legacy MMC interface while U-Boot proper uses the driver-model path. When SPL_DM_MMC is enabled, the existing DM probe depends on the devicetree, clock and pinctrl providers being available in SPL.

Select the required SPL clock, OF control, pinctrl and pin configuration support from MMC_SUNXI. Retain the main CCU and PIO nodes when their SPL frameworks are enabled, and retain the MMC0 controller and pin configuration when SPL_DM_MMC is enabled.

This reuses the existing DM path unchanged and leaves the legacy SPL path untouched when SPL_DM_MMC is disabled.

---
Changes v1 -> v2:
- select the required SPL dependencies in Kconfig (suggested by Tom)
- retain the common CCU, PIO, MMC0 and pin configuration nodes in the SPL devicetree
- drop the new preprocessor fallback paths (suggested by Andre)
- reuse the existing DM MMC probe unchanged
- drop the no-devicetree platform-data path and controller reinit hook
- reduce the driver change to four Kconfig selections
- validate an H616 SD boot through SPL FIT verification and U-Boot proper

---
 arch/arm/dts/sunxi-u-boot.dtsi | 22 ++++++++++++++++++++++
 drivers/mmc/Kconfig            |  4 ++++
 2 files changed, 26 insertions(+)
arch/arm/dts/sunxi-u-boot.dtsi +22 -0
index e1a9a7f5d4c..fdd8c78c8bf 100644
@@ -19,6 +19,28 @@
 	};
 };
 
+#ifdef CONFIG_SPL_CLK
+&ccu {
+	bootph-pre-ram;
+};
+#endif
+
+#ifdef CONFIG_SPL_PINCTRL
+&pio {
+	bootph-pre-ram;
+};
+#endif
+
+#ifdef CONFIG_SPL_DM_MMC
+&mmc0_pins {
+	bootph-pre-ram;
+};
+
+&mmc0 {
+	bootph-pre-ram;
+};
+#endif
+
 /* Let U-Boot be the firmware layer that controls the watchdog. */
 #ifdef CONFIG_MACH_SUN8I_R528
 &wdt {
drivers/mmc/Kconfig +4 -0
index 6c513328de2..40b6e6882aa 100644
@@ -806,6 +806,10 @@ config MMC_SUNXI
 	bool "Allwinner sunxi SD/MMC Host Controller support"
 	depends on ARCH_SUNXI
 	default y
+	select SPL_CLK if SPL_DM_MMC
+	select SPL_OF_CONTROL if SPL_DM_MMC
+	select SPL_PINCONF if SPL_DM_MMC
+	select SPL_PINCTRL if SPL_DM_MMC
 	help
 	  This selects support for the SD/MMC Host Controller on
 	  Allwinner sunxi SoCs.
Signature · 1 line
2.53.0
#1 lore raw
Quoted 67 lines · James Hilliard

sunxi SPL normally uses the legacy MMC interface while U-Boot proper uses the driver-model path. When SPL_DM_MMC is enabled, the existing DM probe depends on the devicetree, clock and pinctrl providers being available in SPL.

Select the required SPL clock, OF control, pinctrl and pin configuration support from MMC_SUNXI. Retain the main CCU and PIO nodes when their SPL frameworks are enabled, and retain the MMC0 controller and pin configuration when SPL_DM_MMC is enabled.

This reuses the existing DM path unchanged and leaves the legacy SPL path untouched when SPL_DM_MMC is disabled.

---
Changes v1 -> v2:
- select the required SPL dependencies in Kconfig (suggested by Tom)
- retain the common CCU, PIO, MMC0 and pin configuration nodes in the SPL devicetree
- drop the new preprocessor fallback paths (suggested by Andre)
- reuse the existing DM MMC probe unchanged
- drop the no-devicetree platform-data path and controller reinit hook
- reduce the driver change to four Kconfig selections
- validate an H616 SD boot through SPL FIT verification and U-Boot proper

---
 arch/arm/dts/sunxi-u-boot.dtsi | 22 ++++++++++++++++++++++
 drivers/mmc/Kconfig            |  4 ++++
 2 files changed, 26 insertions(+)
arch/arm/dts/sunxi-u-boot.dtsi +22 -0
index e1a9a7f5d4c..fdd8c78c8bf 100644
@@ -19,6 +19,28 @@
 	};
 };
 
+#ifdef CONFIG_SPL_CLK
+&ccu {
+	bootph-pre-ram;
+};
+#endif
+
+#ifdef CONFIG_SPL_PINCTRL
+&pio {
+	bootph-pre-ram;
+};
+#endif
+
+#ifdef CONFIG_SPL_DM_MMC
+&mmc0_pins {
+	bootph-pre-ram;
+};
+
+&mmc0 {
+	bootph-pre-ram;
+};
+#endif
+
 /* Let U-Boot be the firmware layer that controls the watchdog. */
 #ifdef CONFIG_MACH_SUN8I_R528
 &wdt {
drivers/mmc/Kconfig +0 -0
index 6c513328de2..40b6e6882aa 100644

drivers/mmc/Kconfig config MMC_SUNXI · line 815

Quoted 10 lines
drivers/mmc/Kconfig +4 -0
@@ -806,6 +806,10 @@ config MMC_SUNXI
 	bool "Allwinner sunxi SD/MMC Host Controller support"
 	depends on ARCH_SUNXI
 	default y
+	select SPL_CLK if SPL_DM_MMC
+	select SPL_OF_CONTROL if SPL_DM_MMC
+	select SPL_PINCONF if SPL_DM_MMC
+	select SPL_PINCTRL if SPL_DM_MMC
 	help
 	  This selects support for the SD/MMC Host Controller on
 	  Allwinner sunxi SoCs.

This seems like a much more reasonable path, thank you.

Signature · 1 line
Tom