diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-26 15:42:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-26 15:42:29 -0400 |
commit | 27953437059c64d14086196eb96f43c78caa9db3 (patch) | |
tree | 0cfd5fb21262a6db3de0c64462847b4c0c43e9df /drivers/mmc | |
parent | 2c757fd5d1a92086f225a75a8fac7cab242d11b0 (diff) | |
parent | 3c0dec5f58b3c7b3627715126d1bf9b030a076f0 (diff) |
Merge tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm-soc clock driver changes from Olof Johansson:
"The new clock subsystem was merged in linux-3.4 without any users,
this now moves the first three platforms over to it: imx, mxs and
spear.
The series also contains the changes for the clock subsystem itself,
since Mike preferred to have it together with the platforms that
require these changes, in order to avoid interdependencies and
conflicts."
Fix up trivial conflicts in arch/arm/mach-kirkwood/common.c (code
removed in one branch, added OF support in another) and
drivers/dma/imx-sdma.c (independent changes next to each other).
* tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (97 commits)
clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().
clk: Provide dummy clk_unregister()
SPEAr: Update defconfigs
SPEAr: Add SMI NOR partition info in dts files
SPEAr: Switch to common clock framework
SPEAr: Call clk_prepare() before calling clk_enable
SPEAr: clk: Add General Purpose Timer Synthesizer clock
SPEAr: clk: Add Fractional Synthesizer clock
SPEAr: clk: Add Auxiliary Synthesizer clock
SPEAr: clk: Add VCO-PLL Synthesizer clock
SPEAr: Add DT bindings for SPEAr's timer
ARM i.MX: remove now unused clock files
ARM: i.MX6: implement clocks using common clock framework
ARM i.MX35: implement clocks using common clock framework
ARM i.MX5: implement clocks using common clock framework
ARM: Kirkwood: Replace clock gating
ARM: Orion: Audio: Add clk/clkdev support
ARM: Orion: PCIE: Add support for clk
ARM: Orion: XOR: Add support for clk
ARM: Orion: CESA: Add support for clk
...
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/mvsdio.c | 14 | ||||
-rw-r--r-- | drivers/mmc/host/mxcmmc.c | 39 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 42 |
3 files changed, 70 insertions, 25 deletions
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index eeb8cd125b0c..3b9136c1a475 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/scatterlist.h> | 20 | #include <linux/scatterlist.h> |
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/clk.h> | ||
22 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
23 | #include <linux/mmc/host.h> | 24 | #include <linux/mmc/host.h> |
24 | 25 | ||
@@ -51,6 +52,7 @@ struct mvsd_host { | |||
51 | struct device *dev; | 52 | struct device *dev; |
52 | struct resource *res; | 53 | struct resource *res; |
53 | int irq; | 54 | int irq; |
55 | struct clk *clk; | ||
54 | int gpio_card_detect; | 56 | int gpio_card_detect; |
55 | int gpio_write_protect; | 57 | int gpio_write_protect; |
56 | }; | 58 | }; |
@@ -770,6 +772,13 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
770 | } else | 772 | } else |
771 | host->irq = irq; | 773 | host->irq = irq; |
772 | 774 | ||
775 | /* Not all platforms can gate the clock, so it is not | ||
776 | an error if the clock does not exists. */ | ||
777 | host->clk = clk_get(&pdev->dev, NULL); | ||
778 | if (!IS_ERR(host->clk)) { | ||
779 | clk_prepare_enable(host->clk); | ||
780 | } | ||
781 | |||
773 | if (mvsd_data->gpio_card_detect) { | 782 | if (mvsd_data->gpio_card_detect) { |
774 | ret = gpio_request(mvsd_data->gpio_card_detect, | 783 | ret = gpio_request(mvsd_data->gpio_card_detect, |
775 | DRIVER_NAME " cd"); | 784 | DRIVER_NAME " cd"); |
@@ -854,6 +863,11 @@ static int __exit mvsd_remove(struct platform_device *pdev) | |||
854 | mvsd_power_down(host); | 863 | mvsd_power_down(host); |
855 | iounmap(host->base); | 864 | iounmap(host->base); |
856 | release_resource(host->res); | 865 | release_resource(host->res); |
866 | |||
867 | if (!IS_ERR(host->clk)) { | ||
868 | clk_disable_unprepare(host->clk); | ||
869 | clk_put(host->clk); | ||
870 | } | ||
857 | mmc_free_host(mmc); | 871 | mmc_free_host(mmc); |
858 | } | 872 | } |
859 | platform_set_drvdata(pdev, NULL); | 873 | platform_set_drvdata(pdev, NULL); |
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); |
969 | out_clk_put: | 978 | out_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); |
972 | out_iounmap: | 981 | out_iounmap: |
973 | iounmap(host->base); | 982 | iounmap(host->base); |
974 | out_free: | 983 | out_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 365b16c230f8..ebbe984e5d00 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 | ||
76 | static struct platform_device_id imx_esdhc_devtype[] = { | 79 | static 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: | |||
567 | no_card_detect_pin: | 584 | no_card_detect_pin: |
568 | no_board_data: | 585 | no_board_data: |
569 | pin_err: | 586 | pin_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); | ||
572 | err_clk_get: | 590 | err_clk_get: |
573 | kfree(imx_data); | 591 | kfree(imx_data); |
574 | err_imx_data: | 592 | err_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); |