Skip to contentSkip to conversation

arm: mvebu: clearfog: defconfig and eMMC updates

PATCH In review Martin Rowe 3 participants 14 messages Mar 25, 2023 – Mar 30, 2023

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

v2 cover arm: mvebu: clearfog: defconfig and eMMC updates

Minor defconfig and eMMC updates for SolidRun's A388 Clearfog devices.

Changes since v1:
- Omitted defconfig canonicalization changes
- Removed unneeded defconfig changes
- Set non-removable in u-boot dtsi instead of MMC_BROKEN_CD
- Reworked FDT patch logic

Changes since initial discussion:
https://lists.denx.de/pipermail/u-boot/2023-February/510492.html
- CONFIG_SPL_SPI selected for SPI defconfig
- Runtime patching of kernel FDT added for eMMC detection

Note that this patch depends on this patch series (has been merged to u-boot-marvell/next):
https://lists.denx.de/pipermail/u-boot/2023-March/511038.html

Martin Rowe (3):
arm: mvebu: clearfog: Fix MMC detection
arm: mvebu: clearfog: Add defconfig for SPI booting
arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

 arch/arm/dts/armada-388-clearfog-u-boot.dtsi  |  1 +
 arch/arm/mach-mvebu/Kconfig                   |  1 +
 board/solidrun/clearfog/clearfog.c            | 32 +++++++++++++++++++
 ...arfog_defconfig => clearfog_spi_defconfig} |  2 +-
 4 files changed, 35 insertions(+), 1 deletion(-)
 copy configs/{clearfog_defconfig => clearfog_spi_defconfig} (98%)
Signature · 1 line
2.40.0
#1 lore raw

PATCH v2 1/3 arm: mvebu: clearfog: Fix MMC detection

A388 Clearfog MMC is either SD Card or eMMC with different behaviour for both. Setting the device to non-removable in the u-boot.dtsi allows both to correctly detect the device.

---
 arch/arm/dts/armada-388-clearfog-u-boot.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/armada-388-clearfog-u-boot.dtsi +1 -0
index fb27a3b96f..906d8f2e67 100644
@@ -10,6 +10,7 @@
 
 &sdhci {
 	bootph-pre-ram;
+	non-removable; /* assume that the card is always present, required for eMMC variant */
 };
 
 &gpio0 {
Signature · 1 line
2.40.0
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] arm: mvebu: clearfog: Fix MMC detection

Quoted 5 lines · Martin Rowe

A388 Clearfog MMC is either SD Card or eMMC with different behaviour for both. Setting the device to non-removable in the u-boot.dtsi allows both to correctly detect the device.

Thanks,
Stefan

Quoted 9 lines
---
  arch/arm/dts/armada-388-clearfog-u-boot.dtsi | 1 +
  1 file changed, 1 insertion(+)
arch/arm/dts/armada-388-clearfog-u-boot.dtsi +0 -0
index fb27a3b96f..906d8f2e67 100644

arch/arm/dts/armada-388-clearfog-u-boot.dtsi line 16

Quoted 7 lines
arch/arm/dts/armada-388-clearfog-u-boot.dtsi +1 -0
@@ -10,6 +10,7 @@
 
  &sdhci {
  	bootph-pre-ram;
+	non-removable; /* assume that the card is always present, required for eMMC variant */
  };
 
  &gpio0 {

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw

PATCH v2 2/3 arm: mvebu: clearfog: Add defconfig for SPI booting

In reply to Martin Rowe

This new clearfog_spi_defconfig file is a copy of existing clearfog_defconfig file modified to instruct build system to generate final kwbimage for SPI booting and to store the environment in SPI.

---
 configs/{clearfog_defconfig => clearfog_spi_defconfig} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 copy configs/{clearfog_defconfig => clearfog_spi_defconfig} (98%)
configs/clearfog_spi_defconfig renamed from configs/clearfog_defconfig +1 -1
similarity index 98%
copy from configs/clearfog_defconfig
copy to configs/clearfog_spi_defconfig
index 8cd35f9f1a..9dcf16fe92 100644
@@ -9,7 +9,7 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xff0000
 CONFIG_TARGET_CLEARFOG=y
-CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y
+CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog"
 CONFIG_SPL_TEXT_BASE=0x40000030
 CONFIG_SPL_SERIAL=y
Signature · 1 line
2.40.0
Reviewed-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] arm: mvebu: clearfog: Add defconfig for SPI booting

Quoted 5 lines · Martin Rowe

