]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge tag 'mmc-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 May 2017 15:21:56 +0000 (08:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 May 2017 15:21:56 +0000 (08:21 -0700)
Pull MMC fixes from Ulf Hansson:
 "A couple of MMC host fixes intended for v4.12 rc3:

   - sdhci-xenon: Don't free data for phy allocated by devm*
   - sdhci-iproc: Suppress spurious interrupts
   - cavium: Fix probing race with regulator
   - cavium: Prevent crash with incomplete DT
   - cavium-octeon: Use proper GPIO name for power control
   - cavium-octeon: Fix interrupt enable code"

* tag 'mmc-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: sdhci-iproc: suppress spurious interrupt with Multiblock read
  mmc: cavium: Fix probing race with regulator
  of/platform: Make of_platform_device_destroy globally visible
  mmc: cavium: Prevent crash with incomplete DT
  mmc: cavium-octeon: Use proper GPIO name for power control
  mmc: cavium-octeon: Fix interrupt enable code
  mmc: sdhci-xenon: kill xenon_clean_phy()

drivers/mmc/host/cavium-octeon.c
drivers/mmc/host/cavium-thunderx.c
drivers/mmc/host/cavium.c
drivers/mmc/host/sdhci-iproc.c
drivers/mmc/host/sdhci-xenon-phy.c
drivers/mmc/host/sdhci-xenon.c
drivers/mmc/host/sdhci-xenon.h
drivers/of/platform.c
include/linux/of_platform.h

index 772d0900026d0efbd6e59911f93ef9cc8930b38a..951d2cdd7888b0d68f9994298572759162277682 100644 (file)
@@ -108,7 +108,7 @@ static void octeon_mmc_release_bus(struct cvm_mmc_host *host)
 static void octeon_mmc_int_enable(struct cvm_mmc_host *host, u64 val)
 {
        writeq(val, host->base + MIO_EMM_INT(host));
-       if (!host->dma_active || (host->dma_active && !host->has_ciu3))
+       if (!host->has_ciu3)
                writeq(val, host->base + MIO_EMM_INT_EN(host));
 }
 
@@ -267,7 +267,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)
        }
 
        host->global_pwr_gpiod = devm_gpiod_get_optional(&pdev->dev,
-                                                        "power-gpios",
+                                                        "power",
                                                         GPIOD_OUT_HIGH);
        if (IS_ERR(host->global_pwr_gpiod)) {
                dev_err(&pdev->dev, "Invalid power GPIO\n");
@@ -288,11 +288,20 @@ static int octeon_mmc_probe(struct platform_device *pdev)
                if (ret) {
                        dev_err(&pdev->dev, "Error populating slots\n");
                        octeon_mmc_set_shared_power(host, 0);
-                       return ret;
+                       goto error;
                }
                i++;
        }
        return 0;
+
+error:
+       for (i = 0; i < CAVIUM_MAX_MMC; i++) {
+               if (host->slot[i])
+                       cvm_mmc_of_slot_remove(host->slot[i]);
+               if (host->slot_pdev[i])
+                       of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
+       }
+       return ret;
 }
 
 static int octeon_mmc_remove(struct platform_device *pdev)
index fe3d77267cd6b7803ae287d8b6fc5fc308f95a87..b9cc9599879978972b4c8c96f9dbddc26caebb2f 100644 (file)
@@ -146,6 +146,12 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
        return 0;
 
 error:
+       for (i = 0; i < CAVIUM_MAX_MMC; i++) {
+               if (host->slot[i])
+                       cvm_mmc_of_slot_remove(host->slot[i]);
+               if (host->slot_pdev[i])
+                       of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
+       }
        clk_disable_unprepare(host->clk);
        return ret;
 }
index 58b51ba6aabd2de7773209d42aa758cb493c2500..b8aaf0fdb77cf52bf89cd3000a98b77536a6f5a4 100644 (file)
@@ -839,14 +839,14 @@ static void cvm_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                cvm_mmc_reset_bus(slot);
                if (host->global_pwr_gpiod)
                        host->set_shared_power(host, 0);
-               else
+               else if (!IS_ERR(mmc->supply.vmmc))
                        mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
                break;
 
        case MMC_POWER_UP:
                if (host->global_pwr_gpiod)
                        host->set_shared_power(host, 1);
-               else
+               else if (!IS_ERR(mmc->supply.vmmc))
                        mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
                break;
        }
@@ -968,20 +968,15 @@ static int cvm_mmc_of_parse(struct device *dev, struct cvm_mmc_slot *slot)
                return -EINVAL;
        }
 
