diff options
author | Paul Burton <paul.burton@imgtec.com> | 2015-05-24 11:11:38 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-21 15:53:18 -0400 |
commit | ed286ca5d627619673b7dad27f48252498e3905c (patch) | |
tree | 57f3ea2b35095dff18f149a54474a2508cc5c897 | |
parent | 41dd641e9a1a7229383f9b342a57cb6720e7ea46 (diff) |
MIPS, clk: move jz4740 UDC auto suspend functions to jz4740-cgu
The jz4740-cgu driver already has access to the CGU, so it makes sense
to move the few remaining accesses to the CGU from arch/mips/jz4740
there too. Move the jz4740_clock_udc_{dis,en}able_auto_suspend functions
there for such consistency.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/10154/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/jz4740/clock.c | 13 | ||||
-rw-r--r-- | drivers/clk/ingenic/jz4740-cgu.c | 22 |
2 files changed, 22 insertions, 13 deletions
diff --git a/arch/mips/jz4740/clock.c b/arch/mips/jz4740/clock.c index 90b44d728cbd..2a1082920f46 100644 --- a/arch/mips/jz4740/clock.c +++ b/arch/mips/jz4740/clock.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #define JZ_CLOCK_GATE_UART0 BIT(0) | 34 | #define JZ_CLOCK_GATE_UART0 BIT(0) |
35 | #define JZ_CLOCK_GATE_TCU BIT(1) | 35 | #define JZ_CLOCK_GATE_TCU BIT(1) |
36 | #define JZ_CLOCK_GATE_UDC BIT(11) | ||
37 | #define JZ_CLOCK_GATE_DMAC BIT(12) | 36 | #define JZ_CLOCK_GATE_DMAC BIT(12) |
38 | 37 | ||
39 | #define JZ_CLOCK_PLL_STABLE BIT(10) | 38 | #define JZ_CLOCK_PLL_STABLE BIT(10) |
@@ -64,18 +63,6 @@ static void jz_clk_reg_clear_bits(int reg, uint32_t mask) | |||
64 | writel(val, jz_clock_base + reg); | 63 | writel(val, jz_clock_base + reg); |
65 | } | 64 | } |
66 | 65 | ||
67 | void jz4740_clock_udc_disable_auto_suspend(void) | ||
68 | { | ||
69 | jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE, JZ_CLOCK_GATE_UDC); | ||
70 | } | ||
71 | EXPORT_SYMBOL_GPL(jz4740_clock_udc_disable_auto_suspend); | ||
72 | |||
73 | void jz4740_clock_udc_enable_auto_suspend(void) | ||
74 | { | ||
75 | jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, JZ_CLOCK_GATE_UDC); | ||
76 | } | ||
77 | EXPORT_SYMBOL_GPL(jz4740_clock_udc_enable_auto_suspend); | ||
78 | |||
79 | void jz4740_clock_suspend(void) | 66 | void jz4740_clock_suspend(void) |
80 | { | 67 | { |
81 | jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, | 68 | jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, |
diff --git a/drivers/clk/ingenic/jz4740-cgu.c b/drivers/clk/ingenic/jz4740-cgu.c index 0209ed6d412a..0e692ed632e5 100644 --- a/drivers/clk/ingenic/jz4740-cgu.c +++ b/drivers/clk/ingenic/jz4740-cgu.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #define CGU_REG_CPCCR 0x00 | 26 | #define CGU_REG_CPCCR 0x00 |
27 | #define CGU_REG_LCR 0x04 | 27 | #define CGU_REG_LCR 0x04 |
28 | #define CGU_REG_CPPCR 0x10 | 28 | #define CGU_REG_CPPCR 0x10 |
29 | #define CGU_REG_CLKGR 0x20 | ||
29 | #define CGU_REG_SCR 0x24 | 30 | #define CGU_REG_SCR 0x24 |
30 | #define CGU_REG_I2SCDR 0x60 | 31 | #define CGU_REG_I2SCDR 0x60 |
31 | #define CGU_REG_LPCDR 0x64 | 32 | #define CGU_REG_LPCDR 0x64 |
@@ -47,6 +48,9 @@ | |||
47 | /* bits within the LCR register */ | 48 | /* bits within the LCR register */ |
48 | #define LCR_SLEEP (1 << 0) | 49 | #define LCR_SLEEP (1 << 0) |
49 | 50 | ||
51 | /* bits within the CLKGR register */ | ||
52 | #define CLKGR_UDC (1 << 11) | ||
53 | |||
50 | static struct ingenic_cgu *cgu; | 54 | static struct ingenic_cgu *cgu; |
51 | 55 | ||
52 | static const s8 pll_od_encoding[4] = { | 56 | static const s8 pll_od_encoding[4] = { |
@@ -242,3 +246,21 @@ void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode) | |||
242 | 246 | ||
243 | writel(lcr, cgu->base + CGU_REG_LCR); | 247 | writel(lcr, cgu->base + CGU_REG_LCR); |
244 | } | 248 | } |
249 | |||
250 | void jz4740_clock_udc_disable_auto_suspend(void) | ||
251 | { | ||
252 | uint32_t clkgr = readl(cgu->base + CGU_REG_CLKGR); | ||
253 | |||
254 | clkgr &= ~CLKGR_UDC; | ||
255 | writel(clkgr, cgu->base + CGU_REG_CLKGR); | ||
256 | } | ||
257 | EXPORT_SYMBOL_GPL(jz4740_clock_udc_disable_auto_suspend); | ||
258 | |||
259 | void jz4740_clock_udc_enable_auto_suspend(void) | ||
260 | { | ||
261 | uint32_t clkgr = readl(cgu->base + CGU_REG_CLKGR); | ||
262 | |||
263 | clkgr |= CLKGR_UDC; | ||
264 | writel(clkgr, cgu->base + CGU_REG_CLKGR); | ||
265 | } | ||
266 | EXPORT_SYMBOL_GPL(jz4740_clock_udc_enable_auto_suspend); | ||