This new clearfog_spi_defconfig file is a copy of existing clearfog_defconfig file modified to instruct build system to generate final kwbimage for SPI booting and to store the environment in SPI.

Thanks,
Stefan

Quoted 13 lines
---
  configs/{clearfog_defconfig => clearfog_spi_defconfig} | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

copy configs/{clearfog_defconfig => clearfog_spi_defconfig} (98%)

configs/clearfog_spi_defconfig renamed from configs/clearfog_defconfig +0 -0
similarity index 98%
copy from configs/clearfog_defconfig
copy to configs/clearfog_spi_defconfig
index 8cd35f9f1a..9dcf16fe92 100644

configs/clearfog_spi_defconfig CONFIG_NR_DRAM_BANKS=2 · line 15

Quoted 8 lines
configs/clearfog_spi_defconfig renamed from configs/clearfog_defconfig +1 -1
@@ -9,7 +9,7 @@ CONFIG_NR_DRAM_BANKS=2
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xff0000
  CONFIG_TARGET_CLEARFOG=y
-CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y
+CONFIG_ENV_SECT_SIZE=0x10000
  CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog"
  CONFIG_SPL_TEXT_BASE=0x40000030
  CONFIG_SPL_SERIAL=y

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#5 lore raw

PATCH v2 3/3 arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

In reply to Martin Rowe

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

---
 arch/arm/mach-mvebu/Kconfig        |  1 +
 board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
index fb3cff43f7..773635d691 100644
@@ -107,6 +107,7 @@ config TARGET_CLEARFOG
 	bool "Support ClearFog"
 	select 88F6820
 	select BOARD_LATE_INIT
+	select OF_BOARD_SETUP
 
 config TARGET_HELIOS4
 	bool "Support Helios4"
board/solidrun/clearfog/clearfog.c +32 -0
index 03adb591d8..0087fea7db 100644
@@ -10,6 +10,7 @@
 #include <miiphy.h>
 #include <net.h>
 #include <netdev.h>
+#include <mmc.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
@@ -261,3 +262,34 @@ int board_late_init(void)
 
 	return 0;
 }
+
+static bool has_emmc(void)
+{
+	struct mmc *mmc;
+	mmc = find_mmc_device(0);
+	if (!mmc)
+		return 0;
+	return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
+}
+
+/*
+ * The Clearfog devices have only one SDHC device. This is either eMMC
+ * if it is populated on the SOM or SDHC if not. The Linux device tree
+ * assumes the SDHC case. Detect if the device is an eMMC and fixup the
+ * device-tree, so that it will be detected by Linux.
+ */
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	__maybe_unused int node;
+
+	if (has_emmc()) {
+		node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci");
+		if (node < 0)
+			return 0; /* Unexpected eMMC device; patching not supported */
+
+		puts("Patching FDT so that eMMC is detected by OS\n");
+		return fdt_setprop_empty(blob, node, "non-removable");
+	}
+
+	return 0;
+}
Signature · 1 line
2.40.0
Reviewed-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

Hi Martin,

Quoted 40 lines · Martin Rowe

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

---
  arch/arm/mach-mvebu/Kconfig        |  1 +
  board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++
  2 files changed, 33 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
index fb3cff43f7..773635d691 100644
@@ -107,6 +107,7 @@ config TARGET_CLEARFOG
  	bool "Support ClearFog"
  	select 88F6820
  	select BOARD_LATE_INIT
+	select OF_BOARD_SETUP
 
  config TARGET_HELIOS4
  	bool "Support Helios4"
board/solidrun/clearfog/clearfog.c +1 -0
index 03adb591d8..0087fea7db 100644
@@ -10,6 +10,7 @@
  #include <miiphy.h>
  #include <net.h>
  #include <netdev.h>
+#include <mmc.h>
  #include <asm/global_data.h>
  #include <asm/io.h>
  #include <asm/arch/cpu.h>

board/solidrun/clearfog/clearfog.c int board_late_init(void) · line 268

Quoted 7 lines
board/solidrun/clearfog/clearfog.c +4 -0
@@ -261,3 +262,34 @@ int board_late_init(void)
 
  	return 0;
  }
+
+static bool has_emmc(void)
+{
+	struct mmc *mmc;

Nitpicking: Please add an empty line after the variable declaration section.

Quoted 5 lines
board/solidrun/clearfog/clearfog.c +5 -0
+	mmc = find_mmc_device(0);
+	if (!mmc)
+		return 0;
+	return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
+}

