diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a/clock-sh7201.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh2a/clock-sh7201.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c index 7814c76159a7..1174e2d96c03 100644 --- a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c +++ b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c | |||
@@ -22,19 +22,12 @@ static const int pll1rate[]={1,2,3,4,6,8}; | |||
22 | static const int pfc_divisors[]={1,2,3,4,6,8,12}; | 22 | static const int pfc_divisors[]={1,2,3,4,6,8,12}; |
23 | #define ifc_divisors pfc_divisors | 23 | #define ifc_divisors pfc_divisors |
24 | 24 | ||
25 | #if (CONFIG_SH_CLK_MD == 0) | 25 | static unsigned int pll2_mult; |
26 | #define PLL2 (4) | ||
27 | #elif (CONFIG_SH_CLK_MD == 2) | ||
28 | #define PLL2 (2) | ||
29 | #elif (CONFIG_SH_CLK_MD == 3) | ||
30 | #define PLL2 (1) | ||
31 | #else | ||
32 | #error "Illegal Clock Mode!" | ||
33 | #endif | ||
34 | 26 | ||
35 | static void master_clk_init(struct clk *clk) | 27 | static void master_clk_init(struct clk *clk) |
36 | { | 28 | { |
37 | return 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007]; | 29 | clk->rate = 10000000 * pll2_mult * |
30 | pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; | ||
38 | } | 31 | } |
39 | 32 | ||
40 | static struct clk_ops sh7201_master_clk_ops = { | 33 | static struct clk_ops sh7201_master_clk_ops = { |
@@ -43,7 +36,7 @@ static struct clk_ops sh7201_master_clk_ops = { | |||
43 | 36 | ||
44 | static unsigned long module_clk_recalc(struct clk *clk) | 37 | static unsigned long module_clk_recalc(struct clk *clk) |
45 | { | 38 | { |
46 | int idx = (ctrl_inw(FREQCR) & 0x0007); | 39 | int idx = (__raw_readw(FREQCR) & 0x0007); |
47 | return clk->parent->rate / pfc_divisors[idx]; | 40 | return clk->parent->rate / pfc_divisors[idx]; |
48 | } | 41 | } |
49 | 42 | ||
@@ -53,7 +46,7 @@ static struct clk_ops sh7201_module_clk_ops = { | |||
53 | 46 | ||
54 | static unsigned long bus_clk_recalc(struct clk *clk) | 47 | static unsigned long bus_clk_recalc(struct clk *clk) |
55 | { | 48 | { |
56 | int idx = (ctrl_inw(FREQCR) & 0x0007); | 49 | int idx = (__raw_readw(FREQCR) & 0x0007); |
57 | return clk->parent->rate / pfc_divisors[idx]; | 50 | return clk->parent->rate / pfc_divisors[idx]; |
58 | } | 51 | } |
59 | 52 | ||
@@ -63,7 +56,7 @@ static struct clk_ops sh7201_bus_clk_ops = { | |||
63 | 56 | ||
64 | static unsigned long cpu_clk_recalc(struct clk *clk) | 57 | static unsigned long cpu_clk_recalc(struct clk *clk) |
65 | { | 58 | { |
66 | int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007); | 59 | int idx = ((__raw_readw(FREQCR) >> 4) & 0x0007); |
67 | return clk->parent->rate / ifc_divisors[idx]; | 60 | return clk->parent->rate / ifc_divisors[idx]; |
68 | } | 61 | } |
69 | 62 | ||
@@ -80,6 +73,13 @@ static struct clk_ops *sh7201_clk_ops[] = { | |||
80 | 73 | ||
81 | void __init arch_init_clk_ops(struct clk_ops **ops, int idx) | 74 | void __init arch_init_clk_ops(struct clk_ops **ops, int idx) |
82 | { | 75 | { |
76 | if (test_mode_pin(MODE_PIN1 | MODE_PIN0)) | ||
77 | pll2_mult = 1; | ||
78 | else if (test_mode_pin(MODE_PIN1)) | ||
79 | pll2_mult = 2; | ||
80 | else | ||
81 | pll2_mult = 4; | ||
82 | |||
83 | if (idx < ARRAY_SIZE(sh7201_clk_ops)) | 83 | if (idx < ARRAY_SIZE(sh7201_clk_ops)) |
84 | *ops = sh7201_clk_ops[idx]; | 84 | *ops = sh7201_clk_ops[idx]; |
85 | } | 85 | } |