[U-Boot] [PATCH 2/8] fsl_esdhc: Add device tree fixups
Anton Vorontsov
avorontsov at ru.mvista.com
Wed Apr 29 23:50:01 CEST 2009
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 at ru.mvista.com>
---
drivers/mmc/fsl_esdhc.c | 22 ++++++++++++++++++++++
include/fsl_esdhc.h | 8 ++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 0ba45cd..3929634 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -28,11 +28,13 @@
#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,23 @@ int fsl_esdhc_mmc_init(bd_t *bis)
{
return esdhc_initialize(bis);
}
+
+#ifdef CONFIG_MPC85xx
+#define ESDHC_COMPATIBLE "fsl,mpc8536-esdhc"
+#else
+#define ESDHC_COMPATIBLE "fsl,mpc8379-esdhc"
+#endif
+
+void fdt_fixup_esdhc(void *blob, bd_t *bd)
+{
+ if (!hwconfig("esdhc")) {
+ const char *reason = "disabled";
+
+ do_fixup_by_compat(blob, ESDHC_COMPATIBLE, "status", reason,
+ strlen(reason) + 1, 1);
+ return;
+ }
+
+ do_fixup_by_compat_u32(blob, ESDHC_COMPATIBLE, "clock-frequency",
+ gd->sdhc_clk, 1);
+}
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
index 0a5c5d6..89b8304 100644
--- a/include/fsl_esdhc.h
+++ b/include/fsl_esdhc.h
@@ -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
@@ -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__ */
--
1.6.2.2
More information about the U-Boot
mailing list