openwrtv4/package/boot/uboot-layerscape/patches/0056-mmc-fsl_esdhc-disable-sdhc2-when-no-card-inserted-fo.patch

94 lines
2.6 KiB
Diff
Raw Normal View History

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