aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-layerscape/patches/0058-mmc-fsl_esdhc-disable-sdhc2-when-no-card-inserted-fo.patch
blob: 45366ca689d8f9faf9f805c60c1ccc7a8b81ffd4 (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
From 0499ca266f668c9d72217631151f3b6e15350134 Mon Sep 17 00:00:00 2001
From: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Date: Wed, 15 Jun 2016 17:42:51 +0530
Subject: [PATCH 58/93] mmc: fsl_esdhc: disable sdhc2 when no card inserted
 for ls1012ardb

This is a temporary workaround patch for ls1012ardb becasue there
was host controller hardware issue found on some RDB 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: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
---
 board/freescale/ls1012ardb/ls1012ardb.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c
index 90cbd5e..ad4d8ee 100644
--- a/board/freescale/ls1012ardb/ls1012ardb.c
+++ b/board/freescale/ls1012ardb/ls1012ardb.c
@@ -171,6 +171,30 @@ int board_early_init_f(void)
 	return 0;
 }
 
+int mmc_check_sdhc2_card(void)
+{
+	u8 io = 0;
+	u8 is_card = 0;
+
+	/* Initialize i2c early for Serial flash bank information */
+	i2c_set_bus_num(0);
+
+	if (i2c_read(I2C_MUX_IO1_ADDR, 0, 1, &io, 1) < 0) {
+		printf("Error reading i2c boot information!\n");
+		return 0; /* Don't want to hang() on this error */
+	}
+
+	io = io & 0x0c;
+
+	switch (io) {
+	case 0:
+	case 8:
+		is_card = 1;
+	}
+
+	return is_card;
+}
+
 int board_init(void)
 {
 	struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
-- 
1.7.9.5