aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh/clk/cpg.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2011-12-08 08:59:22 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-12-09 04:04:14 -0500
commit2dacb97d9269e303ed761937a0e9db8711515e08 (patch)
tree1a26c9587b2008d4bd146ef32bdf36e42a0d6772 /drivers/sh/clk/cpg.c
parent0e027376f896e5dda293ffc8e6e7332d26d2ffc4 (diff)
sh: use ioread32/iowrite32 and mapped_reg for div6
Convert the CPG DIV6 helper code to use the new mapped_reg together with ioread32() and iowrite32(). Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/sh/clk/cpg.c')
-rw-r--r--drivers/sh/clk/cpg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index e4a2edf139f7..a0d8faa40baa 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -72,7 +72,7 @@ static unsigned long sh_clk_div6_recalc(struct clk *clk)
72 clk_rate_table_build(clk, clk->freq_table, table->nr_divisors, 72 clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
73 table, NULL); 73 table, NULL);
74 74
75 idx = __raw_readl(clk->enable_reg) & 0x003f; 75 idx = ioread32(clk->mapped_reg) & 0x003f;
76 76
77 return clk->freq_table[idx].frequency; 77 return clk->freq_table[idx].frequency;
78} 78}
@@ -98,10 +98,10 @@ static int sh_clk_div6_set_parent(struct clk *clk, struct clk *parent)
98 if (ret < 0) 98 if (ret < 0)
99 return ret; 99 return ret;
100 100
101 value = __raw_readl(clk->enable_reg) & 101 value = ioread32(clk->mapped_reg) &
102 ~(((1 << clk->src_width) - 1) << clk->src_shift); 102 ~(((1 << clk->src_width) - 1) << clk->src_shift);
103 103
104 __raw_writel(value | (i << clk->src_shift), clk->enable_reg); 104 iowrite32(value | (i << clk->src_shift), clk->mapped_reg);
105 105
106 /* Rebuild the frequency table */ 106 /* Rebuild the frequency table */
107 clk_rate_table_build(clk, clk->freq_table, table->nr_divisors, 107 clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
@@ -119,10 +119,10 @@ static int sh_clk_div6_set_rate(struct clk *clk, unsigned long rate)
119 if (idx < 0) 119 if (idx < 0)
120 return idx; 120 return idx;
121 121
122 value = __raw_readl(clk->enable_reg); 122 value = ioread32(clk->mapped_reg);
123 value &= ~0x3f; 123 value &= ~0x3f;
124 value |= idx; 124 value |= idx;
125 __raw_writel(value, clk->enable_reg); 125 iowrite32(value, clk->mapped_reg);
126 return 0; 126 return 0;
127} 127}
128 128
@@ -133,9 +133,9 @@ static int sh_clk_div6_enable(struct clk *clk)
133 133
134 ret = sh_clk_div6_set_rate(clk, clk->rate); 134 ret = sh_clk_div6_set_rate(clk, clk->rate);
135 if (ret == 0) { 135 if (ret == 0) {
136 value = __raw_readl(clk->enable_reg); 136 value = ioread32(clk->mapped_reg);
137 value &= ~0x100; /* clear stop bit to enable clock */ 137 value &= ~0x100; /* clear stop bit to enable clock */
138 __raw_writel(value, clk->enable_reg); 138 iowrite32(value, clk->mapped_reg);
139 } 139 }
140 return ret; 140 return ret;
141} 141}
@@ -144,10 +144,10 @@ static void sh_clk_div6_disable(struct clk *clk)
144{ 144{
145 unsigned long value; 145 unsigned long value;
146 146
147 value = __raw_readl(clk->enable_reg); 147 value = ioread32(clk->mapped_reg);
148 value |= 0x100; /* stop clock */ 148 value |= 0x100; /* stop clock */
149 value |= 0x3f; /* VDIV bits must be non-zero, overwrite divider */ 149 value |= 0x3f; /* VDIV bits must be non-zero, overwrite divider */
150 __raw_writel(value, clk->enable_reg); 150 iowrite32(value, clk->mapped_reg);
151} 151}
152 152
153static struct clk_ops sh_clk_div6_clk_ops = { 153static struct clk_ops sh_clk_div6_clk_ops = {
@@ -182,7 +182,7 @@ static int __init sh_clk_init_parent(struct clk *clk)
182 return -EINVAL; 182 return -EINVAL;
183 } 183 }
184 184
185 val = (__raw_readl(clk->enable_reg) >> clk->src_shift); 185 val = (ioread32(clk->mapped_reg) >> clk->src_shift);
186 val &= (1 << clk->src_width) - 1; 186 val &= (1 << clk->src_width) - 1;
187 187
188 if (val >= clk->parent_num) { 188 if (val >= clk->parent_num) {