diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-01-19 06:14:31 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-01-19 06:23:00 -0500 |
commit | 31c3af503eb75488aafb7a3d292b9e00962f2cee (patch) | |
tree | c7a7905b50cc524d9ce0f92ad5aa9f80d04fad42 /arch/sh/kernel/cpu/sh4a/clock-sh7722.c | |
parent | 14965f16b4bb8f3e51b09c1d8f61b8e98f9d12db (diff) |
sh: support SIU sourcing from external clock on sh7722
Implement .set_rate() for all SH "div4 clocks," .enable(), .disable(), and
.set_parent() for those, that support them. This allows, among other uses,
reparenting of SIU clocks to the external source, and enabling and
disabling of the IrDA clock on sh7722.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh4a/clock-sh7722.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7722.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c index ea38b554dc05..860ee2bf4bf0 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c | |||
@@ -117,12 +117,11 @@ static struct clk_div_mult_table div4_table = { | |||
117 | .nr_multipliers = ARRAY_SIZE(multipliers), | 117 | .nr_multipliers = ARRAY_SIZE(multipliers), |
118 | }; | 118 | }; |
119 | 119 | ||
120 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, | ||
121 | DIV4_SIUA, DIV4_SIUB, DIV4_IRDA, DIV4_NR }; | ||
122 | |||
123 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ | 120 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ |
124 | SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags) | 121 | SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags) |
125 | 122 | ||
123 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, DIV4_NR }; | ||
124 | |||
126 | struct clk div4_clks[DIV4_NR] = { | 125 | struct clk div4_clks[DIV4_NR] = { |
127 | [DIV4_I] = DIV4("cpu_clk", FRQCR, 20, 0x1fef, CLK_ENABLE_ON_INIT), | 126 | [DIV4_I] = DIV4("cpu_clk", FRQCR, 20, 0x1fef, CLK_ENABLE_ON_INIT), |
128 | [DIV4_U] = DIV4("umem_clk", FRQCR, 16, 0x1fff, CLK_ENABLE_ON_INIT), | 127 | [DIV4_U] = DIV4("umem_clk", FRQCR, 16, 0x1fff, CLK_ENABLE_ON_INIT), |
@@ -130,9 +129,19 @@ struct clk div4_clks[DIV4_NR] = { | |||
130 | [DIV4_B] = DIV4("bus_clk", FRQCR, 8, 0x1fff, CLK_ENABLE_ON_INIT), | 129 | [DIV4_B] = DIV4("bus_clk", FRQCR, 8, 0x1fff, CLK_ENABLE_ON_INIT), |
131 | [DIV4_B3] = DIV4("b3_clk", FRQCR, 4, 0x1fff, CLK_ENABLE_ON_INIT), | 130 | [DIV4_B3] = DIV4("b3_clk", FRQCR, 4, 0x1fff, CLK_ENABLE_ON_INIT), |
132 | [DIV4_P] = DIV4("peripheral_clk", FRQCR, 0, 0x1fff, 0), | 131 | [DIV4_P] = DIV4("peripheral_clk", FRQCR, 0, 0x1fff, 0), |
132 | }; | ||
133 | |||
134 | enum { DIV4_IRDA, DIV4_ENABLE_NR }; | ||
135 | |||
136 | struct clk div4_enable_clks[DIV4_ENABLE_NR] = { | ||
137 | [DIV4_IRDA] = DIV4("irda_clk", IRDACLKCR, 0, 0x1fff, 0), | ||
138 | }; | ||
139 | |||
140 | enum { DIV4_SIUA, DIV4_SIUB, DIV4_REPARENT_NR }; | ||
141 | |||
142 | struct clk div4_reparent_clks[DIV4_REPARENT_NR] = { | ||
133 | [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x1fff, 0), | 143 | [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x1fff, 0), |
134 | [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0), | 144 | [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0), |
135 | [DIV4_IRDA] = DIV4("irda_clk", IRDACLKCR, 0, 0x1fff, 0), | ||
136 | }; | 145 | }; |
137 | 146 | ||
138 | struct clk div6_clks[] = { | 147 | struct clk div6_clks[] = { |
@@ -189,6 +198,14 @@ int __init arch_clk_init(void) | |||
189 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); | 198 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); |
190 | 199 | ||
191 | if (!ret) | 200 | if (!ret) |
201 | ret = sh_clk_div4_enable_register(div4_enable_clks, | ||
202 | DIV4_ENABLE_NR, &div4_table); | ||
203 | |||
204 | if (!ret) | ||
205 | ret = sh_clk_div4_reparent_register(div4_reparent_clks, | ||
206 | DIV4_REPARENT_NR, &div4_table); | ||
207 | |||
208 | if (!ret) | ||
192 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); | 209 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); |
193 | 210 | ||
194 | if (!ret) | 211 | if (!ret) |