How to register a "clk-divider" with a "clk_div_table"

Sean Anderson seanga2 at gmail.com
Fri Mar 18 14:38:09 CET 2022


Hi Dhu,

On 3/18/22 2:24 AM, dhu at hodcarrier.org wrote:
> Dear all,
> I am tying to port u-boot to new soc, now i am rewrite my clk driver to use "CCF" clk driver.

I would recommend against that

https://lore.kernel.org/u-boot/20210611041617.1665833-1-seanga2@gmail.com/

> I have find this api:
> - - - - - - - - - - -
> struct clk *clk_register_divider(struct device *dev, const char *name,
>                  const char *parent_name, unsigned long flags,
>                  void __iomem *reg, u8 shift, u8 width,
>                  u8 clk_divider_flags)
> - - - - - - - - - - -
> it seems don't have a agument to pass a divider table(struct clk_div_table),
> and it calls a "static" function below and pass a "NULL" pointer to argument `table'.
> (while this function is static, I should not call it in my driver to pass a divider table.)
> 
> - - - - - - - - - - -
> static struct clk *_register_divider(struct device *dev, const char *name,
>                  const char *parent_name, unsigned long flags,
>                  void __iomem *reg, u8 shift, u8 width,
>                  u8 clk_divider_flags, const struct clk_div_table *table)
> - - - - - - - - - - -
> I also grep-ed the `clk_register_divider', there only `drivers/clk/ti/clk-k3.c' used it.

Also used by drivers/clk/imx/clk.h, but it does not use the divider table either.

> 
> my question is, what is the proper way to register a divider using ccf in u-boot.

Write it yourself. It's effectively as simple as a for loop over the table. You can
also send a patch to extend the existing divider code, but I would only recommend
doing that if you are porting a CCF clock from Linux.

--Sean


More information about the U-Boot mailing list