diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-05-14 15:24:45 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-05-14 15:28:19 +0200 |
commit | 304ea74770c892cf115e128b0e0dc6636148b010 (patch) | |
tree | ccf06fa8a8fa9321beaab730ac19160966033d52 /drivers/mmc | |
parent | e29402edf848359d619ce06af86d61e62c292c87 (diff) | |
parent | 6b204283f2802a92cf91fc14c2c1b04e7295761b (diff) |
Merge branch 'imx/dt/for-3.5' of git://git.linaro.org/people/shawnguo/linux-2.6.git into next/dt2
Shawn Guo <shawn.guo@linaro.org> writes:
I chose to base it on Sascha's imx-common-clk series than -rc, because
otherwise it will keep patching clock file that has been removed by
imx-common-clk series. It also depends on imx-pinctrl pull-request
I just sent to be functional.
Note: when imx-common-clk and imx-pinctrl get merged together, the
following files will have conflicts. But the conflicts should not be
so hard to resolve.
[arnd: resolved those merge conflicts by pulling pinctrl branch]
* imx/dt: (24 commits)
ARM: dts: imx53-qsb: enable audio support
ARM: dts: imx51-babbage: enable audio support
ARM: imx: add audio codec clk lookup for imx53-qsb
ARM: imx: add audmux pad setting for imx51-babbage
ARM: imx: add more imx5 ssi clocks
ARM: dts: imx53-qsb: Add Dialog DA9053 PMIC support
ARM: dts: imx6q-sabrelite: add serial2 pinctrl support
ARM: dts: imx6q-sabrelite: add sound device imx6q-sabrelite-sgtl5000
ARM: imx6q_sabrelite: clk_register_clkdev cko1 for sgtl5000
ARM: imx6q: add ssi1_ipg clk_lookup
ARM: dts: imx6q-sabrelite: add audmux pinctrl support
ARM: dts: imx6q-sabrelite: add i2c1 pinctrl support
ARM: dts: imx6q-sabrelite: add audmux device
ARM: dts: imx6q-sabrelite: add ssi device
ARM: dts: imx6q-arm2: add pinctrl state for usdhc
ARM: imx6: Add UART2 for low-level debug
ARM: imx6q: register phy fixup only when CONFIG_PHYLIB is enabled
ARM: imx6q: move imx6q_sabrelite specific code to a dedicated function
ARM: dts: imx6q-sabrelite: Add SPI NOR support
ARM: dts: Add basic support for imx6q-sabresd
...
Pulls in imx/pinctrl and imx/clock as dependencies.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/mxcmmc.c | 39 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 42 |
2 files changed, 56 insertions, 25 deletions
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index b2058b432320..28ed52d58f7f 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -136,7 +136,8 @@ struct mxcmci_host { u16 rev_no; unsigned int cmdat; - struct clk *clk; + struct clk *clk_ipg; + struct clk *clk_per; int clock; @@ -672,7 +673,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) { unsigned int divider; int prescaler = 0; - unsigned int clk_in = clk_get_rate(host->clk); + unsigned int clk_in = clk_get_rate(host->clk_per); while (prescaler <= 0x800) { for (divider = 1; divider <= 0xF; divider++) { @@ -900,12 +901,20 @@ static int mxcmci_probe(struct platform_device *pdev) host->res = r; host->irq = irq; - host->clk = clk_get(&pdev->dev, NULL); - if (IS_ERR(host->clk)) { - ret = PTR_ERR(host->clk); + host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); + if (IS_ERR(host->clk_ipg)) { + ret = PTR_ERR(host->clk_ipg); goto out_iounmap; } - clk_enable(host->clk); + + host->clk_per = devm_clk_get(&pdev->dev, "per"); + if (IS_ERR(host->clk_per)) { + ret = PTR_ERR(host->clk_per); + goto out_iounmap; + } + + clk_prepare_enable(host->clk_per); + clk_prepare_enable(host->clk_ipg); mxcmci_softreset(host); @@ -917,8 +926,8 @@ static int mxcmci_probe(struct platform_device *pdev) goto out_clk_put; } - mmc->f_min = clk_get_rate(host->clk) >> 16; - mmc->f_max = clk_get_rate(host->clk) >> 1; + mmc->f_min = clk_get_rate(host->clk_per) >> 16; + mmc->f_max = clk_get_rate(host->clk_per) >> 1; /* recommended in data sheet */ writew(0x2db4, host->base + MMC_REG_READ_TO); @@ -967,8 +976,8 @@ out_free_dma: if (host->dma) dma_release_channel(host->dma); out_clk_put: - clk_disable(host->clk); - clk_put(host->clk); + clk_disable_unprepare(host->clk_per); + clk_disable_unprepare(host->clk_ipg); out_iounmap: iounmap(host->base); out_free: @@ -999,8 +1008,8 @@ static int mxcmci_remove(struct platform_device *pdev) if (host->dma) dma_release_channel(host->dma); - clk_disable(host->clk); - clk_put(host->clk); + clk_disable_unprepare(host->clk_per); + clk_disable_unprepare(host->clk_ipg); release_mem_region(host->res->start, resource_size(host->res)); @@ -1018,7 +1027,8 @@ static int mxcmci_suspend(struct device *dev) if (mmc) ret = mmc_suspend_host(mmc); - clk_disable(host->clk); + clk_disable_unprepare(host->clk_per); + clk_disable_unprepare(host->clk_ipg); return ret; } @@ -1029,7 +1039,8 @@ static int mxcmci_resume(struct device *dev) struct mxcmci_host *host = mmc_priv(mmc); int ret = 0; - clk_enable(host->clk); + clk_prepare_enable(host->clk_per); + clk_prepare_enable(host->clk_ipg); if (mmc) ret = mmc_resume_host(mmc); diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index d190d04636a7..6b0e3f33ede3 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -71,6 +71,9 @@ struct pltfm_imx_data { enum imx_esdhc_type devtype; struct pinctrl *pinctrl; struct esdhc_platform_data boarddata; + struct clk *clk_ipg; + struct clk *clk_ahb; + struct clk *clk_per; }; static struct platform_device_id imx_esdhc_devtype[] = { @@ -439,7 +442,6 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) struct sdhci_pltfm_host *pltfm_host; struct sdhci_host *host; struct esdhc_platform_data *boarddata; - struct clk *clk; int err; struct pltfm_imx_data *imx_data; @@ -460,14 +462,29 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) imx_data->devtype = pdev->id_entry->driver_data; pltfm_host->priv = imx_data; - clk = clk_get(mmc_dev(host->mmc), NULL); - if (IS_ERR(clk)) { - dev_err(mmc_dev(host->mmc), "clk err\n"); - err = PTR_ERR(clk); + imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); + if (IS_ERR(imx_data->clk_ipg)) { + err = PTR_ERR(imx_data->clk_ipg); goto err_clk_get; } - clk_prepare_enable(clk); - pltfm_host->clk = clk; + + imx_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); + if (IS_ERR(imx_data->clk_ahb)) { + err = PTR_ERR(imx_data->clk_ahb); + goto err_clk_get; + } + + imx_data->clk_per = devm_clk_get(&pdev->dev, "per"); + if (IS_ERR(imx_data->clk_per)) { + err = PTR_ERR(imx_data->clk_per); + goto err_clk_get; + } + + pltfm_host->clk = imx_data->clk_per; + + clk_prepare_enable(imx_data->clk_per); + clk_prepare_enable(imx_data->clk_ipg); + clk_prepare_enable(imx_data->clk_ahb); imx_data->pinctrl = devm_pinctrl_get_select_default(&pdev->dev); if (IS_ERR(imx_data->pinctrl)) { @@ -567,8 +584,9 @@ no_card_detect_irq: no_card_detect_pin: no_board_data: pin_err: - clk_disable_unprepare(pltfm_host->clk); - clk_put(pltfm_host->clk); + clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_ipg); + clk_disable_unprepare(imx_data->clk_ahb); err_clk_get: kfree(imx_data); err_imx_data: @@ -594,8 +612,10 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev) gpio_free(boarddata->cd_gpio); } - clk_disable_unprepare(pltfm_host->clk); - clk_put(pltfm_host->clk); + clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_ipg); + clk_disable_unprepare(imx_data->clk_ahb); + kfree(imx_data); sdhci_pltfm_free(pdev); |