mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
arm-soc: clock driver changes
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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJPuexPAAoJEIwa5zzehBx3YBsP/0nFhXjb5t1PdLfFzGKtcZVB j4zXWXMHQ1fA7wIfEpZF3Nnco6MQkufF5wJPoPdn1+wmkzCn3D6IwNVWVtW4U5i9 VGyShSbgusAAYXUe/9yYj8eN+bbRQSvdN4eWYWU6+rRXShGZ5dZZmp+IPNl54dnW 6F8uCnHX0cnIMCpGqV+41zZgZ/4wL2k9gdqu0LO6pi07o4tGd0Z4gcySgUFAnn1R kofNHueYIP4UgOg8DREoBzVKlpRqMou3S2kSZUfMeb3Q9ryF7UIvaGqIILyi7PKL kWd3nptg0EPavfL21SwXHiGpnDpB/Gj/F70kcPLus5RYujB24C9bvBmc26z68NZx Sz9mbElkkIU5duZsl1nxBWJ8IZ/tSWdtmC2xQMznmV7gHyGgVwr4j47f4Uv5sBvM 14JHDO7mqN6E6FnTFZu/oPAN5pDjgL+TVNK5BU6Wkq0zitrA6eyKDqCvBCqkO6Nn tNzOuyRDzMOwM7HzqXhxqtzJWXylO1Mldc4bM8X4Cocf4pnLna/X6uP6dgE6A+JY azVYx4I/0NdEPerDTzIcEhBDgZeBVROhUQr+kHxc4rf6WzUUbu/wEo1UKXWV66oW 1jb1yAFFWqYjkQuQc2PD4JSx35sFJaoSaoneRtmzBzRDfzSr5KjKj1E0e1skyMFq 7ZVLCqZD0cB9DhmMDkWP =rwFF -----END PGP SIGNATURE----- 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 ...
This commit is contained in:
commit
2795343705
151 changed files with 8310 additions and 14193 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/mmc/host.h>
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ struct mvsd_host {
|
|||
struct device *dev;
|
||||
struct resource *res;
|
||||
int irq;
|
||||
struct clk *clk;
|
||||
int gpio_card_detect;
|
||||
int gpio_write_protect;
|
||||
};
|
||||
|
|
@ -770,6 +772,13 @@ static int __init mvsd_probe(struct platform_device *pdev)
|
|||
} else
|
||||
host->irq = irq;
|
||||
|
||||
/* Not all platforms can gate the clock, so it is not
|
||||
an error if the clock does not exists. */
|
||||
host->clk = clk_get(&pdev->dev, NULL);
|
||||
if (!IS_ERR(host->clk)) {
|
||||
clk_prepare_enable(host->clk);
|
||||
}
|
||||
|
||||
if (mvsd_data->gpio_card_detect) {
|
||||
ret = gpio_request(mvsd_data->gpio_card_detect,
|
||||
DRIVER_NAME " cd");
|
||||
|
|
@ -854,6 +863,11 @@ static int __exit mvsd_remove(struct platform_device *pdev)
|
|||
mvsd_power_down(host);
|
||||
iounmap(host->base);
|
||||
release_resource(host->res);
|
||||
|
||||
if (!IS_ERR(host->clk)) {
|
||||
clk_disable_unprepare(host->clk);
|
||||
clk_put(host->clk);
|
||||
}
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue