Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-12-12 Thread Andrew Lunn
Hi Mike +int clk_register_gate(struct device *dev, const char *name, unsigned long flags, + struct clk *fixed_parent, void __iomem *reg, u8 bit_idx, +int set_to_enable) + How do you suggest handling gated clocks which are already

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-12-12 Thread Turquette, Mike
On Mon, Dec 12, 2011 at 11:47 AM, Andrew Lunn and...@lunn.ch wrote: Hi Mike +int clk_register_gate(struct device *dev, const char *name, unsigned long flags, +                             struct clk *fixed_parent, void __iomem *reg, u8 bit_idx, +                                    int

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-12-12 Thread Andrew Lunn
I don't like this approach. If the bool for a particular clk is statically defined then it could be wrong (bootloader/kernel mismatch). I've been thinking of adding a clk-ops-init callback in clk_init, which is defined for a platform to use however the author sees fit. There have been a

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-26 Thread Shawn Guo
On Mon, Nov 21, 2011 at 05:40:46PM -0800, Mike Turquette wrote: Many platforms support simple gateable clks and fixed-rate clks that should not be re-implemented by every platform. This patch introduces a gateable clk with a common programming model of gate control via a write of 1 bit to a

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-26 Thread Shawn Guo
One comment was missed. On Mon, Nov 21, 2011 at 05:40:46PM -0800, Mike Turquette wrote: [...] +struct clk_hw_ops clk_hw_gate_set_enable_ops = { const? + .enable = clk_hw_gate_enable_set, + .disable = clk_hw_gate_disable_clear, + .recalc_rate = clk_hw_gate_recalc_rate, +

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-26 Thread Turquette, Mike
On Sat, Nov 26, 2011 at 5:48 AM, Shawn Guo shawn@freescale.com wrote: On Mon, Nov 21, 2011 at 05:40:46PM -0800, Mike Turquette wrote: Many platforms support simple gateable clks and fixed-rate clks that should not be re-implemented by every platform. This patch introduces a gateable clk

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-22 Thread Arnd Bergmann
On Tuesday 22 November 2011, Mike Turquette wrote: +static void clk_hw_gate_set_bit(struct clk *clk) +{ + struct clk_hw_gate *gate = to_clk_hw_gate(clk); + u32 reg; + + reg = __raw_readl(gate-reg); + reg |= BIT(gate-bit_idx); + __raw_writel(reg, gate-reg); +}

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-22 Thread Mark Salter
On Tue, 2011-11-22 at 13:11 +, Arnd Bergmann wrote: On Tuesday 22 November 2011, Mike Turquette wrote: +static void clk_hw_gate_set_bit(struct clk *clk) +{ + struct clk_hw_gate *gate = to_clk_hw_gate(clk); + u32 reg; + + reg = __raw_readl(gate-reg); + reg

Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-22 Thread Arnd Bergmann
On Tuesday 22 November 2011, Mark Salter wrote: On Tue, 2011-11-22 at 13:11 +, Arnd Bergmann wrote: On Tuesday 22 November 2011, Mike Turquette wrote: +static void clk_hw_gate_set_bit(struct clk *clk) +{ + struct clk_hw_gate *gate = to_clk_hw_gate(clk); + u32 reg;

[PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-21 Thread Mike Turquette
Many platforms support simple gateable clks and fixed-rate clks that should not be re-implemented by every platform. This patch introduces a gateable clk with a common programming model of gate control via a write of 1 bit to a register. Both set-to-enable and clear-to-enable are supported.