Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
On 04/07, Joonyoung Shim wrote: > Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed > by set_rate callback. Don't change divider setting from set_rate > callback of divider with CLK_DIVIDER_READ_ONLY flag. > > Signed-off-by: Joonyoung Shim > --- > drivers/clk/clk-divider.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c > index 25006a8..ce34d29a 100644 > --- a/drivers/clk/clk-divider.c > +++ b/drivers/clk/clk-divider.c > @@ -384,6 +384,9 @@ static int clk_divider_set_rate(struct clk_hw *hw, > unsigned long rate, > unsigned long flags = 0; > u32 val; > > + if (divider->flags & CLK_DIVIDER_READ_ONLY) > + return 0; > + > value = divider_get_val(rate, parent_rate, divider->table, > divider->width, divider->flags); > I wonder if it would make more sense to have different ops for read only dividers. We would need to have an empty clk_set_rate op in the case where the CCF tries to set the rate to what it already is and then the proper recalc_rate and round_rate ops for read only devices. At the least, this patch looks correct. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
On 04/07, Joonyoung Shim wrote: Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed by set_rate callback. Don't change divider setting from set_rate callback of divider with CLK_DIVIDER_READ_ONLY flag. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/clk/clk-divider.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 25006a8..ce34d29a 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -384,6 +384,9 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long flags = 0; u32 val; + if (divider-flags CLK_DIVIDER_READ_ONLY) + return 0; + value = divider_get_val(rate, parent_rate, divider-table, divider-width, divider-flags); I wonder if it would make more sense to have different ops for read only dividers. We would need to have an empty clk_set_rate op in the case where the CCF tries to set the rate to what it already is and then the proper recalc_rate and round_rate ops for read only devices. At the least, this patch looks correct. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
Hi Stephen, On 05/13/2015 08:59 AM, Stephen Boyd wrote: > On 04/07, Joonyoung Shim wrote: >> Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed >> by set_rate callback. Don't change divider setting from set_rate >> callback of divider with CLK_DIVIDER_READ_ONLY flag. >> >> Signed-off-by: Joonyoung Shim >> --- > > Is the rate actually changing? Or is it just a problem that we > may be writing the register to the same value it already is? > If rate and parant_rate are different, it can write the register to different value. Even if the value is same but i think it's unnecessary to re-write the register. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
Hi Stephen, On 05/13/2015 08:59 AM, Stephen Boyd wrote: On 04/07, Joonyoung Shim wrote: Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed by set_rate callback. Don't change divider setting from set_rate callback of divider with CLK_DIVIDER_READ_ONLY flag. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- Is the rate actually changing? Or is it just a problem that we may be writing the register to the same value it already is? If rate and parant_rate are different, it can write the register to different value. Even if the value is same but i think it's unnecessary to re-write the register. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
On 04/07, Joonyoung Shim wrote: > Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed > by set_rate callback. Don't change divider setting from set_rate > callback of divider with CLK_DIVIDER_READ_ONLY flag. > > Signed-off-by: Joonyoung Shim > --- Is the rate actually changing? Or is it just a problem that we may be writing the register to the same value it already is? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
On 04/07, Joonyoung Shim wrote: Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed by set_rate callback. Don't change divider setting from set_rate callback of divider with CLK_DIVIDER_READ_ONLY flag. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- Is the rate actually changing? Or is it just a problem that we may be writing the register to the same value it already is? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed by set_rate callback. Don't change divider setting from set_rate callback of divider with CLK_DIVIDER_READ_ONLY flag. Signed-off-by: Joonyoung Shim --- drivers/clk/clk-divider.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 25006a8..ce34d29a 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -384,6 +384,9 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long flags = 0; u32 val; + if (divider->flags & CLK_DIVIDER_READ_ONLY) + return 0; + value = divider_get_val(rate, parent_rate, divider->table, divider->width, divider->flags); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag
Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed by set_rate callback. Don't change divider setting from set_rate callback of divider with CLK_DIVIDER_READ_ONLY flag. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/clk/clk-divider.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 25006a8..ce34d29a 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -384,6 +384,9 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long flags = 0; u32 val; + if (divider-flags CLK_DIVIDER_READ_ONLY) + return 0; + value = divider_get_val(rate, parent_rate, divider-table, divider-width, divider-flags); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/