Commit b33433a63fe08c9e723ea15a7c7c7143bf527c6d
Committed by
Wolfgang Denk
1 parent
93f9dcf9e8
Exists in
master
and in
55 other branches
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 <avorontsov@ru.mvista.com> Acked-by: Kim Phillips <kim.phillips@freescale.com>
Showing 2 changed files with 27 additions and 0 deletions Side-by-side Diff
drivers/mmc/fsl_esdhc.c
... | ... | @@ -28,11 +28,13 @@ |
28 | 28 | #include <config.h> |
29 | 29 | #include <common.h> |
30 | 30 | #include <command.h> |
31 | +#include <hwconfig.h> | |
31 | 32 | #include <mmc.h> |
32 | 33 | #include <part.h> |
33 | 34 | #include <malloc.h> |
34 | 35 | #include <mmc.h> |
35 | 36 | #include <fsl_esdhc.h> |
37 | +#include <fdt_support.h> | |
36 | 38 | #include <asm/io.h> |
37 | 39 | |
38 | 40 | |
... | ... | @@ -345,5 +347,22 @@ |
345 | 347 | int fsl_esdhc_mmc_init(bd_t *bis) |
346 | 348 | { |
347 | 349 | return esdhc_initialize(bis); |
350 | +} | |
351 | + | |
352 | +void fdt_fixup_esdhc(void *blob, bd_t *bd) | |
353 | +{ | |
354 | + const char *compat = "fsl,esdhc"; | |
355 | + const char *status = "okay"; | |
356 | + | |
357 | + if (!hwconfig("esdhc")) { | |
358 | + status = "disabled"; | |
359 | + goto out; | |
360 | + } | |
361 | + | |
362 | + do_fixup_by_compat_u32(blob, compat, "clock-frequency", | |
363 | + gd->sdhc_clk, 1); | |
364 | +out: | |
365 | + do_fixup_by_compat(blob, compat, "status", status, | |
366 | + strlen(status) + 1, 1); | |
348 | 367 | } |
include/fsl_esdhc.h
... | ... | @@ -26,6 +26,8 @@ |
26 | 26 | #ifndef __FSL_ESDHC_H__ |
27 | 27 | #define __FSL_ESDHC_H__ |
28 | 28 | |
29 | +#include <asm/errno.h> | |
30 | + | |
29 | 31 | /* FSL eSDHC-specific constants */ |
30 | 32 | #define SYSCTL 0x0002e02c |
31 | 33 | #define SYSCTL_INITA 0x08000000 |
32 | 34 | |
... | ... | @@ -140,7 +142,13 @@ |
140 | 142 | #define ESDHC_HOSTCAPBLT_DMAS 0x00400000 |
141 | 143 | #define ESDHC_HOSTCAPBLT_HSS 0x00200000 |
142 | 144 | |
145 | +#ifdef CONFIG_FSL_ESDHC | |
143 | 146 | int fsl_esdhc_mmc_init(bd_t *bis); |
147 | +void fdt_fixup_esdhc(void *blob, bd_t *bd); | |
148 | +#else | |
149 | +static inline int fsl_esdhc_mmc_init(bd_t *bis) { return -ENOSYS; } | |
150 | +static inline void fdt_fixup_esdhc(void *blob, bd_t *bd) {} | |
151 | +#endif /* CONFIG_FSL_ESDHC */ | |
144 | 152 | |
145 | 153 | #endif /* __FSL_ESDHC_H__ */ |