aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 17:44:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 17:44:15 -0500
commit979ecef5b89a8003902299566d9cdc08de34a3ee (patch)
tree2a695d557adab1dec5263f014789f5b59238bac8 /arch/arm
parente8cbce976050a9f874a8b07012ddeb9b9eb59603 (diff)
parent8c3b2296f1aa13d7504d2c09bc819cef3759562a (diff)
Merge tag 'clk' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
clock management changes for i.MX Another simple series related to clock management, this time only for imx. * tag 'clk' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: ARM: mxs: select HAVE_CLK_PREPARE for clock clk: add config option HAVE_CLK_PREPARE into Kconfig ASoC: mxs-saif: convert to clk_prepare/clk_unprepare video: mxsfb: convert to clk_prepare/clk_unprepare serial: mxs-auart: convert to clk_prepare/clk_unprepare net: flexcan: convert to clk_prepare/clk_unprepare mtd: gpmi-lib: convert to clk_prepare/clk_unprepare mmc: mxs-mmc: convert to clk_prepare/clk_unprepare dma: mxs-dma: convert to clk_prepare/clk_unprepare net: fec: add clk_prepare/clk_unprepare ARM: mxs: convert platform code to clk_prepare/clk_unprepare clk: add helper functions clk_prepare_enable and clk_disable_unprepare Fix up trivial conflicts in drivers/net/ethernet/freescale/fec.c due to commit 0ebafefcaa7a ("net: fec: add clk_prepare/clk_unprepare") clashing trivially with commit e163cc97f9ac ("net/fec: fix the .remove code").
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-mxs/clock-mx23.c10
-rw-r--r--arch/arm/mach-mxs/clock-mx28.c10
-rw-r--r--arch/arm/mach-mxs/clock.c33
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c2
-rw-r--r--arch/arm/mach-mxs/system.c2
-rw-r--r--arch/arm/mach-mxs/timer.c2
7 files changed, 37 insertions, 23 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b3d7b77d2d51..9d66dfc33a5a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -447,6 +447,7 @@ config ARCH_MXS
447 select ARCH_REQUIRE_GPIOLIB 447 select ARCH_REQUIRE_GPIOLIB
448 select CLKDEV_LOOKUP 448 select CLKDEV_LOOKUP
449 select CLKSRC_MMIO 449 select CLKSRC_MMIO
450 select HAVE_CLK_PREPARE
450 help 451 help
451 Support for Freescale MXS-based family of processors 452 Support for Freescale MXS-based family of processors
452 453
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index 0163b6d83773..e12e11231dc7 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -545,11 +545,11 @@ int __init mx23_clocks_init(void)
545 */ 545 */
546 clk_set_parent(&ssp_clk, &ref_io_clk); 546 clk_set_parent(&ssp_clk, &ref_io_clk);
547 547
548 clk_enable(&cpu_clk); 548 clk_prepare_enable(&cpu_clk);
549 clk_enable(&hbus_clk); 549 clk_prepare_enable(&hbus_clk);
550 clk_enable(&xbus_clk); 550 clk_prepare_enable(&xbus_clk);
551 clk_enable(&emi_clk); 551 clk_prepare_enable(&emi_clk);
552 clk_enable(&uart_clk); 552 clk_prepare_enable(&uart_clk);
553 553
554 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 554 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
555 555
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index df0ad3ce234b..5d68e4152220 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -804,11 +804,11 @@ int __init mx28_clocks_init(void)
804 clk_set_parent(&ssp0_clk, &ref_io0_clk); 804 clk_set_parent(&ssp0_clk, &ref_io0_clk);
805 clk_set_parent(&ssp1_clk, &ref_io0_clk); 805 clk_set_parent(&ssp1_clk, &ref_io0_clk);
806 806
807 clk_enable(&cpu_clk); 807 clk_prepare_enable(&cpu_clk);
808 clk_enable(&hbus_clk); 808 clk_prepare_enable(&hbus_clk);
809 clk_enable(&xbus_clk); 809 clk_prepare_enable(&xbus_clk);
810 clk_enable(&emi_clk); 810 clk_prepare_enable(&emi_clk);
811 clk_enable(&uart_clk); 811 clk_prepare_enable(&uart_clk);
812 812
813 clk_set_parent(&lcdif_clk, &ref_pix_clk); 813 clk_set_parent(&lcdif_clk, &ref_pix_clk);
814 clk_set_parent(&saif0_clk, &pll0_clk); 814 clk_set_parent(&saif0_clk, &pll0_clk);
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c
index a7093c88e6a6..97a6f4acc6cc 100644
--- a/arch/arm/mach-mxs/clock.c
+++ b/arch/arm/mach-mxs/clock.c
@@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk)
74 return 0; 74 return 0;
75} 75}
76 76
77/* This function increments the reference count on the clock and enables the 77/*
78 * clock if not already enabled. The parent clock tree is recursively enabled 78 * The clk_enable/clk_disable could be called by drivers in atomic context,
79 * so they should not really hold mutex. Instead, clk_prepare/clk_unprepare
80 * can hold a mutex, as the pair will only be called in non-atomic context.
81 * Before migrating to common clk framework, we can have __clk_enable and
82 * __clk_disable called in clk_prepare/clk_unprepare with mutex held and
83 * leave clk_enable/clk_disable as the dummy functions.
79 */ 84 */
80int clk_enable(struct clk *clk) 85int clk_prepare(struct clk *clk)
81{ 86{
82 int ret = 0; 87 int ret = 0;
83 88
@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)
90 95
91 return ret; 96 return ret;
92} 97}
93EXPORT_SYMBOL(clk_enable); 98EXPORT_SYMBOL(clk_prepare);
94 99
95/* This function decrements the reference count on the clock and disables 100void clk_unprepare(struct clk *clk)
96 * the clock when reference count is 0. The parent clock tree is
97 * recursively disabled
98 */
99void clk_disable(struct clk *clk)
100{ 101{
101 if (clk == NULL || IS_ERR(clk)) 102 if (clk == NULL || IS_ERR(clk))
102 return; 103 return;
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)
105 __clk_disable(clk); 106 __clk_disable(clk);
106 mutex_unlock(&clocks_mutex); 107 mutex_unlock(&clocks_mutex);
107} 108}
109EXPORT_SYMBOL(clk_unprepare);
110
111int clk_enable(struct clk *clk)
112{
113 return 0;
114}
115EXPORT_SYMBOL(clk_enable);
116
117void clk_disable(struct clk *clk)
118{
119 /* nothing to do */
120}
108EXPORT_SYMBOL(clk_disable); 121EXPORT_SYMBOL(clk_disable);
109 122
110/* Retrieve the *current* clock rate. If the clock itself 123/* Retrieve the *current* clock rate. If the clock itself
@@ -166,7 +179,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
166 return ret; 179 return ret;
167 180
168 if (clk->usecount) 181 if (clk->usecount)
169 clk_enable(parent); 182 clk_prepare_enable(parent);
170 183
171 mutex_lock(&clocks_mutex); 184 mutex_lock(&clocks_mutex);
172 ret = clk->set_parent(clk, parent); 185 ret = clk->set_parent(clk, parent);
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index eb0597be4e23..fdb0a5664dd6 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -229,7 +229,7 @@ static void __init mx28evk_fec_reset(void)
229 /* Enable fec phy clock */ 229 /* Enable fec phy clock */
230 clk = clk_get_sys("pll2", NULL); 230 clk = clk_get_sys("pll2", NULL);
231 if (!IS_ERR(clk)) 231 if (!IS_ERR(clk))
232 clk_enable(clk); 232 clk_prepare_enable(clk);
233 233
234 /* Power up fec phy */ 234 /* Power up fec phy */
235 ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power"); 235 ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index b936633b7682..54f91ad1c965 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -66,7 +66,7 @@ static int __init mxs_arch_reset_init(void)
66 66
67 clk = clk_get_sys("rtc", NULL); 67 clk = clk_get_sys("rtc", NULL);
68 if (!IS_ERR(clk)) 68 if (!IS_ERR(clk))
69 clk_enable(clk); 69 clk_prepare_enable(clk);
70 70
71 return 0; 71 return 0;
72} 72}
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index cace0d2e5a55..564a63279f18 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -245,7 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
245 245
246void __init mxs_timer_init(struct clk *timer_clk, int irq) 246void __init mxs_timer_init(struct clk *timer_clk, int irq)
247{ 247{
248 clk_enable(timer_clk); 248 clk_prepare_enable(timer_clk);
249 249
250 /* 250 /*
251 * Initialize timers to a known state 251 * Initialize timers to a known state