-       mmc->supply.vmmc = devm_regulator_get_optional(dev, "vmmc");
-       if (IS_ERR(mmc->supply.vmmc)) {
-               if (PTR_ERR(mmc->supply.vmmc) == -EPROBE_DEFER)
-                       return -EPROBE_DEFER;
-               /*
-                * Legacy Octeon firmware has no regulator entry, fall-back to
-                * a hard-coded voltage to get a sane OCR.
-                */
+       ret = mmc_regulator_get_supply(mmc);
+       if (ret == -EPROBE_DEFER)
+               return ret;
+       /*
+        * Legacy Octeon firmware has no regulator entry, fall-back to
+        * a hard-coded voltage to get a sane OCR.
+        */
+       if (IS_ERR(mmc->supply.vmmc))
                mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-       } else {
-               ret = mmc_regulator_get_ocrmask(mmc->supply.vmmc);
-               if (ret > 0)
-                       mmc->ocr_avail = ret;
-       }
 
        /* Common MMC bindings */
        ret = mmc_of_parse(mmc);
index 3275d49958120857d899384237bc905ad5fd17a5..61666d2697713a7665191b848084846142644457 100644 (file)
@@ -187,7 +187,8 @@ static const struct sdhci_iproc_data iproc_cygnus_data = {
 };
 
 static const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = {
-       .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
+       .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
+                 SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
        .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN,
        .ops = &sdhci_iproc_ops,
 };
index 6356781f1cca78190bff46e5225606e0f2113cc7..f7e26b031e768d871ed465cde982005295066e82 100644 (file)
@@ -787,14 +787,6 @@ int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios)
        return ret;
 }
 
-void xenon_clean_phy(struct sdhci_host *host)
-{
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-       struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
-
-       kfree(priv->phy_params);
-}
-
 static int xenon_add_phy(struct device_node *np, struct sdhci_host *host,
                         const char *phy_name)
 {
@@ -819,11 +811,7 @@ static int xenon_add_phy(struct device_node *np, struct sdhci_host *host,
        if (ret)
                return ret;
 
-       ret = xenon_emmc_phy_parse_param_dt(host, np, priv->phy_params);
-       if (ret)
-               xenon_clean_phy(host);
-
-       return ret;
+       return xenon_emmc_phy_parse_param_dt(host, np, priv->phy_params);
 }
 
 int xenon_phy_parse_dt(struct device_node *np, struct sdhci_host *host)
index 67246655315b02b005b00153abfaa60c67fca7a5..bc1781bb070b7b8b83c0132abb114f6905ffddfb 100644 (file)
@@ -486,7 +486,7 @@ static int xenon_probe(struct platform_device *pdev)
 
        err = xenon_sdhc_prepare(host);
        if (err)
-               goto clean_phy_param;
+               goto err_clk;
 
        err = sdhci_add_host(host);
        if (err)
@@ -496,8 +496,6 @@ static int xenon_probe(struct platform_device *pdev)
 
 remove_sdhc:
        xenon_sdhc_unprepare(host);
-clean_phy_param:
-       xenon_clean_phy(host);
 err_clk:
        clk_disable_unprepare(pltfm_host->clk);
 free_pltfm:
@@ -510,8 +508,6 @@ static int xenon_remove(struct platform_device *pdev)
        struct sdhci_host *host = platform_get_drvdata(pdev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 
-       xenon_clean_phy(host);
-
        sdhci_remove_host(host, 0);
 
        xenon_sdhc_unprepare(host);
index 6e6523ea01ce50389f3b77f52b467efb11305831..73debb42dc2f9991356f59668d18ebd09296f927 100644 (file)
@@ -93,7 +93,6 @@ struct xenon_priv {
 };
 
 int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios);
-void xenon_clean_phy(struct sdhci_host *host);
 int xenon_phy_parse_dt(struct device_node *np,
                       struct sdhci_host *host);
 void xenon_soc_pad_ctrl(struct sdhci_host *host,
index 71fecc2debfc940affba38afc6c912f3a4aa8b4b..703a42118ffc907571f2da5300639b725c2d529f 100644 (file)
@@ -523,7 +523,7 @@ static int __init of_platform_default_populate_init(void)
 arch_initcall_sync(of_platform_default_populate_init);
 #endif
 
-static int of_platform_device_destroy(struct device *dev, void *data)
+int of_platform_device_destroy(struct device *dev, void *data)
 {
        /* Do not touch devices not populated from the device tree */
        if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED))
@@ -544,6 +544,7 @@ static int of_platform_device_destroy(struct device *dev, void *data)
        of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);
        return 0;
 }
+EXPORT_SYMBOL_GPL(of_platform_device_destroy);
 
 /**
  * of_platform_depopulate() - Remove devices populated from device tree
index dc8224ae28d5d9e6106dc0d06a8a9bc2eb85fd0a..e0d1946270f38e5238ddf0a3bb25cf03c3f3ebe4 100644 (file)
@@ -64,6 +64,7 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
                                                   const char *bus_id,
                                                   struct device *parent);
 
+extern int of_platform_device_destroy(struct device *dev, void *data);
 extern int of_platform_bus_probe(struct device_node *root,
                                 const struct of_device_id *matches,
                                 struct device *parent);