board/solidrun/clearfog/clearfog.c int board_late_init(void) · line 283

Quoted 10 lines
board/solidrun/clearfog/clearfog.c +10 -0
+
+/*
+ * The Clearfog devices have only one SDHC device. This is either eMMC
+ * if it is populated on the SOM or SDHC if not. The Linux device tree
+ * assumes the SDHC case. Detect if the device is an eMMC and fixup the
+ * device-tree, so that it will be detected by Linux.
+ */
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	__maybe_unused int node;

Is this "__maybe_unused" really needed here?

Otherwise:

Thanks,
Stefan

Quoted 12 lines
board/solidrun/clearfog/clearfog.c +12 -0
+
+	if (has_emmc()) {
+		node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci");
+		if (node < 0)
+			return 0; /* Unexpected eMMC device; patching not supported */
+
+		puts("Patching FDT so that eMMC is detected by OS\n");
+		return fdt_setprop_empty(blob, node, "non-removable");
+	}
+
+	return 0;
+}
#7 lore raw

PATCH v3 3/3 arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

---
Fixed spacing and removed __maybe_unused

 arch/arm/mach-mvebu/Kconfig        |  1 +
 board/solidrun/clearfog/clearfog.c | 33 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
index 1f0dbef1c6..b1f2e97ae7 100644
@@ -107,6 +107,7 @@ config TARGET_CLEARFOG
 	bool "Support ClearFog"
 	select 88F6820
 	select BOARD_LATE_INIT
+	select OF_BOARD_SETUP
 
 config TARGET_HELIOS4
 	bool "Support Helios4"
board/solidrun/clearfog/clearfog.c +33 -0
index 03adb591d8..6edb422155 100644
@@ -10,6 +10,7 @@
 #include <miiphy.h>
 #include <net.h>
 #include <netdev.h>
+#include <mmc.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
@@ -261,3 +262,35 @@ int board_late_init(void)
 
 	return 0;
 }
+
+static bool has_emmc(void)
+{
+	struct mmc *mmc;
+
+	mmc = find_mmc_device(0);
+	if (!mmc)
+		return 0;
+	return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
+}
+
+/*
+ * The Clearfog devices have only one SDHC device. This is either eMMC
+ * if it is populated on the SOM or SDHC if not. The Linux device tree
+ * assumes the SDHC case. Detect if the device is an eMMC and fixup the
+ * device-tree, so that it will be detected by Linux.
+ */
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	int node;
+
+	if (has_emmc()) {
+		node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci");
+		if (node < 0)
+			return 0; /* Unexpected eMMC device; patching not supported */
+
+		puts("Patching FDT so that eMMC is detected by OS\n");
+		return fdt_setprop_empty(blob, node, "non-removable");
+	}
+
+	return 0;
+}
Signature · 1 line
2.40.0
#8 lore raw

Re: [PATCH v2 3/3] arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

In reply to Stefan Roese
Quoted 73 lines · Stefan Roese

Hi Martin,

Quoted 40 lines · Martin Rowe

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

---
  arch/arm/mach-mvebu/Kconfig        |  1 +
  board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++
  2 files changed, 33 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
index fb3cff43f7..773635d691 100644
@@ -107,6 +107,7 @@ config TARGET_CLEARFOG
      bool "Support ClearFog"
      select 88F6820
      select BOARD_LATE_INIT
+     select OF_BOARD_SETUP
 
  config TARGET_HELIOS4
      bool "Support Helios4"
board/solidrun/clearfog/clearfog.c +1 -0
index 03adb591d8..0087fea7db 100644
@@ -10,6 +10,7 @@
  #include <miiphy.h>
  #include <net.h>
  #include <netdev.h>
+#include <mmc.h>
  #include <asm/global_data.h>
  #include <asm/io.h>
  #include <asm/arch/cpu.h>

board/solidrun/clearfog/clearfog.c int board_late_init(void) · line 268

Quoted 7 lines
board/solidrun/clearfog/clearfog.c +4 -0
@@ -261,3 +262,34 @@ int board_late_init(void)
 
      return 0;
  }
+
+static bool has_emmc(void)
+{
+     struct mmc *mmc;

Nitpicking: Please add an empty line after the variable declaration section.

Quoted 5 lines
board/solidrun/clearfog/clearfog.c +5 -0
+     mmc = find_mmc_device(0);
+     if (!mmc)
+             return 0;
+     return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
+}

