diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a/clock-sh7203.c')
| -rw-r--r-- | arch/sh/kernel/cpu/sh2a/clock-sh7203.c | 33 | 
1 files changed, 15 insertions, 18 deletions
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c index 7e75d8f7950..529f719b6e3 100644 --- a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c +++ b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c @@ -25,24 +25,14 @@ static const int pll1rate[]={8,12,16,0};  static const int pfc_divisors[]={1,2,3,4,6,8,12};  #define ifc_divisors pfc_divisors -#if (CONFIG_SH_CLK_MD == 0) -#define PLL2 (1) -#elif (CONFIG_SH_CLK_MD == 1) -#define PLL2 (2) -#elif (CONFIG_SH_CLK_MD == 2) -#define PLL2 (4) -#elif (CONFIG_SH_CLK_MD == 3) -#define PLL2 (4) -#else -#error "Illegal Clock Mode!" -#endif +static unsigned int pll2_mult;  static void master_clk_init(struct clk *clk)  { -	clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * PLL2 ; +	clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * pll2_mult;  } -static struct clk_ops sh7203_master_clk_ops = { +static struct sh_clk_ops sh7203_master_clk_ops = {  	.init		= master_clk_init,  }; @@ -52,7 +42,7 @@ static unsigned long module_clk_recalc(struct clk *clk)  	return clk->parent->rate / pfc_divisors[idx];  } -static struct clk_ops sh7203_module_clk_ops = { +static struct sh_clk_ops sh7203_module_clk_ops = {  	.recalc		= module_clk_recalc,  }; @@ -62,23 +52,30 @@ static unsigned long bus_clk_recalc(struct clk *clk)  	return clk->parent->rate / pfc_divisors[idx-2];  } -static struct clk_ops sh7203_bus_clk_ops = { +static struct sh_clk_ops sh7203_bus_clk_ops = {  	.recalc		= bus_clk_recalc,  }; -static struct clk_ops sh7203_cpu_clk_ops = { +static struct sh_clk_ops sh7203_cpu_clk_ops = {  	.recalc		= followparent_recalc,  }; -static struct clk_ops *sh7203_clk_ops[] = { +static struct sh_clk_ops *sh7203_clk_ops[] = {  	&sh7203_master_clk_ops,  	&sh7203_module_clk_ops,  	&sh7203_bus_clk_ops,  	&sh7203_cpu_clk_ops,  }; -void __init arch_init_clk_ops(struct clk_ops **ops, int idx) +void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)  { +	if (test_mode_pin(MODE_PIN1)) +		pll2_mult = 4; +	else if (test_mode_pin(MODE_PIN0)) +		pll2_mult = 2; +	else +		pll2_mult = 1; +  	if (idx < ARRAY_SIZE(sh7203_clk_ops))  		*ops = sh7203_clk_ops[idx];  }  | 
