How to register a "clk-divider" with a "clk_div_table"
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 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.
my question is, what is the proper way to register a divider using ccf in u-boot.
many thanks.
Hi Dhu,
Quoted 2 lines · On 3/18/22 2:24 AM, [email protected] 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/[email protected]/
Quoted 11 lines
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,
u8clk_divider_flags)
- - - - - - - - - - -
it seems don't have a agument to pass a dividertable(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.)
Quoted 7 lines
- - - - - - - - - - -
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,
u8clk_divider_flags, const structclk_div_table*table)
- - - - - - - - - - -
I also grep-ed theclk_register_divider', there onlydrivers/clk/ti/clk-k3.c' used it.
Also used by drivers/clk/imx/clk.h, but it does not use the divider table either.
Quoted 2 lines
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