> On 26.08.07 19:29, Changhuang Liang wrote: > Introduce inverter and divider for starfive clocks.
Maybe you mean an inverted divider? Not inverter and divider Best regards, Hal > > Signed-off-by: Changhuang Liang <[email protected]> > --- > drivers/clk/starfive/clk-starfive-common.c | 12 ++++++++++++ > drivers/clk/starfive/clk-starfive-common.h | 8 ++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/drivers/clk/starfive/clk-starfive-common.c > b/drivers/clk/starfive/clk-starfive-common.c > index 1b5e56af4138..58ab93d9748b 100644 > --- a/drivers/clk/starfive/clk-starfive-common.c > +++ b/drivers/clk/starfive/clk-starfive-common.c > @@ -300,6 +300,15 @@ static const struct clk_ops starfive_clk_inv_ops = { > .debug_init = starfive_clk_debug_init, }; > > +static const struct clk_ops starfive_clk_idiv_ops = { > + .get_phase = starfive_clk_get_phase, > + .set_phase = starfive_clk_set_phase, > + .recalc_rate = starfive_clk_recalc_rate, > + .determine_rate = starfive_clk_determine_rate, > + .set_rate = starfive_clk_set_rate, > + .debug_init = starfive_clk_debug_init, }; > + > const struct clk_ops *starfive_clk_ops(u32 max) { > if (max & STARFIVE_CLK_DIV_MASK) { > @@ -310,6 +319,9 @@ const struct clk_ops *starfive_clk_ops(u32 max) > } > if (max & STARFIVE_CLK_ENABLE) > return &starfive_clk_gdiv_ops; > + else if (max & STARFIVE_CLK_INVERT) > + return &starfive_clk_idiv_ops; > + > if (max == STARFIVE_CLK_FRAC_MAX) > return &starfive_clk_fdiv_ops; > return &starfive_clk_div_ops; > diff --git a/drivers/clk/starfive/clk-starfive-common.h > b/drivers/clk/starfive/clk-starfive-common.h > index 4cd4357f8366..fd9d13735896 100644 > --- a/drivers/clk/starfive/clk-starfive-common.h > +++ b/drivers/clk/starfive/clk-starfive-common.h > @@ -104,6 +104,14 @@ struct starfive_clk_data { > .parents = { [0] = _parent }, > \ > } > > +#define STARFIVE_IDIV(_idx, _name, _flags, _max, _parent) > \ > +[_idx] = { > \ > + .name = _name, > \ > + .flags = _flags, > \ > + .max = STARFIVE_CLK_INVERT | (_max), > \ > + .parents = { [0] = _parent }, > \ > +} > + > struct starfive_clk { > struct clk_hw hw; > unsigned int idx; > -- > 2.25.1

