Message ID | 20230325000245.8467-4-martin.p.rowe@gmail.com |
---|---|
State | Superseded |
Delegated to: | Stefan Roese |
Headers | show |
Series | arm: mvebu: clearfog: defconfig and eMMC updates | expand |
Hi Martin, On 3/25/23 01:02, Martin Rowe wrote: > [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> > --- > arch/arm/mach-mvebu/Kconfig | 1 + > board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++ > 2 files changed, 33 insertions(+) > > diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig > index fb3cff43f7..773635d691 100644 > --- a/arch/arm/mach-mvebu/Kconfig > +++ b/arch/arm/mach-mvebu/Kconfig > @@ -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" > diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c > index 03adb591d8..0087fea7db 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,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. > + 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; Is this "__maybe_unused" really needed here? Otherwise: Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > + > + 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; > +}
On Mon, 27 Mar 2023 at 07:26, Stefan Roese <sr@denx.de> wrote: > > Hi Martin, > > On 3/25/23 01:02, Martin Rowe wrote: > > [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> > > --- > > arch/arm/mach-mvebu/Kconfig | 1 + > > board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++ > > 2 files changed, 33 insertions(+) > > > > diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig > > index fb3cff43f7..773635d691 100644 > > --- a/arch/arm/mach-mvebu/Kconfig > > +++ b/arch/arm/mach-mvebu/Kconfig > > @@ -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" > > diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c > > index 03adb591d8..0087fea7db 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,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. > > > + 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; > > Is this "__maybe_unused" really needed here? > > Otherwise: > > Reviewed-by: Stefan Roese <sr@denx.de> > > 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. > > + > > + 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; > > +}
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: 38fb92cd-6619-28be-d3ac-0576c4c919e5@denx.de But correct format is with angle brackets, so it should be: In-Reply-To: <38fb92cd-6619-28be-d3ac-0576c4c919e5@denx.de>
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index fb3cff43f7..773635d691 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -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" diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 03adb591d8..0087fea7db 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,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; +}
[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> --- arch/arm/mach-mvebu/Kconfig | 1 + board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)