ODROID-N2: mmc: Initate MMC power state on reboot

Change-Id: Ifade734854d94c1c98b34c55a431835b80c5f7e4
This commit is contained in:
Kevin Kim
2019-01-31 16:40:41 +09:00
committed by Chris KIM
parent f7088d4fa1
commit 4595b6a0cd
3 changed files with 45 additions and 1 deletions

View File

@@ -466,16 +466,22 @@
&sd_emmc_b {
status = "okay";
sd-uhs-sdr25;
sd-uhs-sdr50;
sd-uhs-sdr104;
max-frequency = <200000000>;
sd {
caps = "MMC_CAP_4_BIT_DATA",
"MMC_CAP_UHS_SDR25",
"MMC_CAP_UHS_SDR50",
"MMC_CAP_UHS_SDR104",
"MMC_CAP_MMC_HIGHSPEED",
"MMC_CAP_SD_HIGHSPEED";
vol_switch = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
gpio_power = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
vol_switch_18 = <1>;
f_min = <400000>;
f_max = <100000000>;
f_max = <200000000>;
};
};

View File

@@ -3386,6 +3386,39 @@ static int meson_mmc_remove(struct platform_device *pdev)
return 0;
}
/*
* Shutdown callback
*/
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
static void meson_mmc_shutdown(struct platform_device *pdev)
{
struct amlsd_host *host = dev_get_drvdata(&pdev->dev);
struct mmc_host *mmc = host->mmc;
if (mmc) {
struct amlsd_platform *pdata = mmc_priv(mmc);
if ((pdata->vol_switch) && (pdata->gpio_power)) {
gpio_direction_output(pdata->vol_switch, 0);
mdelay(500);
gpio_direction_output(pdata->vol_switch, 1);
gpio_direction_output(pdata->gpio_power, 0);
mdelay(500);
gpio_direction_output(pdata->vol_switch, 0);
gpio_direction_output(pdata->gpio_power, 1);
mdelay(200);
gpio_free(pdata->vol_switch);
gpio_free(pdata->gpio_power);
}
if (pdata->hw_reset) {
gpio_direction_output(pdata->hw_reset, 0);
mdelay(500);
gpio_direction_output(pdata->hw_reset, 1);
}
}
}
#endif
static struct meson_mmc_data mmc_data_gxbb = {
.chip_type = MMC_CHIP_GXBB,
.port_a_base = 0xd0070000,
@@ -3715,6 +3748,9 @@ MODULE_DEVICE_TABLE(of, meson_mmc_of_match);
static struct platform_driver meson_mmc_driver = {
.probe = meson_mmc_probe,
.remove = meson_mmc_remove,
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
.shutdown = meson_mmc_shutdown,
#endif
.driver = {
.name = "meson-aml-mmc",
.owner = THIS_MODULE,

View File

@@ -382,6 +382,7 @@ int of_amlsd_init(struct amlsd_platform *pdata)
}
}
#endif
#if !defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
if (pdata->gpio_power) {
if (pdata->power_level) {
ret = gpio_request_one(pdata->gpio_power,
@@ -393,6 +394,7 @@ int of_amlsd_init(struct amlsd_platform *pdata)
CHECK_RET(ret);
}
}
#endif
/* if(pdata->port == MESON_SDIO_PORT_A) */
/* wifi_setup_dt(); */