From 71ed3e4890d92cccd628e05c3f6e2ffdfbbc6a26 Mon Sep 17 00:00:00 2001 From: jamess_huang Date: Wed, 18 Oct 2017 16:16:06 +0800 Subject: [PATCH] fixed there is no eMMC if user boot from sdcard with jumper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icebb8574245688c5bd9e49a7c292629c7cc6b0ff Reviewed-on: https://tp-biosrd-v02/gerrit/81136 Reviewed-by: Jamess Huang(黃以民) Tested-by: Jamess Huang(黃以民) --- arch/arm/boot/dts/rk3288.dtsi | 1 + drivers/mmc/host/dw_mmc-rockchip.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) mode change 100644 => 100755 drivers/mmc/host/dw_mmc-rockchip.c diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index ab37b37deec1..d6c45dff2d93 100755 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -347,6 +347,7 @@ fifo-depth = <0x100>; interrupts = ; reg = <0x0 0xff0f0000 0x0 0x4000>; + maskrom_gpio = <&gpio6 7 GPIO_ACTIVE_HIGH>; status = "okay"; supports-emmc; }; diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c old mode 100644 new mode 100755 index e4afa4d47603..c3420990ae24 --- a/drivers/mmc/host/dw_mmc-rockchip.c +++ b/drivers/mmc/host/dw_mmc-rockchip.c @@ -20,6 +20,12 @@ #include "dw_mmc.h" #include "dw_mmc-pltfm.h" +#include +#ifdef CONFIG_OF +#include +#endif + + #define RK3288_CLKGEN_DIV 2 struct dw_mci_rockchip_priv_data { @@ -232,12 +238,26 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host) static int dw_mci_rockchip_init(struct dw_mci *host) { + struct device_node *np = host->dev->of_node; + int gpio; + enum of_gpio_flags flags; + /* It is slot 8 on Rockchip SoCs */ host->sdio_id0 = 8; /* It needs this quirk on all Rockchip SoCs */ host->pdata->quirks |= DW_MCI_QUIRK_BROKEN_DTO; + gpio = of_get_named_gpio_flags(np, "maskrom_gpio", 0, &flags); + + if (gpio_is_valid(gpio)) { + if(!gpio_request(gpio, "maskrom_gpio")) { + gpio_direction_output(gpio, (flags==GPIO_ACTIVE_HIGH)?1:0); + gpio_free(gpio); + mdelay(10); + dev_info(host->dev, "set maskrom gpio to enable emmc\n"); + } + } return 0; }