Commit b6f1ffed authored by m-karicheri2@ti.com's avatar m-karicheri2@ti.com Committed by Sekhar Nori

ARM: davinci: convert platform code to use clk_prepare/clk_unprepare

As a first step towards migrating davinci platforms to use common clock
framework, replace all instances of clk_enable() with clk_prepare_enable()
and clk_disable() with clk_disable_unprepare(). Until the platform is
switched to use the CONFIG_HAVE_CLK_PREPARE Kconfig variable, this just
adds a might_sleep() call and would work without any issues.

This will make it easy later to switch to common clk based implementation
of clk driver from DaVinci specific driver.
Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
Reviewed-by: default avatarMike Turquette <mturquette@linaro.org>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 6f0c0580
...@@ -324,7 +324,7 @@ static __init void dm355_evm_init(void) ...@@ -324,7 +324,7 @@ static __init void dm355_evm_init(void)
if (IS_ERR(aemif)) if (IS_ERR(aemif))
WARN("%s: unable to get AEMIF clock\n", __func__); WARN("%s: unable to get AEMIF clock\n", __func__);
else else
clk_enable(aemif); clk_prepare_enable(aemif);
platform_add_devices(davinci_evm_devices, platform_add_devices(davinci_evm_devices,
ARRAY_SIZE(davinci_evm_devices)); ARRAY_SIZE(davinci_evm_devices));
......
...@@ -246,7 +246,7 @@ static __init void dm355_leopard_init(void) ...@@ -246,7 +246,7 @@ static __init void dm355_leopard_init(void)
if (IS_ERR(aemif)) if (IS_ERR(aemif))
WARN("%s: unable to get AEMIF clock\n", __func__); WARN("%s: unable to get AEMIF clock\n", __func__);
else else
clk_enable(aemif); clk_prepare_enable(aemif);
platform_add_devices(davinci_leopard_devices, platform_add_devices(davinci_leopard_devices,
ARRAY_SIZE(davinci_leopard_devices)); ARRAY_SIZE(davinci_leopard_devices));
......
...@@ -478,7 +478,7 @@ static void __init evm_init_cpld(void) ...@@ -478,7 +478,7 @@ static void __init evm_init_cpld(void)
aemif_clk = clk_get(NULL, "aemif"); aemif_clk = clk_get(NULL, "aemif");
if (IS_ERR(aemif_clk)) if (IS_ERR(aemif_clk))
return; return;
clk_enable(aemif_clk); clk_prepare_enable(aemif_clk);
if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE, if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE,
"cpld") == NULL) "cpld") == NULL)
...@@ -489,7 +489,7 @@ static void __init evm_init_cpld(void) ...@@ -489,7 +489,7 @@ static void __init evm_init_cpld(void)
SECTION_SIZE); SECTION_SIZE);
fail: fail:
pr_err("ERROR: can't map CPLD\n"); pr_err("ERROR: can't map CPLD\n");
clk_disable(aemif_clk); clk_disable_unprepare(aemif_clk);
return; return;
} }
......
...@@ -776,7 +776,7 @@ static __init void davinci_evm_init(void) ...@@ -776,7 +776,7 @@ static __init void davinci_evm_init(void)
struct davinci_soc_info *soc_info = &davinci_soc_info; struct davinci_soc_info *soc_info = &davinci_soc_info;
aemif_clk = clk_get(NULL, "aemif"); aemif_clk = clk_get(NULL, "aemif");
clk_enable(aemif_clk); clk_prepare_enable(aemif_clk);
if (HAS_ATA) { if (HAS_ATA) {
if (HAS_NAND || HAS_NOR) if (HAS_NAND || HAS_NOR)
......
...@@ -188,7 +188,7 @@ static __init void davinci_ntosd2_init(void) ...@@ -188,7 +188,7 @@ static __init void davinci_ntosd2_init(void)
struct davinci_soc_info *soc_info = &davinci_soc_info; struct davinci_soc_info *soc_info = &davinci_soc_info;
aemif_clk = clk_get(NULL, "aemif"); aemif_clk = clk_get(NULL, "aemif");
clk_enable(aemif_clk); clk_prepare_enable(aemif_clk);
if (HAS_ATA) { if (HAS_ATA) {
if (HAS_NAND) if (HAS_NAND)
......
...@@ -900,7 +900,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr) ...@@ -900,7 +900,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
if (IS_ERR(da850_sata_clk)) if (IS_ERR(da850_sata_clk))
return PTR_ERR(da850_sata_clk); return PTR_ERR(da850_sata_clk);
ret = clk_enable(da850_sata_clk); ret = clk_prepare_enable(da850_sata_clk);
if (ret) if (ret)
goto err0; goto err0;
...@@ -931,7 +931,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr) ...@@ -931,7 +931,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
return 0; return 0;
err1: err1:
clk_disable(da850_sata_clk); clk_disable_unprepare(da850_sata_clk);
err0: err0:
clk_put(da850_sata_clk); clk_put(da850_sata_clk);
return ret; return ret;
...@@ -939,7 +939,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr) ...@@ -939,7 +939,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
static void da850_sata_exit(struct device *dev) static void da850_sata_exit(struct device *dev)
{ {
clk_disable(da850_sata_clk); clk_disable_unprepare(da850_sata_clk);
clk_put(da850_sata_clk); clk_put(da850_sata_clk);
} }
......
...@@ -95,7 +95,7 @@ int __init davinci_serial_init(struct davinci_uart_config *info) ...@@ -95,7 +95,7 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
continue; continue;
} }
clk_enable(uart_clk); clk_prepare_enable(uart_clk);
p->uartclk = clk_get_rate(uart_clk); p->uartclk = clk_get_rate(uart_clk);
if (!p->membase && p->mapbase) { if (!p->membase && p->mapbase) {
......
...@@ -379,7 +379,7 @@ static void __init davinci_timer_init(void) ...@@ -379,7 +379,7 @@ static void __init davinci_timer_init(void)
timer_clk = clk_get(NULL, "timer0"); timer_clk = clk_get(NULL, "timer0");
BUG_ON(IS_ERR(timer_clk)); BUG_ON(IS_ERR(timer_clk));
clk_enable(timer_clk); clk_prepare_enable(timer_clk);
/* init timer hw */ /* init timer hw */
timer_init(); timer_init();
...@@ -429,7 +429,7 @@ void davinci_watchdog_reset(struct platform_device *pdev) ...@@ -429,7 +429,7 @@ void davinci_watchdog_reset(struct platform_device *pdev)
wd_clk = clk_get(&pdev->dev, NULL); wd_clk = clk_get(&pdev->dev, NULL);
if (WARN_ON(IS_ERR(wd_clk))) if (WARN_ON(IS_ERR(wd_clk)))
return; return;
clk_enable(wd_clk); clk_prepare_enable(wd_clk);
/* disable, internal clock source */ /* disable, internal clock source */
__raw_writel(0, base + TCR); __raw_writel(0, base + TCR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment