c95639f5800a3fee6771150798fee3119ea13e7c
[openwrt/staging/lynxis/omap.git] /
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
5 for ls1012aqds
6
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)."
13
14 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
15 ---
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(-)
20
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)
26 return 0;
27 }
28
29 +int mmc_check_sdhc2_card(void)
30 +{
31 + u8 card_id;
32 +
33 + card_id = (QIXIS_READ(present2) & 0xe0) >> 5;
34 + if (card_id == 0x7)
35 + return 0;
36 + else
37 + return 1;
38 +}
39 +
40 int dram_init(void)
41 {
42 mmdc_init();
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)
48 #endif
49 }
50
51 +__weak int mmc_check_sdhc2_card(void)
52 +{
53 + return 1;
54 +}
55 +
56 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
57 void mmc_adapter_card_type_ident(void)
58 {
59 @@ -817,6 +822,7 @@ void mmc_adapter_card_type_ident(void)
60 void fdt_fixup_esdhc(void *blob, bd_t *bd)
61 {
62 const char *compat = "fsl,esdhc";
63 + const char *compat1 = "fsl,ls1012a-esdhc1";
64
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)
68 #endif
69 do_fixup_by_compat(blob, compat, "status", "okay",
70 4 + 1, 1);
71 + if (!mmc_check_sdhc2_card())
72 + do_fixup_by_compat(blob, compat1, "status", "disabled",
73 + 4 + 1, 1);
74 }
75 #endif
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);
81
82 int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
83 u32 height, u32 stride, const char *format);
84 -
85 +#ifdef CONFIG_FSL_ESDHC
86 +int mmc_check_sdhc2_card(void);
87 +#endif
88 #endif /* ifdef CONFIG_OF_LIBFDT */
89
90 #ifdef USE_HOSTCC
91 --
92 1.7.9.5
93