sdio: optimize 1bit mode cfg [1/1]
authorNan Li <nan.li@amlogic.com>
Fri, 28 Dec 2018 10:07:27 +0000 (18:07 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Wed, 2 Jan 2019 06:11:31 +0000 (22:11 -0800)
PD#SWPL-3719

Problem:
optimize sdio 1bit cfg fail for dts.

Solution:
move MMC_PM_KEEP_POWER setting from
amlsd_get_host_caps(). so modify dts to
set 1bit mode.

Verify:
p212

Change-Id: I268f25a9550058e7bbf3562eec53c8cd92b58b1b
Signed-off-by: Nan Li <nan.li@amlogic.com>
drivers/amlogic/mmc/aml_sd_emmc.c
drivers/amlogic/mmc/amlsd_of.c
include/linux/amlogic/sd.h

index 2cd502a..a25e742 100644 (file)
@@ -3187,9 +3187,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
                if (pdata->caps & MMC_CAP_NONREMOVABLE)
                        pdata->is_in = 1;
 
-               if (pdata->caps & MMC_PM_KEEP_POWER)
-                       mmc->pm_caps |= MMC_PM_KEEP_POWER;
-
                /* data desc buffer */
 #ifdef CFG_SDEMMC_PIO
                pr_err(">>>>>>>>hostbase %p, dmode %s\n",
@@ -3250,6 +3247,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
                mmc->ocr_avail = pdata->ocr_avail;
                mmc->caps = pdata->caps;
                mmc->caps2 = pdata->caps2;
+               mmc->pm_caps = pdata->pm_caps;
                mmc->f_min = pdata->f_min;
                mmc->f_max = pdata->f_max;
                mmc->max_current_180 = 300; /* 300 mA in 1.8V */
index 0f94379..fc093ed 100644 (file)
@@ -113,11 +113,29 @@ static int amlsd_get_host_caps2(struct device_node *of_node,
                                caps |= host_caps2[i].caps;
                }
        };
+
        pdata->caps2 = caps;
        pr_debug("%s:pdata->caps2 = %x\n", pdata->pinname, pdata->caps2);
        return 0;
 }
 
+static int amlsd_get_host_pm_caps(struct device_node *of_node,
+               struct amlsd_platform *pdata)
+{
+       const char *str_caps;
+       struct property *prop;
+       u32 caps = 0;
+
+       of_property_for_each_string(of_node, "caps", prop, str_caps) {
+               if (!strcasecmp("MMC_PM_KEEP_POWER", str_caps))
+                       caps |= MMC_PM_KEEP_POWER;
+       };
+
+       pdata->pm_caps = caps;
+       pr_debug("%s:pdata->pm_caps = %x\n", pdata->pinname, pdata->pm_caps);
+       return 0;
+}
+
 int amlsd_get_platform_data(struct platform_device *pdev,
                struct amlsd_platform *pdata,
                struct mmc_host *mmc, u32 index)
@@ -211,6 +229,7 @@ int amlsd_get_platform_data(struct platform_device *pdev,
 
                amlsd_get_host_caps(child, pdata);
                amlsd_get_host_caps2(child, pdata);
+               amlsd_get_host_pm_caps(child, pdata);
                pdata->port_init = of_amlsd_init;
 #ifdef CARD_DETECT_IRQ
                pdata->irq_init = of_amlsd_irq_init;
index 0d4e24d..9fa73a8 100644 (file)
@@ -264,6 +264,7 @@ struct amlsd_platform {
        struct delayed_work cd_detect;
        unsigned int caps;
        unsigned int caps2;
+       unsigned int pm_caps;
        unsigned int card_capacity;
        unsigned int tx_phase;
        unsigned int tx_delay;