diff options
author | Martin Rowe <martin.p.rowe@gmail.com> | 2023-03-27 21:24:09 +1000 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2023-03-30 07:05:20 +0200 |
commit | c733fe91e4e643e69615521debaf70e5c52f9352 (patch) | |
tree | 949245bacede80711900e22a15c93e0ca8f59768 /board | |
parent | 3f92f4865bf7e3dfea4008246bbb02416a0f4cd2 (diff) | |
download | u-boot-c733fe91e4e643e69615521debaf70e5c52f9352.tar.gz u-boot-c733fe91e4e643e69615521debaf70e5c52f9352.tar.bz2 u-boot-c733fe91e4e643e69615521debaf70e5c52f9352.zip |
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
Signed-off-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board')
-rw-r--r-- | board/solidrun/clearfog/clearfog.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 03adb591d8..6edb422155 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -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; +} |