1 From 4f43ab43125a12dbc23e352ac0eb4fd80a876fb5 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= <emilio@elopez.com.ar>
3 Date: Fri, 20 Sep 2013 20:29:17 -0300
4 Subject: [PATCH] clk: sunxi: Implement MMC phase control
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Signed-off-by: Emilio López <emilio@elopez.com.ar>
11 drivers/clk/sunxi/clk-sunxi.c | 35 +++++++++++++++++++++++++++++++++++
12 1 file changed, 35 insertions(+)
14 --- a/drivers/clk/sunxi/clk-sunxi.c
15 +++ b/drivers/clk/sunxi/clk-sunxi.c
16 @@ -361,6 +361,41 @@ static void sun4i_get_mod0_factors(u32 *
20 + * clk_sunxi_mmc_phase_control() - configures MMC clock phase control
23 +void clk_sunxi_mmc_phase_control(struct clk_hw *hw, u8 sample, u8 output)
25 + #define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)
26 + #define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw)
28 + struct clk_composite *composite = to_clk_composite(hw);
29 + struct clk_hw *rate_hw = composite->rate_hw;
30 + struct clk_factors *factors = to_clk_factors(rate_hw);
31 + unsigned long flags = 0;
35 + spin_lock_irqsave(factors->lock, flags);
37 + reg = readl(factors->reg);
39 + /* set sample clock phase control */
40 + reg &= ~(0x7 << 20);
41 + reg |= ((sample & 0x7) << 20);
43 + /* set output clock phase control */
45 + reg |= ((output & 0x7) << 8);
47 + writel(reg, factors->reg);
50 + spin_unlock_irqrestore(factors->lock, flags);
55 * sunxi_factors_clk_setup() - Setup function for factor clocks