Commit b33433a63fe08c9e723ea15a7c7c7143bf527c6d

Authored by Anton Vorontsov
Committed by Wolfgang Denk
1 parent 93f9dcf9e8
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

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 }
... ... @@ -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__ */