aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-05-14 09:24:45 -0400
committerArnd Bergmann <arnd@arndb.de>2012-05-14 09:28:19 -0400
commit304ea74770c892cf115e128b0e0dc6636148b010 (patch)
treeccf06fa8a8fa9321beaab730ac19160966033d52 /drivers/mmc
parente29402edf848359d619ce06af86d61e62c292c87 (diff)
parent6b204283f2802a92cf91fc14c2c1b04e7295761b (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.c39
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c42
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 {
136 u16 rev_no; 136 u16 rev_no;
137 unsigned int cmdat; 137 unsigned int cmdat;
138 138
139 struct clk *clk; 139 struct clk *clk_ipg;
140 struct clk *clk_per;
140 141
141 int clock; 142 int clock;
142 143
@@ -672,7 +673,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios)
672{ 673{
673 unsigned int divider; 674 unsigned int divider;
674 int prescaler = 0; 675 int prescaler = 0;
675 unsigned int clk_in = clk_get_rate(host->clk); 676 unsigned int clk_in = clk_get_rate(host->clk_per);
676 677
677 while (prescaler <= 0x800) { 678 while (prescaler <= 0x800) {
678 for (divider = 1; divider <= 0xF; divider++) { 679 for (divider = 1; divider <= 0xF; divider++) {
@@ -900,12 +901,20 @@ static int mxcmci_probe(struct platform_device *pdev)
900 host->res = r; 901 host->res = r;
901 host->irq = irq; 902 host->irq = irq;
902 903
903 host->clk = clk_get(&pdev->dev, NULL); 904 host->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
904 if (IS_ERR(host->clk)) { 905 if (IS_ERR(host->clk_ipg)) {
905 ret = PTR_ERR(host->clk); 906 ret = PTR_ERR(host->clk_ipg);
906 goto out_iounmap; 907 goto out_iounmap;
907 } 908 }
908 clk_enable(host->clk); 909
910 host->clk_per = devm_clk_get(&pdev->dev, "per");
911 if (IS_ERR(host->clk_per)) {
912 ret = PTR_ERR(host->clk_per);
913 goto out_iounmap;
914 }
915
916 clk_prepare_enable(host->clk_per);
917 clk_prepare_enable(host->clk_ipg);
909 918
910 mxcmci_softreset(host); 919 mxcmci_softreset(host);
911 920
@@ -917,8 +926,8 @@ static int mxcmci_probe(struct platform_device *pdev)
917 goto out_clk_put; 926 goto out_clk_put;
918 } 927 }
919 928
920 mmc->f_min = clk_get_rate(host->clk) >> 16; 929 mmc->f_min = clk_get_rate(host->clk_per) >> 16;
921 mmc->f_max = clk_get_rate(host->clk) >> 1; 930 mmc->f_max = clk_get_rate(host->clk_per) >> 1;
922 931
923 /* recommended in data sheet */ 932 /* recommended in data sheet */
924 writew(0x2db4, host->base + MMC_REG_READ_TO); 933 writew(0x2db4, host->base + MMC_REG_READ_TO);
@@ -967,8 +976,8 @@ out_free_dma:
967 if (host->dma) 976 if (host->dma)
968 dma_release_channel(host->dma); 977 dma_release_channel(host->dma);
969out_clk_put: 978out_clk_put:
970 clk_disable(host->clk); 979 clk_disable_unprepare(host->clk_per);
971 clk_put(host->clk); 980 clk_disable_unprepare(host->clk_ipg);
972out_iounmap: 981out_iounmap:
973 iounmap(host->base); 982 iounmap(host->base);
974out_free: 983out_free:
@@ -999,8 +1008,8 @@ static int mxcmci_remove(struct platform_device *pdev)
999 if (host->dma) 1008 if (host->dma)
1000 dma_release_channel(host->dma); 1009 dma_release_channel(host->dma);
1001 1010
1002 clk_disable(host->clk); 1011 clk_disable_unprepare(host->clk_per);
1003 clk_put(host->clk); 1012 clk_disable_unprepare(host->clk_ipg);
1004 1013
1005 release_mem_region(host->res->start, resource_size(host->res)); 1014 release_mem_region(host->res->start, resource_size(host->res));
1006 1015
@@ -1018,7 +1027,8 @@ static int mxcmci_suspend(struct device *dev)
1018 1027
1019 if (mmc) 1028 if (mmc)
1020 ret = mmc_suspend_host(mmc); 1029 ret = mmc_suspend_host(mmc);
1021 clk_disable(host->clk); 1030 clk_disable_unprepare(host->clk_per);
1031 clk_disable_unprepare(host->clk_ipg);
1022 1032
1023 return ret; 1033 return ret;
1024} 1034}
@@ -1029,7 +1039,8 @@ static int mxcmci_resume(struct device *dev)
1029 struct mxcmci_host *host = mmc_priv(mmc); 1039 struct mxcmci_host *host = mmc_priv(mmc);
1030 int ret = 0; 1040 int ret = 0;
1031 1041
1032 clk_enable(host->clk); 1042 clk_prepare_enable(host->clk_per);
1043 clk_prepare_enable(host->clk_ipg);
1033 if (mmc) 1044 if (mmc)
1034 ret = mmc_resume_host(mmc); 1045 ret = mmc_resume_host(mmc);
1035 1046
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 {
71 enum imx_esdhc_type devtype; 71 enum imx_esdhc_type devtype;
72 struct pinctrl *pinctrl; 72 struct pinctrl *pinctrl;
73 struct esdhc_platform_data boarddata; 73 struct esdhc_platform_data boarddata;
74 struct clk *clk_ipg;
75 struct clk *clk_ahb;
76 struct clk *clk_per;
74}; 77};
75 78
76static struct platform_device_id imx_esdhc_devtype[] = { 79static struct platform_device_id imx_esdhc_devtype[] = {
@@ -439,7 +442,6 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
439 struct sdhci_pltfm_host *pltfm_host; 442 struct sdhci_pltfm_host *pltfm_host;
440 struct sdhci_host *host; 443 struct sdhci_host *host;
441 struct esdhc_platform_data *boarddata; 444 struct esdhc_platform_data *boarddata;
442 struct clk *clk;
443 int err; 445 int err;
444 struct pltfm_imx_data *imx_data; 446 struct pltfm_imx_data *imx_data;
445 447
@@ -460,14 +462,29 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
460 imx_data->devtype = pdev->id_entry->driver_data; 462 imx_data->devtype = pdev->id_entry->driver_data;
461 pltfm_host->priv = imx_data; 463 pltfm_host->priv = imx_data;
462 464
463 clk = clk_get(mmc_dev(host->mmc), NULL); 465 imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
464 if (IS_ERR(clk)) { 466 if (IS_ERR(imx_data->clk_ipg)) {
465 dev_err(mmc_dev(host->mmc), "clk err\n"); 467 err = PTR_ERR(imx_data->clk_ipg);
466 err = PTR_ERR(clk);
467 goto err_clk_get; 468 goto err_clk_get;
468 } 469 }
469 clk_prepare_enable(clk); 470
470 pltfm_host->clk = clk; 471 imx_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
472 if (IS_ERR(imx_data->clk_ahb)) {
473 err = PTR_ERR(imx_data->clk_ahb);
474 goto err_clk_get;
475 }
476
477 imx_data->clk_per = devm_clk_get(&pdev->dev, "per");
478 if (IS_ERR(imx_data->clk_per)) {
479 err = PTR_ERR(imx_data->clk_per);
480 goto err_clk_get;
481 }
482
483 pltfm_host->clk = imx_data->clk_per;
484
485 clk_prepare_enable(imx_data->clk_per);
486 clk_prepare_enable(imx_data->clk_ipg);
487 clk_prepare_enable(imx_data->clk_ahb);
471 488
472 imx_data->pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 489 imx_data->pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
473 if (IS_ERR(imx_data->pinctrl)) { 490 if (IS_ERR(imx_data->pinctrl)) {
@@ -567,8 +584,9 @@ no_card_detect_irq:
567no_card_detect_pin: 584no_card_detect_pin:
568no_board_data: 585no_board_data:
569pin_err: 586pin_err:
570 clk_disable_unprepare(pltfm_host->clk); 587 clk_disable_unprepare(imx_data->clk_per);
571 clk_put(pltfm_host->clk); 588 clk_disable_unprepare(imx_data->clk_ipg);
589 clk_disable_unprepare(imx_data->clk_ahb);
572err_clk_get: 590err_clk_get:
573 kfree(imx_data); 591 kfree(imx_data);
574err_imx_data: 592err_imx_data:
@@ -594,8 +612,10 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev)
594 gpio_free(boarddata->cd_gpio); 612 gpio_free(boarddata->cd_gpio);
595 } 613 }
596 614
597 clk_disable_unprepare(pltfm_host->clk); 615 clk_disable_unprepare(imx_data->clk_per);
598 clk_put(pltfm_host->clk); 616 clk_disable_unprepare(imx_data->clk_ipg);
617 clk_disable_unprepare(imx_data->clk_ahb);
618
599 kfree(imx_data); 619 kfree(imx_data);
600 620
601 sdhci_pltfm_free(pdev); 621 sdhci_pltfm_free(pdev);