board/solidrun/clearfog/clearfog.c int board_late_init(void) · line 283

Quoted 10 lines
board/solidrun/clearfog/clearfog.c +10 -0
+
+/*
+ * The Clearfog devices have only one SDHC device. This is either eMMC
+ * if it is populated on the SOM or SDHC if not. The Linux device tree
+ * assumes the SDHC case. Detect if the device is an eMMC and fixup the
+ * device-tree, so that it will be detected by Linux.
+ */
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+     __maybe_unused int node;

Is this "__maybe_unused" really needed here?

Quoted 6 lines

Otherwise:

Thanks,
Stefan

Hmm, I fixed these two things and thought I submitted with In-Reply-To this thread, but it's gone and created a new untitled series in patchwork for the fix. Is there anything I can do to fix that up? Sorry for the hassle.

Quoted 12 lines
Quoted 12 lines
board/solidrun/clearfog/clearfog.c +12 -0
+
+     if (has_emmc()) {
+             node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci");
+             if (node < 0)
+                     return 0; /* Unexpected eMMC device; patching not supported */
+
+             puts("Patching FDT so that eMMC is detected by OS\n");
+             return fdt_setprop_empty(blob, node, "non-removable");
+     }
+
+     return 0;
+}
#9 lore raw

Re: [PATCH v2 3/3] arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

Quoted 2 lines · On Monday 27 March 2023 10:34:59 Martin Rowe wrote:

Hmm, I fixed these two things and thought I submitted with In-Reply-To this thread, but it's gone

Header is not gone, I received it, but you specified it incorrectly.

In your email is:

In-Reply-To: [email protected]

But correct format is with angle brackets, so it should be:

In-Reply-To: <[email protected]>

#10 lore raw

PATCH v3 3/3 arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

In reply to Stefan Roese

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

---
Resend with correct header
Fixed spacing and removed __maybe_unused

 arch/arm/mach-mvebu/Kconfig        |  1 +
 board/solidrun/clearfog/clearfog.c | 33 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
index 1f0dbef1c6..b1f2e97ae7 100644
@@ -107,6 +107,7 @@ config TARGET_CLEARFOG
 	bool "Support ClearFog"
 	select 88F6820
 	select BOARD_LATE_INIT
+	select OF_BOARD_SETUP
 
 config TARGET_HELIOS4
 	bool "Support Helios4"
board/solidrun/clearfog/clearfog.c +33 -0
index 03adb591d8..6edb422155 100644
@@ -10,6 +10,7 @@
 #include <miiphy.h>
 #include <net.h>
 #include <netdev.h>
+#include <mmc.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
@@ -261,3 +262,35 @@ int board_late_init(void)
 
 	return 0;
 }
+
+static bool has_emmc(void)
+{
+	struct mmc *mmc;
+
+	mmc = find_mmc_device(0);
+	if (!mmc)
+		return 0;
+	return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
+}
+
+/*
+ * The Clearfog devices have only one SDHC device. This is either eMMC
+ * if it is populated on the SOM or SDHC if not. The Linux device tree
+ * assumes the SDHC case. Detect if the device is an eMMC and fixup the
+ * device-tree, so that it will be detected by Linux.
+ */
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	int node;
+
+	if (has_emmc()) {
+		node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci");
+		if (node < 0)
+			return 0; /* Unexpected eMMC device; patching not supported */
+
+		puts("Patching FDT so that eMMC is detected by OS\n");
+		return fdt_setprop_empty(blob, node, "non-removable");
+	}
+
+	return 0;
+}
Signature · 1 line
2.40.0
Reviewed-by on v3 3/3
#11 lore raw

Re: [PATCH v3 3/3] arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

Quoted 10 lines · Martin Rowe

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

Thanks,
Stefan

Quoted 58 lines

---
Resend with correct header
Fixed spacing and removed __maybe_unused

  arch/arm/mach-mvebu/Kconfig        |  1 +
  board/solidrun/clearfog/clearfog.c | 33 ++++++++++++++++++++++++++++++
  2 files changed, 34 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
index 1f0dbef1c6..b1f2e97ae7 100644
@@ -107,6 +107,7 @@ config TARGET_CLEARFOG
  	bool "Support ClearFog"
  	select 88F6820
  	select BOARD_LATE_INIT
+	select OF_BOARD_SETUP
 
  config TARGET_HELIOS4
  	bool "Support Helios4"
