From: Anton Vorontsov Date: Tue, 9 Jun 2009 20:25:29 +0000 (+0400) Subject: fsl_esdhc: Add device tree fixups X-Git-Tag: v2009.08-rc1~94 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b33433a63fe08c9e723ea15a7c7c7143bf527c6d;p=u-boot fsl_esdhc: Add device tree fixups This patch implements fdt_fixup_esdhc() function that is used to fixup the device tree. The function adds status = "disabled" propery if esdhc pins muxed away, otherwise it fixups clock-frequency for esdhc nodes. Signed-off-by: Anton Vorontsov Acked-by: Kim Phillips --- diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 8274af5610..c6e9e6e782 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -28,11 +28,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include @@ -346,3 +348,20 @@ int fsl_esdhc_mmc_init(bd_t *bis) { return esdhc_initialize(bis); } + +void fdt_fixup_esdhc(void *blob, bd_t *bd) +{ + const char *compat = "fsl,esdhc"; + const char *status = "okay"; + + if (!hwconfig("esdhc")) { + status = "disabled"; + goto out; + } + + do_fixup_by_compat_u32(blob, compat, "clock-frequency", + gd->sdhc_clk, 1); +out: + do_fixup_by_compat(blob, compat, "status", status, + strlen(status) + 1, 1); +} diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h index 0a5c5d6268..89b8304d5f 100644 --- a/include/fsl_esdhc.h +++ b/include/fsl_esdhc.h @@ -26,6 +26,8 @@ #ifndef __FSL_ESDHC_H__ #define __FSL_ESDHC_H__ +#include + /* FSL eSDHC-specific constants */ #define SYSCTL 0x0002e02c #define SYSCTL_INITA 0x08000000 @@ -140,6 +142,12 @@ #define ESDHC_HOSTCAPBLT_DMAS 0x00400000 #define ESDHC_HOSTCAPBLT_HSS 0x00200000 +#ifdef CONFIG_FSL_ESDHC int fsl_esdhc_mmc_init(bd_t *bis); +void fdt_fixup_esdhc(void *blob, bd_t *bd); +#else +static inline int fsl_esdhc_mmc_init(bd_t *bis) { return -ENOSYS; } +static inline void fdt_fixup_esdhc(void *blob, bd_t *bd) {} +#endif /* CONFIG_FSL_ESDHC */ #endif /* __FSL_ESDHC_H__ */