Commit 6c669e50 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

clk: renesas: rcar-gen2: Always use readl()/writel()

On arm32, there is no reason to use the (soon deprecated)
clk_readl()/clk_writel().  Hence use the generic readl()/writel()
instead.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent f32b0696
...@@ -62,8 +62,7 @@ static unsigned long cpg_z_clk_recalc_rate(struct clk_hw *hw, ...@@ -62,8 +62,7 @@ static unsigned long cpg_z_clk_recalc_rate(struct clk_hw *hw,
unsigned int mult; unsigned int mult;
unsigned int val; unsigned int val;
val = (clk_readl(zclk->reg) & CPG_FRQCRC_ZFC_MASK) val = (readl(zclk->reg) & CPG_FRQCRC_ZFC_MASK) >> CPG_FRQCRC_ZFC_SHIFT;
>> CPG_FRQCRC_ZFC_SHIFT;
mult = 32 - val; mult = 32 - val;
return div_u64((u64)parent_rate * mult, 32); return div_u64((u64)parent_rate * mult, 32);
...@@ -95,21 +94,21 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -95,21 +94,21 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate,
mult = div_u64((u64)rate * 32, parent_rate); mult = div_u64((u64)rate * 32, parent_rate);
mult = clamp(mult, 1U, 32U); mult = clamp(mult, 1U, 32U);
if (clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK) if (readl(zclk->kick_reg) & CPG_FRQCRB_KICK)
return -EBUSY; return -EBUSY;
val = clk_readl(zclk->reg); val = readl(zclk->reg);
val &= ~CPG_FRQCRC_ZFC_MASK; val &= ~CPG_FRQCRC_ZFC_MASK;
val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT; val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT;
clk_writel(val, zclk->reg); writel(val, zclk->reg);
/* /*
* Set KICK bit in FRQCRB to update hardware setting and wait for * Set KICK bit in FRQCRB to update hardware setting and wait for
* clock change completion. * clock change completion.
*/ */
kick = clk_readl(zclk->kick_reg); kick = readl(zclk->kick_reg);
kick |= CPG_FRQCRB_KICK; kick |= CPG_FRQCRB_KICK;
clk_writel(kick, zclk->kick_reg); writel(kick, zclk->kick_reg);
/* /*
* Note: There is no HW information about the worst case latency. * Note: There is no HW information about the worst case latency.
...@@ -121,7 +120,7 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -121,7 +120,7 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate,
* "super" safe value. * "super" safe value.
*/ */
for (i = 1000; i; i--) { for (i = 1000; i; i--) {
if (!(clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK)) if (!(readl(zclk->kick_reg) & CPG_FRQCRB_KICK))
return 0; return 0;
cpu_relax(); cpu_relax();
...@@ -332,7 +331,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, ...@@ -332,7 +331,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
mult = config->pll0_mult; mult = config->pll0_mult;
div = 3; div = 3;
} else { } else {
u32 value = clk_readl(cpg->reg + CPG_PLL0CR); u32 value = readl(cpg->reg + CPG_PLL0CR);
mult = ((value >> 24) & ((1 << 7) - 1)) + 1; mult = ((value >> 24) & ((1 << 7) - 1)) + 1;
} }
parent_name = "main"; parent_name = "main";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment