Message ID | 20220708135450.2845810-2-dmitry.baryshkov@linaro.org |
---|---|
State | New |
Headers | show |
Series | phy: qcom-qmp-ufs: add symbol clocks support | expand |
On 08-07-22, 16:54, Dmitry Baryshkov wrote: > The __clk_hw_register_fixed_rate() is an internal API, which is better > not to be called directly. Add new helper to create fixed rate clocks > using parent clock accuracy. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > drivers/clk/clk-asm9260.c | 6 ++---- > include/linux/clk-provider.h | 14 ++++++++++++++ > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c > index bacebd457e6f..0609b661ff5a 100644 > --- a/drivers/clk/clk-asm9260.c > +++ b/drivers/clk/clk-asm9260.c > @@ -276,10 +276,8 @@ static void __init asm9260_acc_init(struct device_node *np) > > /* TODO: Convert to DT parent scheme */ > ref_clk = of_clk_get_parent_name(np, 0); > - hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk, > - ref_clk, NULL, NULL, 0, rate, 0, > - CLK_FIXED_RATE_PARENT_ACCURACY); > - > + hw = clk_hw_register_fixed_rate_parent_accuracy(NULL, pll_clk, ref_clk, > + 0, rate); Should this not be described in DT instead, resolve the todo :-) > if (IS_ERR(hw)) > panic("%pOFn: can't register REFCLK. Check DT!", np); > > diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h > index 72d937c03a3e..659ef5a77246 100644 > --- a/include/linux/clk-provider.h > +++ b/include/linux/clk-provider.h > @@ -439,6 +439,20 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, > __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \ > (parent_data), NULL, (flags), \ > (fixed_rate), (fixed_accuracy), 0) > +/** > + * clk_hw_register_fixed_rate_parent_accuracy - register fixed-rate clock with > + * the clock framework > + * @dev: device that is registering this clock > + * @name: name of this clock > + * @parent_name: name of clock's parent > + * @flags: framework-specific flags > + * @fixed_rate: non-adjustable clock rate > + */ > +#define clk_hw_register_fixed_rate_parent_accuracy(dev, name, parent_name, \ > + flags, fixed_rate) \ > + __clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \ > + NULL, NULL, (flags), (fixed_rate), 0, \ > + CLK_FIXED_RATE_PARENT_ACCURACY) > > void clk_unregister_fixed_rate(struct clk *clk); > void clk_hw_unregister_fixed_rate(struct clk_hw *hw); > -- > 2.35.1
On 30/08/2022 08:25, Vinod Koul wrote: > On 08-07-22, 16:54, Dmitry Baryshkov wrote: >> The __clk_hw_register_fixed_rate() is an internal API, which is better >> not to be called directly. Add new helper to create fixed rate clocks >> using parent clock accuracy. >> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> >> --- >> drivers/clk/clk-asm9260.c | 6 ++---- >> include/linux/clk-provider.h | 14 ++++++++++++++ >> 2 files changed, 16 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c >> index bacebd457e6f..0609b661ff5a 100644 >> --- a/drivers/clk/clk-asm9260.c >> +++ b/drivers/clk/clk-asm9260.c >> @@ -276,10 +276,8 @@ static void __init asm9260_acc_init(struct device_node *np) >> >> /* TODO: Convert to DT parent scheme */ >> ref_clk = of_clk_get_parent_name(np, 0); >> - hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk, >> - ref_clk, NULL, NULL, 0, rate, 0, >> - CLK_FIXED_RATE_PARENT_ACCURACY); >> - >> + hw = clk_hw_register_fixed_rate_parent_accuracy(NULL, pll_clk, ref_clk, >> + 0, rate); > > Should this not be described in DT instead, resolve the todo :-) > I wanted to abstain from changing the asm9260 too much, but probably we'd have to do that. >> if (IS_ERR(hw)) >> panic("%pOFn: can't register REFCLK. Check DT!", np); >> >> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h >> index 72d937c03a3e..659ef5a77246 100644 >> --- a/include/linux/clk-provider.h >> +++ b/include/linux/clk-provider.h >> @@ -439,6 +439,20 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, >> __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \ >> (parent_data), NULL, (flags), \ >> (fixed_rate), (fixed_accuracy), 0) >> +/** >> + * clk_hw_register_fixed_rate_parent_accuracy - register fixed-rate clock with >> + * the clock framework >> + * @dev: device that is registering this clock >> + * @name: name of this clock >> + * @parent_name: name of clock's parent >> + * @flags: framework-specific flags >> + * @fixed_rate: non-adjustable clock rate >> + */ >> +#define clk_hw_register_fixed_rate_parent_accuracy(dev, name, parent_name, \ >> + flags, fixed_rate) \ >> + __clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \ >> + NULL, NULL, (flags), (fixed_rate), 0, \ >> + CLK_FIXED_RATE_PARENT_ACCURACY) >> >> void clk_unregister_fixed_rate(struct clk *clk); >> void clk_hw_unregister_fixed_rate(struct clk_hw *hw); >> -- >> 2.35.1 >
diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c index bacebd457e6f..0609b661ff5a 100644 --- a/drivers/clk/clk-asm9260.c +++ b/drivers/clk/clk-asm9260.c @@ -276,10 +276,8 @@ static void __init asm9260_acc_init(struct device_node *np) /* TODO: Convert to DT parent scheme */ ref_clk = of_clk_get_parent_name(np, 0); - hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk, - ref_clk, NULL, NULL, 0, rate, 0, - CLK_FIXED_RATE_PARENT_ACCURACY); - + hw = clk_hw_register_fixed_rate_parent_accuracy(NULL, pll_clk, ref_clk, + 0, rate); if (IS_ERR(hw)) panic("%pOFn: can't register REFCLK. Check DT!", np); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 72d937c03a3e..659ef5a77246 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -439,6 +439,20 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \ (parent_data), NULL, (flags), \ (fixed_rate), (fixed_accuracy), 0) +/** + * clk_hw_register_fixed_rate_parent_accuracy - register fixed-rate clock with + * the clock framework + * @dev: device that is registering this clock + * @name: name of this clock + * @parent_name: name of clock's parent + * @flags: framework-specific flags + * @fixed_rate: non-adjustable clock rate + */ +#define clk_hw_register_fixed_rate_parent_accuracy(dev, name, parent_name, \ + flags, fixed_rate) \ + __clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \ + NULL, NULL, (flags), (fixed_rate), 0, \ + CLK_FIXED_RATE_PARENT_ACCURACY) void clk_unregister_fixed_rate(struct clk *clk); void clk_hw_unregister_fixed_rate(struct clk_hw *hw);
The __clk_hw_register_fixed_rate() is an internal API, which is better not to be called directly. Add new helper to create fixed rate clocks using parent clock accuracy. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/clk/clk-asm9260.c | 6 ++---- include/linux/clk-provider.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-)