]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fsl_esdhc: Add device tree fixups
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Tue, 9 Jun 2009 20:25:29 +0000 (00:25 +0400)
committerWolfgang Denk <wd@denx.de>
Thu, 16 Jul 2009 20:24:06 +0000 (22:24 +0200)
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 <avorontsov@ru.mvista.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
drivers/mmc/fsl_esdhc.c
include/fsl_esdhc.h

index 8274af561037425e9fd57c0f18c307d7c61b892c..c6e9e6e7822d886d947c7a0d3690a6584f8c6ddc 100644 (file)
 #include <config.h>
 #include <common.h>
 #include <command.h>
+#include <hwconfig.h>
 #include <mmc.h>
 #include <part.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
+#include <fdt_support.h>
 #include <asm/io.h>
 
 
@@ -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);
+}
index 0a5c5d62683f9854075b7984947af3991fcbced2..89b8304d5f7b7b24184b9812abf4f034579dcf8a 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef  __FSL_ESDHC_H__
 #define        __FSL_ESDHC_H__
 
+#include <asm/errno.h>
+
 /* FSL eSDHC-specific constants */
 #define SYSCTL                 0x0002e02c
 #define SYSCTL_INITA           0x08000000
 #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__ */