board/solidrun/clearfog/clearfog.c +23 -0
index 03adb591d8..6edb422155 100644
@@ -10,6 +10,7 @@
  #include <miiphy.h>
  #include <net.h>
  #include <netdev.h>
+#include <mmc.h>
  #include <asm/global_data.h>
  #include <asm/io.h>
  #include <asm/arch/cpu.h>
@@ -261,3 +262,35 @@ int board_late_init(void)
 
  	return 0;
  }
+
+static bool has_emmc(void)
+{
+	struct mmc *mmc;
+
+	mmc = find_mmc_device(0);
+	if (!mmc)
+		return 0;
+	return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
+}
+
+/*
+ * The Clearfog devices have only one SDHC device. This is either eMMC
+ * if it is populated on the SOM or SDHC if not. The Linux device tree
+ * assumes the SDHC case. Detect if the device is an eMMC and fixup the
+ * device-tree, so that it will be detected by Linux.
+ */
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	int node;
+
+	if (has_emmc()) {

board/solidrun/clearfog/clearfog.c int board_late_init(void) · line 296

Quoted 10 lines
board/solidrun/clearfog/clearfog.c +10 -0
+		node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci");
+		if (node < 0)
+			return 0; /* Unexpected eMMC device; patching not supported */
+
+		puts("Patching FDT so that eMMC is detected by OS\n");
+		return fdt_setprop_empty(blob, node, "non-removable");
+	}
+
+	return 0;
+}

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Reviewed-by on the v2 series
#12 lore raw
In reply to Martin Rowe
Quoted 24 lines · On Saturday 25 March 2023 10:02:42 Martin Rowe wrote:

Minor defconfig and eMMC updates for SolidRun's A388 Clearfog devices.

Changes since v1:
- Omitted defconfig canonicalization changes
- Removed unneeded defconfig changes
- Set non-removable in u-boot dtsi instead of MMC_BROKEN_CD
- Reworked FDT patch logic

Changes since initial discussion:
https://lists.denx.de/pipermail/u-boot/2023-February/510492.html
- CONFIG_SPL_SPI selected for SPI defconfig
- Runtime patching of kernel FDT added for eMMC detection

Note that this patch depends on this patch series (has been merged to u-boot-marvell/next):
https://lists.denx.de/pipermail/u-boot/2023-March/511038.html

Martin Rowe (3):
arm: mvebu: clearfog: Fix MMC detection
arm: mvebu: clearfog: Add defconfig for SPI booting
arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

Quoted 10 lines
 arch/arm/dts/armada-388-clearfog-u-boot.dtsi  |  1 +
 arch/arm/mach-mvebu/Kconfig                   |  1 +
 board/solidrun/clearfog/clearfog.c            | 32 +++++++++++++++++++
 ...arfog_defconfig => clearfog_spi_defconfig} |  2 +-
 4 files changed, 35 insertions(+), 1 deletion(-)
 copy configs/{clearfog_defconfig => clearfog_spi_defconfig} (98%)
Signature · 1 line
2.40.0

Looks good,

#13 lore raw
In reply to Martin Rowe
Quoted 24 lines · Martin Rowe

Minor defconfig and eMMC updates for SolidRun's A388 Clearfog devices.

Changes since v1:
- Omitted defconfig canonicalization changes
- Removed unneeded defconfig changes
- Set non-removable in u-boot dtsi instead of MMC_BROKEN_CD
- Reworked FDT patch logic

Changes since initial discussion:
https://lists.denx.de/pipermail/u-boot/2023-February/510492.html
- CONFIG_SPL_SPI selected for SPI defconfig
- Runtime patching of kernel FDT added for eMMC detection

Note that this patch depends on this patch series (has been merged to u-boot-marvell/next):
https://lists.denx.de/pipermail/u-boot/2023-March/511038.html

Martin Rowe (3):
arm: mvebu: clearfog: Fix MMC detection
arm: mvebu: clearfog: Add defconfig for SPI booting
arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

Quoted 7 lines
  arch/arm/dts/armada-388-clearfog-u-boot.dtsi  |  1 +
  arch/arm/mach-mvebu/Kconfig                   |  1 +
  board/solidrun/clearfog/clearfog.c            | 32 +++++++++++++++++++
  ...arfog_defconfig => clearfog_spi_defconfig} |  2 +-
  4 files changed, 35 insertions(+), 1 deletion(-)

copy configs/{clearfog_defconfig => clearfog_spi_defconfig} (98%)

Applied to u-boot-marvell/next

Thanks,
Stefan