aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-layerscape/patches/0056-mmc-fsl_esdhc-disable-sdhc2-when-no-card-inserted-fo.patch
blob: c95639f5800a3fee6771150798fee3119ea13e7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
From 22424b4b25faefec704556d47751ad54c811ee09 Mon Sep 17 00:00:00 2001
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Wed, 15 Jun 2016 15:45:12 +0800
Subject: [PATCH 56/93] mmc: fsl_esdhc: disable sdhc2 when no card inserted
 for ls1012aqds

This is a temporary workaround patch for ls1012aqds becasue there
was host controller hardware issue found on some QDS boards when
there was no eMMC adapter card inserted. This would cause below
continious error messages in linux. So this patch is to disable
sdhc2 when finding there isn't card inserted.
"mmc1: Controller never released inhibit bit(s)."

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 board/freescale/ls1012aqds/ls1012aqds.c |   11 +++++++++++
 drivers/mmc/fsl_esdhc.c                 |    9 +++++++++
 include/fdt_support.h                   |    4 +++-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c
index b7365e8..56004ea 100644
--- a/board/freescale/ls1012aqds/ls1012aqds.c
+++ b/board/freescale/ls1012aqds/ls1012aqds.c
@@ -161,6 +161,17 @@ int select_i2c_ch_pca9547(u8 ch)
 	return 0;
 }
 
+int mmc_check_sdhc2_card(void)
+{
+	u8 card_id;
+
+	card_id = (QIXIS_READ(present2) & 0xe0) >> 5;
+	if (card_id == 0x7)
+		return 0;
+	else
+		return 1;
+}
+
 int dram_init(void)
 {
 	mmdc_init();
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 2c6e175..98f3cca 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -774,6 +774,11 @@ int fsl_esdhc_mmc_init(bd_t *bis)
 #endif
 }
 
+__weak int mmc_check_sdhc2_card(void)
+{
+	return 1;
+}
+
 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
 void mmc_adapter_card_type_ident(void)
 {
@@ -817,6 +822,7 @@ void mmc_adapter_card_type_ident(void)
 void fdt_fixup_esdhc(void *blob, bd_t *bd)
 {
 	const char *compat = "fsl,esdhc";
+	const char *compat1 = "fsl,ls1012a-esdhc1";
 
 #ifdef CONFIG_FSL_ESDHC_PIN_MUX
 	if (!hwconfig("esdhc")) {
@@ -839,5 +845,8 @@ void fdt_fixup_esdhc(void *blob, bd_t *bd)
 #endif
 	do_fixup_by_compat(blob, compat, "status", "okay",
 			   4 + 1, 1);
+	if (!mmc_check_sdhc2_card())
+		do_fixup_by_compat(blob, compat1, "status", "disabled",
+				   4 + 1, 1);
 }
 #endif
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 296add0..2e66eb1 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -240,7 +240,9 @@ int arch_fixup_memory_node(void *blob);
 
 int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
 			    u32 height, u32 stride, const char *format);
-
+#ifdef CONFIG_FSL_ESDHC
+int mmc_check_sdhc2_card(void);
+#endif
 #endif /* ifdef CONFIG_OF_LIBFDT */
 
 #ifdef USE_HOSTCC
-- 
1.7.9.5