|
@@ -16,8 +16,6 @@
|
|
|
#include <linux/slab.h>
|
|
|
#include "clk.h"
|
|
|
|
|
|
-#define BF_CLKGATE BIT(7)
|
|
|
-
|
|
|
/**
|
|
|
* struct clk_ref - mxs reference clock
|
|
|
* @hw: clk_hw for the reference clock
|
|
@@ -41,7 +39,7 @@ static int clk_ref_enable(struct clk_hw *hw)
|
|
|
{
|
|
|
struct clk_ref *ref = to_clk_ref(hw);
|
|
|
|
|
|
- writeb_relaxed(BF_CLKGATE, ref->reg + ref->idx + CLR);
|
|
|
+ writel_relaxed(1 << ((ref->idx + 1) * 8 - 1), ref->reg + CLR);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -50,7 +48,7 @@ static void clk_ref_disable(struct clk_hw *hw)
|
|
|
{
|
|
|
struct clk_ref *ref = to_clk_ref(hw);
|
|
|
|
|
|
- writeb_relaxed(BF_CLKGATE, ref->reg + ref->idx + SET);
|
|
|
+ writel_relaxed(1 << ((ref->idx + 1) * 8 - 1), ref->reg + SET);
|
|
|
}
|
|
|
|
|
|
static unsigned long clk_ref_recalc_rate(struct clk_hw *hw,
|
|
@@ -58,7 +56,7 @@ static unsigned long clk_ref_recalc_rate(struct clk_hw *hw,
|
|
|
{
|
|
|
struct clk_ref *ref = to_clk_ref(hw);
|
|
|
u64 tmp = parent_rate;
|
|
|
- u8 frac = readb_relaxed(ref->reg + ref->idx) & 0x3f;
|
|
|
+ u8 frac = (readl_relaxed(ref->reg) >> (ref->idx * 8)) & 0x3f;
|
|
|
|
|
|
tmp *= 18;
|
|
|
do_div(tmp, frac);
|
|
@@ -95,7 +93,8 @@ static int clk_ref_set_rate(struct clk_hw *hw, unsigned long rate,
|
|
|
struct clk_ref *ref = to_clk_ref(hw);
|
|
|
unsigned long flags;
|
|
|
u64 tmp = parent_rate;
|
|
|
- u8 frac, val;
|
|
|
+ u32 val;
|
|
|
+ u8 frac, shift = ref->idx * 8;
|
|
|
|
|
|
tmp = tmp * 18 + rate / 2;
|
|
|
do_div(tmp, rate);
|
|
@@ -108,10 +107,10 @@ static int clk_ref_set_rate(struct clk_hw *hw, unsigned long rate,
|
|
|
|
|
|
spin_lock_irqsave(&mxs_lock, flags);
|
|
|
|
|
|
- val = readb_relaxed(ref->reg + ref->idx);
|
|
|
- val &= ~0x3f;
|
|
|
- val |= frac;
|
|
|
- writeb_relaxed(val, ref->reg + ref->idx);
|
|
|
+ val = readl_relaxed(ref->reg);
|
|
|
+ val &= ~(0x3f << shift);
|
|
|
+ val |= frac << shift;
|
|
|
+ writel_relaxed(val, ref->reg);
|
|
|
|
|
|
spin_unlock_irqrestore(&mxs_lock, flags);
|
|
|
|