diff options
author | Josh Cartwright <joshc@codeaurora.org> | 2014-08-11 09:33:49 -0500 |
---|---|---|
committer | Subhash Jadavani <subhashj@codeaurora.org> | 2016-05-19 18:35:49 -0700 |
commit | 708e9f009fd4f10d281c132c509c5f903ec1bd31 (patch) | |
tree | 808c51ff171ddf23c4f949b35a6d0585c293c20b /drivers/mmc | |
parent | d51a3603b4c53412002b356f6c7f3d9363229704 (diff) |
HACK: mmc: sdhci-msm: setup vdd and vdd-io supplies
Change-Id: Ifd906146eb61d413880693ec7f306067895f5dac
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci-msm.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index f6c6bd303050..9929f6da1373 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -63,6 +63,8 @@ struct sdhci_msm_host { struct clk *bus_clk; /* SDHC bus voter clock */ struct mmc_host *mmc; struct sdhci_pltfm_data sdhci_msm_pdata; + struct regulator *vdd; + struct regulator *vdd_io; }; /* Platform specific tuning */ @@ -459,16 +461,66 @@ static int sdhci_msm_probe(struct platform_device *pdev) sdhci_get_of_property(pdev); + msm_host->vdd = devm_regulator_get(&pdev->dev, "vdd"); + if (IS_ERR(msm_host->vdd)) { + ret = PTR_ERR(msm_host->vdd); + dev_err(&pdev->dev, "VDD regulator setup failed (%d)\n", ret); + goto pltfm_free; + } + + msm_host->vdd_io = devm_regulator_get(&pdev->dev, "vdd-io"); + if (IS_ERR(msm_host->vdd_io)) { + ret = PTR_ERR(msm_host->vdd_io); + dev_err(&pdev->dev, "VDD-IO regulator setup failed (%d)\n", ret); + goto pltfm_free; + } + + ret = regulator_set_optimum_mode(msm_host->vdd, 500000); + if (ret < 0) { + dev_err(&pdev->dev, "VDD setting current load failed (%d)\n", ret); + goto pltfm_free; + } + + ret = regulator_set_optimum_mode(msm_host->vdd_io, 154000); + if (ret < 0) { + dev_err(&pdev->dev, "VDD-IO setting current load failed (%d)\n", ret); + goto pltfm_free; + } + + ret = regulator_set_voltage(msm_host->vdd, 2950000, 2950000); + if (ret) { + dev_err(&pdev->dev, "VDD setting voltage failed (%d)\n", ret); + goto pltfm_free; + } + + ret = regulator_set_voltage(msm_host->vdd_io, 1800000, 1800000); + if (ret) { + dev_err(&pdev->dev, "VDD-IO setting voltage failed (%d)\n", ret); + goto pltfm_free; + } + + ret = regulator_enable(msm_host->vdd); + if (ret) { + dev_err(&pdev->dev, "VDD enabling regulator failed (%d)\n", ret); + goto pltfm_free; + } + + ret = regulator_enable(msm_host->vdd_io); + if (ret) { + dev_err(&pdev->dev, "VDD-IO enabling regulator failed (%d)\n", ret); + goto reg_vdd_disable; + } + /* Setup SDCC bus voter clock. */ msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus_clk"); if (!IS_ERR(msm_host->bus_clk)) { /* Vote for max. clk rate for max. performance */ ret = clk_set_rate(msm_host->bus_clk, INT_MAX); if (ret) - goto pltfm_free; + goto reg_vdd_io_disable; ret = clk_prepare_enable(msm_host->bus_clk); if (ret) - goto pltfm_free; + goto reg_vdd_io_disable; } /* Setup main peripheral bus clock */ @@ -569,6 +621,10 @@ pclk_disable: bus_clk_disable: if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); +reg_vdd_io_disable: + regulator_disable(msm_host->vdd_io); +reg_vdd_disable: + regulator_disable(msm_host->vdd); pltfm_free: sdhci_pltfm_free(pdev); return ret; |