From 944ff8a3704368e56d1448ad7244847dd933596f Mon Sep 17 00:00:00 2001
From: Timothy Pearson <tpearson@raptorengineeringinc.com>
Date: Mon, 18 Apr 2016 16:42:11 +0000
Subject: [PATCH 04/15] drivers/pinctrl/rockchip/pinctrl_rk3288: Set up eMMC /
 SD card slot

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 drivers/pinctrl/rockchip/pinctrl_rk3288.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3288.c b/drivers/pinctrl/rockchip/pinctrl_rk3288.c
index 7c769bd..de8ddc6 100644
--- a/drivers/pinctrl/rockchip/pinctrl_rk3288.c
+++ b/drivers/pinctrl/rockchip/pinctrl_rk3288.c
@@ -367,6 +367,8 @@ static void pinctrl_rk3288_uart_config(struct rk3288_grf *grf, int uart_id)
 
 static void pinctrl_rk3288_sdmmc_config(struct rk3288_grf *grf, int mmc_id)
 {
+	debug("%s mmc_id: %d\n", __func__, mmc_id);
+
 	switch (mmc_id) {
 	case PERIPH_ID_EMMC:
 		rk_clrsetreg(&grf->gpio3a_iomux, 0xffff,
@@ -479,12 +481,22 @@ static int rk3288_pinctrl_get_periph_id(struct udevice *dev,
 	u32 cell[3];
 	int ret;
 
+	debug("%s: %s %s offset: %08x\n", __func__, dev->name, periph->name, periph->of_offset);
+
 	ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
 				   "interrupts", cell, ARRAY_SIZE(cell));
-	if (ret < 0)
+	if (ret < 0) {
+		debug("%s: unable to locate device interrupts in device tree\n", __func__);
 		return -EINVAL;
+	}
+
+	debug("%s cell[1]: %02x\n", __func__, cell[1]);
 
 	switch (cell[1]) {
+	case 32:
+		return PERIPH_ID_SDCARD;
+	case 35:
+		return PERIPH_ID_EMMC;
 	case 44:
 		return PERIPH_ID_SPI0;
 	case 45:
-- 
1.9.1

