1 From 22424b4b25faefec704556d47751ad54c811ee09 Mon Sep 17 00:00:00 2001
2 From: Yangbo Lu <yangbo.lu@nxp.com>
3 Date: Wed, 15 Jun 2016 15:45:12 +0800
4 Subject: [PATCH 56/93] mmc: fsl_esdhc: disable sdhc2 when no card inserted
7 This is a temporary workaround patch for ls1012aqds becasue there
8 was host controller hardware issue found on some QDS boards when
9 there was no eMMC adapter card inserted. This would cause below
10 continious error messages in linux. So this patch is to disable
11 sdhc2 when finding there isn't card inserted.
12 "mmc1: Controller never released inhibit bit(s)."
14 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
16 board/freescale/ls1012aqds/ls1012aqds.c | 11 +++++++++++
17 drivers/mmc/fsl_esdhc.c | 9 +++++++++
18 include/fdt_support.h | 4 +++-
19 3 files changed, 23 insertions(+), 1 deletion(-)
21 diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c
22 index b7365e8..56004ea 100644
23 --- a/board/freescale/ls1012aqds/ls1012aqds.c
24 +++ b/board/freescale/ls1012aqds/ls1012aqds.c
25 @@ -161,6 +161,17 @@ int select_i2c_ch_pca9547(u8 ch)
29 +int mmc_check_sdhc2_card(void)
33 + card_id = (QIXIS_READ(present2) & 0xe0) >> 5;
43 diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
44 index 2c6e175..98f3cca 100644
45 --- a/drivers/mmc/fsl_esdhc.c
46 +++ b/drivers/mmc/fsl_esdhc.c
47 @@ -774,6 +774,11 @@ int fsl_esdhc_mmc_init(bd_t *bis)
51 +__weak int mmc_check_sdhc2_card(void)
56 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
57 void mmc_adapter_card_type_ident(void)
59 @@ -817,6 +822,7 @@ void mmc_adapter_card_type_ident(void)
60 void fdt_fixup_esdhc(void *blob, bd_t *bd)
62 const char *compat = "fsl,esdhc";
63 + const char *compat1 = "fsl,ls1012a-esdhc1";
65 #ifdef CONFIG_FSL_ESDHC_PIN_MUX
66 if (!hwconfig("esdhc")) {
67 @@ -839,5 +845,8 @@ void fdt_fixup_esdhc(void *blob, bd_t *bd)
69 do_fixup_by_compat(blob, compat, "status", "okay",
71 + if (!mmc_check_sdhc2_card())
72 + do_fixup_by_compat(blob, compat1, "status", "disabled",
76 diff --git a/include/fdt_support.h b/include/fdt_support.h
77 index 296add0..2e66eb1 100644
78 --- a/include/fdt_support.h
79 +++ b/include/fdt_support.h
80 @@ -240,7 +240,9 @@ int arch_fixup_memory_node(void *blob);
82 int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
83 u32 height, u32 stride, const char *format);
85 +#ifdef CONFIG_FSL_ESDHC
86 +int mmc_check_sdhc2_card(void);
88 #endif /* ifdef CONFIG_OF_LIBFDT */