diff options
| author | Paul Mundt <lethal@linux-sh.org> | 2010-11-01 12:18:48 -0400 |
|---|---|---|
| committer | Paul Mundt <lethal@linux-sh.org> | 2010-11-09 02:40:00 -0500 |
| commit | 16b259203c513ed28bd31cc9a981e0d3ad517943 (patch) | |
| tree | d29600ee92f96a8f9bcf9e3d91e001ea8e09015c /arch/sh/kernel/cpu/sh2 | |
| parent | a7bcf21e60c73cb7f7c13fad928967d7e47c3cac (diff) | |
sh: migrate SH_CLK_MD to mode pin API.
This kills off the hardcoded SH_CLK_MD introduced by the SH-2 boards and
converts over to the mode pin API.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh2')
| -rw-r--r-- | arch/sh/kernel/cpu/sh2/clock-sh7619.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/arch/sh/kernel/cpu/sh2/clock-sh7619.c b/arch/sh/kernel/cpu/sh2/clock-sh7619.c index 0c9f24d7a02f..5b7f12e58a8d 100644 --- a/arch/sh/kernel/cpu/sh2/clock-sh7619.c +++ b/arch/sh/kernel/cpu/sh2/clock-sh7619.c | |||
| @@ -14,24 +14,18 @@ | |||
| 14 | */ | 14 | */ |
| 15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/io.h> | ||
| 17 | #include <asm/clock.h> | 18 | #include <asm/clock.h> |
| 18 | #include <asm/freq.h> | 19 | #include <asm/freq.h> |
| 19 | #include <asm/io.h> | 20 | #include <asm/processor.h> |
| 20 | 21 | ||
| 21 | static const int pll1rate[] = {1,2}; | 22 | static const int pll1rate[] = {1,2}; |
| 22 | static const int pfc_divisors[] = {1,2,0,4}; | 23 | static const int pfc_divisors[] = {1,2,0,4}; |
| 23 | 24 | static unsigned int pll2_mult; | |
| 24 | #if (CONFIG_SH_CLK_MD == 1) || (CONFIG_SH_CLK_MD == 2) | ||
| 25 | #define PLL2 (4) | ||
| 26 | #elif (CONFIG_SH_CLK_MD == 5) || (CONFIG_SH_CLK_MD == 6) | ||
| 27 | #define PLL2 (2) | ||
| 28 | #else | ||
| 29 | #error "Illigal Clock Mode!" | ||
| 30 | #endif | ||
| 31 | 25 | ||
| 32 | static void master_clk_init(struct clk *clk) | 26 | static void master_clk_init(struct clk *clk) |
| 33 | { | 27 | { |
| 34 | clk->rate *= PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; | 28 | clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; |
| 35 | } | 29 | } |
| 36 | 30 | ||
| 37 | static struct clk_ops sh7619_master_clk_ops = { | 31 | static struct clk_ops sh7619_master_clk_ops = { |
| @@ -70,6 +64,14 @@ static struct clk_ops *sh7619_clk_ops[] = { | |||
| 70 | 64 | ||
| 71 | void __init arch_init_clk_ops(struct clk_ops **ops, int idx) | 65 | void __init arch_init_clk_ops(struct clk_ops **ops, int idx) |
| 72 | { | 66 | { |
| 67 | if (test_mode_pin(MODE_PIN2 | MODE_PIN0) || | ||
| 68 | test_mode_pin(MODE_PIN2 | MODE_PIN1)) | ||
| 69 | pll2_mult = 2; | ||
| 70 | else if (test_mode_pin(MODE_PIN0) || test_mode_pin(MODE_PIN1)) | ||
| 71 | pll2_mult = 4; | ||
| 72 | |||
| 73 | BUG_ON(!pll2_mult); | ||
| 74 | |||
| 73 | if (idx < ARRAY_SIZE(sh7619_clk_ops)) | 75 | if (idx < ARRAY_SIZE(sh7619_clk_ops)) |
| 74 | *ops = sh7619_clk_ops[idx]; | 76 | *ops = sh7619_clk_ops[idx]; |
| 75 | } | 77 | } |
