[U-Boot] [PATCH 32/52] rockchip: pinctrl: rk3368: add support for configuring the MMC pins
Philipp Tomsich
philipp.tomsich at theobroma-systems.com
Tue Jul 18 20:36:12 UTC 2017
The RK3368 has two SD/MMC controllers that can be used from U-Boot
both during SPL and for booting an OS from the full bootloader stage.
While both are configured to (mostly) sensible settings from the BROM,
additional configuration for the MMC controller is needed to configure
it to 8bit mode.
This adds pinctrl support for the MMC controller.
Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
---
drivers/pinctrl/rockchip/pinctrl_rk3368.c | 48 +++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3368.c b/drivers/pinctrl/rockchip/pinctrl_rk3368.c
index aecd11d..23950d0 100644
--- a/drivers/pinctrl/rockchip/pinctrl_rk3368.c
+++ b/drivers/pinctrl/rockchip/pinctrl_rk3368.c
@@ -81,6 +81,46 @@ static void pinctrl_rk3368_gmac_config(struct rk3368_grf *grf, int gmac_id)
}
#endif
+static void pinctrl_rk3368_sdmmc_config(struct rk3368_grf *grf, int mmc_id)
+{
+ switch (mmc_id) {
+ case PERIPH_ID_EMMC:
+ debug("mmc id = %d setting registers!\n", mmc_id);
+ rk_clrsetreg(&grf->gpio1c_iomux,
+ RK3368_GPIO1C2_MASK | RK3368_GPIO1C3_MASK |
+ RK3368_GPIO1C4_MASK | RK3368_GPIO1C5_MASK |
+ RK3368_GPIO1C6_MASK | RK3368_GPIO1C7_MASK,
+ RK3368_GPIO1C2_EMMC_DATA0 |
+ RK3368_GPIO1C3_EMMC_DATA1 |
+ RK3368_GPIO1C4_EMMC_DATA2 |
+ RK3368_GPIO1C5_EMMC_DATA3 |
+ RK3368_GPIO1C6_EMMC_DATA4 |
+ RK3368_GPIO1C7_EMMC_DATA5);
+ rk_clrsetreg(&grf->gpio1d_iomux,
+ RK3368_GPIO1D0_MASK | RK3368_GPIO1D1_MASK |
+ RK3368_GPIO1D2_MASK | RK3368_GPIO1D3_MASK,
+ RK3368_GPIO1D0_EMMC_DATA6 |
+ RK3368_GPIO1D1_EMMC_DATA7 |
+ RK3368_GPIO1D2_EMMC_CMD |
+ RK3368_GPIO1D3_EMMC_PWREN);
+ rk_clrsetreg(&grf->gpio2a_iomux,
+ RK3368_GPIO2A3_MASK | RK3368_GPIO2A4_MASK,
+ RK3368_GPIO2A3_EMMC_RSTNOUT |
+ RK3368_GPIO2A4_EMMC_CLKOUT);
+ break;
+ case PERIPH_ID_SDCARD:
+ /*
+ * We assume that the BROM has already set this up
+ * correctly for us and that there's nothing to do
+ * here.
+ */
+ break;
+ default:
+ debug("mmc id = %d iomux error!\n", mmc_id);
+ break;
+ }
+}
+
static int rk3368_pinctrl_request(struct udevice *dev, int func, int flags)
{
struct rk3368_pinctrl_priv *priv = dev_get_priv(dev);
@@ -94,6 +134,10 @@ static int rk3368_pinctrl_request(struct udevice *dev, int func, int flags)
case PERIPH_ID_UART4:
pinctrl_rk3368_uart_config(priv, func);
break;
+ case PERIPH_ID_EMMC:
+ case PERIPH_ID_SDCARD:
+ pinctrl_rk3368_sdmmc_config(priv->grf, func);
+ break;
#if CONFIG_IS_ENABLED(GMAC_ROCKCHIP)
case PERIPH_ID_GMAC:
pinctrl_rk3368_gmac_config(priv->grf, func);
@@ -128,6 +172,10 @@ static int rk3368_pinctrl_get_periph_id(struct udevice *dev,
return PERIPH_ID_UART1;
case 55:
return PERIPH_ID_UART0;
+ case 35:
+ return PERIPH_ID_EMMC;
+ case 32:
+ return PERIPH_ID_SDCARD;
#if CONFIG_IS_ENABLED(GMAC_ROCKCHIP)
case 27:
return PERIPH_ID_GMAC;
--
2.1.4
More information about the U-Boot
mailing list