Commit 79901478 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Sascha Hauer

ARM: mx5/clock-mx51: refactor ccgr callbacks to use common code

Acked-by: default avatarJason Wang <jason77.wang@gmail.com>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 9f0c11ee
...@@ -41,34 +41,36 @@ static struct clk usboh3_clk; ...@@ -41,34 +41,36 @@ static struct clk usboh3_clk;
#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */ #define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */
static int _clk_ccgr_enable(struct clk *clk) static void _clk_ccgr_setclk(struct clk *clk, unsigned mode)
{ {
u32 reg; u32 reg = __raw_readl(clk->enable_reg);
reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
reg |= mode << clk->enable_shift;
reg = __raw_readl(clk->enable_reg);
reg |= MXC_CCM_CCGRx_MOD_ON << clk->enable_shift;
__raw_writel(reg, clk->enable_reg); __raw_writel(reg, clk->enable_reg);
}
static int _clk_ccgr_enable(struct clk *clk)
{
_clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_ON);
return 0; return 0;
} }
static void _clk_ccgr_disable(struct clk *clk) static void _clk_ccgr_disable(struct clk *clk)
{ {
u32 reg; _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_OFF);
reg = __raw_readl(clk->enable_reg); }
reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
__raw_writel(reg, clk->enable_reg);
static int _clk_ccgr_enable_inrun(struct clk *clk)
{
_clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_IDLE);
return 0;
} }
static void _clk_ccgr_disable_inwait(struct clk *clk) static void _clk_ccgr_disable_inwait(struct clk *clk)
{ {
u32 reg; _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_IDLE);
reg = __raw_readl(clk->enable_reg);
reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
reg |= MXC_CCM_CCGRx_MOD_IDLE << clk->enable_shift;
__raw_writel(reg, clk->enable_reg);
} }
/* /*
......
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