From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Add support for clk_parent_data in usb clock driver.
All the SoC based drivers that rely on clk-usb were adapted
to the new API change. The switch itself for SoCs will be done
in subsequent patches.
Remove the use of __clk_get_hw() for the slow clocks.
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
[ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes.
Change how the main_xtal and slcks are initialized so they match the
parent_data API]
Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
---
drivers/clk/at91/at91rm9200.c | 2 +-
drivers/clk/at91/at91sam9260.c | 2 +-
drivers/clk/at91/at91sam9g45.c | 2 +-
drivers/clk/at91/at91sam9n12.c | 2 +-
drivers/clk/at91/at91sam9x5.c | 2 +-
drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------
drivers/clk/at91/dt-compat.c | 6 ++---
drivers/clk/at91/pmc.h | 11 +++++----
drivers/clk/at91/sam9x60.c | 2 +-
drivers/clk/at91/sam9x7.c | 21 +++++++++--------
drivers/clk/at91/sama5d2.c | 2 +-
drivers/clk/at91/sama5d3.c | 2 +-
drivers/clk/at91/sama5d4.c | 2 +-
drivers/clk/at91/sama7d65.c | 24 +++++++++++---------
14 files changed, 72 insertions(+), 49 deletions(-)
diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c
index 3f19e737ae4d..e5a034f208d8 100644
--- a/drivers/clk/at91/at91rm9200.c
+++ b/drivers/clk/at91/at91rm9200.c
@@ -157,7 +157,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
at91rm9200_pmc->chws[PMC_MCK] = hw;
- hw = at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", usb_div);
+ hw = at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", NULL, usb_div);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c
index 0799a13060ea..ae6f126f204a 100644
--- a/drivers/clk/at91/at91sam9260.c
+++ b/drivers/clk/at91/at91sam9260.c
@@ -434,7 +434,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
at91sam9260_pmc->chws[PMC_MCK] = hw;
- hw = at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", usb_div);
+ hw = at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", NULL, usb_div);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
index f45a7b80f7d8..684d2bcb36e8 100644
--- a/drivers/clk/at91/at91sam9g45.c
+++ b/drivers/clk/at91/at91sam9g45.c
@@ -176,7 +176,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
parent_names[0] = "plladivck";
parent_names[1] = "utmick";
- hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2);
+ hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
index 751786184ae2..9fc20b177b13 100644
--- a/drivers/clk/at91/at91sam9n12.c
+++ b/drivers/clk/at91/at91sam9n12.c
@@ -201,7 +201,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
at91sam9n12_pmc->chws[PMC_MCK] = hw;
- hw = at91sam9n12_clk_register_usb(regmap, "usbck", "pllbck");
+ hw = at91sam9n12_clk_register_usb(regmap, "usbck", "pllbck", NULL);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 3b801d12fac0..5728cfb9036f 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -222,7 +222,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
parent_names[0] = "plladivck";
parent_names[1] = "utmick";
- hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2);
+ hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index b0696a928aa9..b2503fad4543 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -221,12 +221,12 @@ static const struct clk_ops at91sam9n12_usb_ops = {
static struct clk_hw * __init
_at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
- const char **parent_names, u8 num_parents,
- u32 usbs_mask)
+ const char **parent_names, struct clk_parent_data *parent_data,
+ u8 num_parents, u32 usbs_mask)
{
struct at91sam9x5_clk_usb *usb;
struct clk_hw *hw;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
usb = kzalloc(sizeof(*usb), GFP_KERNEL);
@@ -235,7 +235,10 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &at91sam9x5_usb_ops;
- init.parent_names = parent_names;
+ if (parent_data)
+ init.parent_data = (const struct clk_parent_data *)parent_data;
+ else
+ init.parent_names = parent_names;
init.num_parents = num_parents;
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
CLK_SET_RATE_PARENT;
@@ -257,27 +260,30 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
struct clk_hw * __init
at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
- const char **parent_names, u8 num_parents)
+ const char **parent_names, struct clk_parent_data *parent_data,
+ u8 num_parents)
{
return _at91sam9x5_clk_register_usb(regmap, name, parent_names,
- num_parents, SAM9X5_USBS_MASK);
+ parent_data, num_parents, SAM9X5_USBS_MASK);
}
struct clk_hw * __init
sam9x60_clk_register_usb(struct regmap *regmap, const char *name,
- const char **parent_names, u8 num_parents)
+ const char **parent_names, struct clk_parent_data *parent_data,
+ u8 num_parents)
{
return _at91sam9x5_clk_register_usb(regmap, name, parent_names,
- num_parents, SAM9X60_USBS_MASK);
+ parent_data, num_parents,
+ SAM9X60_USBS_MASK);
}
struct clk_hw * __init
at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name,
- const char *parent_name)
+ const char *parent_name, struct clk_parent_data *parent_data)
{
struct at91sam9x5_clk_usb *usb;
struct clk_hw *hw;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
usb = kzalloc(sizeof(*usb), GFP_KERNEL);
@@ -286,7 +292,10 @@ at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &at91sam9n12_usb_ops;
- init.parent_names = &parent_name;
+ if (parent_data)
+ init.parent_data = (const struct clk_parent_data *)parent_data;
+ else
+ init.parent_names = &parent_name;
init.num_parents = 1;
init.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT;
@@ -390,11 +399,12 @@ static const struct clk_ops at91rm9200_usb_ops = {
struct clk_hw * __init
at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
- const char *parent_name, const u32 *divisors)
+ const char *parent_name, struct clk_parent_data *parent_data,
+ const u32 *divisors)
{
struct at91rm9200_clk_usb *usb;
struct clk_hw *hw;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
usb = kzalloc(sizeof(*usb), GFP_KERNEL);
@@ -403,7 +413,10 @@ at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &at91rm9200_usb_ops;
- init.parent_names = &parent_name;
+ if (parent_data)
+ init.parent_data = (const struct clk_parent_data *)parent_data;
+ else
+ init.parent_names = &parent_name;
init.num_parents = 1;
init.flags = CLK_SET_RATE_PARENT;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index f5a5f9ba7634..7883198f6a98 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -946,7 +946,7 @@ static void __init of_at91sam9x5_clk_usb_setup(struct device_node *np)
if (IS_ERR(regmap))
return;
- hw = at91sam9x5_clk_register_usb(regmap, name, parent_names,
+ hw = at91sam9x5_clk_register_usb(regmap, name, parent_names, NULL,
num_parents);
if (IS_ERR(hw))
return;
@@ -976,7 +976,7 @@ static void __init of_at91sam9n12_clk_usb_setup(struct device_node *np)
if (IS_ERR(regmap))
return;
- hw = at91sam9n12_clk_register_usb(regmap, name, parent_name);
+ hw = at91sam9n12_clk_register_usb(regmap, name, parent_name, NULL);
if (IS_ERR(hw))
return;
@@ -1009,7 +1009,7 @@ static void __init of_at91rm9200_clk_usb_setup(struct device_node *np)
of_node_put(parent_np);
if (IS_ERR(regmap))
return;
- hw = at91rm9200_clk_register_usb(regmap, name, parent_name, divisors);
+ hw = at91rm9200_clk_register_usb(regmap, name, parent_name, NULL, divisors);
if (IS_ERR(hw))
return;
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 2aa84c49bd2f..84dc53849ae2 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -288,16 +288,19 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
struct clk_hw * __init
at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
- const char **parent_names, u8 num_parents);
+ const char **parent_names, struct clk_parent_data *parent_data,
+ u8 num_parents);
struct clk_hw * __init
at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name,
- const char *parent_name);
+ const char *parent_name, struct clk_parent_data *parent_data);
struct clk_hw * __init
sam9x60_clk_register_usb(struct regmap *regmap, const char *name,
- const char **parent_names, u8 num_parents);
+ const char **parent_names, struct clk_parent_data *parent_data,
+ u8 num_parents);
struct clk_hw * __init
at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
- const char *parent_name, const u32 *divisors);
+ const char *parent_name, struct clk_parent_data *parent_data,
+ const u32 *divisors);
struct clk_hw * __init
at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
index bee35c65aceb..2ab7deab95f3 100644
--- a/drivers/clk/at91/sam9x60.c
+++ b/drivers/clk/at91/sam9x60.c
@@ -308,7 +308,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
parent_names[0] = "pllack_divck";
parent_names[1] = "upllck_divck";
parent_names[2] = "main_osc";
- hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3);
+ hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, NULL, 3);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c
index 0266119e125e..536f1271d62a 100644
--- a/drivers/clk/at91/sam9x7.c
+++ b/drivers/clk/at91/sam9x7.c
@@ -746,12 +746,12 @@ static void __init sam9x7_pmc_setup(struct device_node *np)
struct clk_range range = CLK_RANGE(0, 0);
const char *main_xtal_name, *td_slck_name, *md_slck_name;
struct pmc_data *sam9x7_pmc;
- const char *parent_names[9];
void **clk_mux_buffer = NULL;
int clk_mux_buffer_size = 0;
struct regmap *regmap;
- struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw;
+ struct clk_hw *hw, *main_rc_hw, *main_osc_hw;
struct clk_hw *usbck_hw;
+ struct clk *main_xtal;
struct clk_parent_data parent_data[9];
int i, j;
@@ -816,18 +816,21 @@ static void __init sam9x7_pmc_setup(struct device_node *np)
switch (sam9x7_plls[i][j].p) {
case SAM9X7_PLL_PARENT_MAINCK:
parent_data[0] = AT91_CLK_PD_NAME("mainck");
- hw = sam9x7_pmc->chws[PMC_MAIN];
+ parent_rate = clk_hw_get_rate(sam9x7_pmc->chws[PMC_MAIN]);
break;
case SAM9X7_PLL_PARENT_MAIN_XTAL:
+ main_xtal = of_clk_get_by_name(np, main_xtal_name);
+ if (IS_ERR(main_xtal))
+ goto err_free;
parent_data[0] = AT91_CLK_PD_NAME(main_xtal_name);
- hw = main_xtal_hw;
+ parent_rate = clk_get_rate(main_xtal);
+ clk_put(main_xtal);
break;
default:
/* Should not happen. */
break;
}
- parent_rate = clk_hw_get_rate(hw);
if (!parent_rate)
return;
@@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct device_node *np)
sam9x7_pmc->chws[PMC_MCK] = hw;
- parent_names[0] = "plla_divpmcck";
- parent_names[1] = "upll_divpmcck";
- parent_names[2] = "main_osc";
- usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3);
+ parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw);
+ parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw);
+ parent_data[2] = AT91_CLK_PD_HW(main_osc_hw);
+ usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3);
if (IS_ERR(usbck_hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index c16594fce90c..8bbc34e22cda 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -284,7 +284,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
parent_names[0] = "plladivck";
parent_names[1] = "utmick";
- hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2);
+ hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index 522ce6031446..05d0cdd22bc4 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -201,7 +201,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
parent_names[0] = "plladivck";
parent_names[1] = "utmick";
- hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2);
+ hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index 160c0bddb6a3..da84b4cef827 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -222,7 +222,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
parent_names[0] = "plladivck";
parent_names[1] = "utmick";
- hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2);
+ hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c
index faad4fd28e85..986e8ef57dea 100644
--- a/drivers/clk/at91/sama7d65.c
+++ b/drivers/clk/at91/sama7d65.c
@@ -1095,11 +1095,11 @@ static void __init sama7d65_pmc_setup(struct device_node *np)
{
const char *main_xtal_name, *md_slck_name, *td_slck_name;
struct pmc_data *sama7d65_pmc;
- const char *parent_names[11];
void **alloc_mem = NULL;
int alloc_mem_size = 0;
+ struct clk *main_xtal;
struct regmap *regmap;
- struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw;
+ struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *usbck_hw;
struct clk_parent_data parent_data[10];
bool bypass;
int i, j;
@@ -1169,17 +1169,21 @@ static void __init sama7d65_pmc_setup(struct device_node *np)
switch (sama7d65_plls[i][j].p) {
case SAMA7D65_PLL_PARENT_MAINCK:
parent_data[0] = AT91_CLK_PD_NAME("mainck");
- hw = sama7d65_pmc->chws[PMC_MAIN];
+ parent_rate = clk_hw_get_rate(sama7d65_pmc->chws[PMC_MAIN]);
break;
case SAMA7D65_PLL_PARENT_MAIN_XTAL:
+ main_xtal = of_clk_get_by_name(np, main_xtal_name);
+ if (IS_ERR(main_xtal))
+ goto err_free;
parent_data[0] = AT91_CLK_PD_NAME(main_xtal_name);
- hw = main_xtal_hw;
+ parent_rate = clk_get_rate(main_xtal);
+ clk_put(main_xtal);
break;
default:
/* Should not happen. */
break;
}
- parent_rate = clk_hw_get_rate(hw);
+
if (!parent_rate)
return;
@@ -1263,11 +1267,11 @@ static void __init sama7d65_pmc_setup(struct device_node *np)
sama7d65_pmc->chws[sama7d65_mckx[i].eid] = hw;
}
- parent_names[0] = "syspll_divpmcck";
- parent_names[1] = "usbpll_divpmcck";
- parent_names[2] = "main_osc";
- hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3);
- if (IS_ERR(hw))
+ parent_data[0] = AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_SYS][PLL_COMPID_DIV0].hw);
+ parent_data[1] = AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_USB][PLL_COMPID_DIV0].hw);
+ parent_data[2] = AT91_CLK_PD_HW(main_osc_hw);
+ usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3);
+ if (IS_ERR(usbck_hw))
goto err_free;
parent_data[0] = AT91_CLK_PD_NAME(md_slck_name);
--
2.43.0
Hi, Ryan, On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: > From: Claudiu Beznea <claudiu.beznea@tuxon.dev> > > Add support for clk_parent_data in usb clock driver. > > All the SoC based drivers that rely on clk-usb were adapted > to the new API change. The switch itself for SoCs will be done > in subsequent patches. > > Remove the use of __clk_get_hw() for the slow clocks. > > Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> > [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. > Change how the main_xtal and slcks are initialized so they match the > parent_data API] > Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> > --- > drivers/clk/at91/at91rm9200.c | 2 +- > drivers/clk/at91/at91sam9260.c | 2 +- > drivers/clk/at91/at91sam9g45.c | 2 +- > drivers/clk/at91/at91sam9n12.c | 2 +- > drivers/clk/at91/at91sam9x5.c | 2 +- > drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------ > drivers/clk/at91/dt-compat.c | 6 ++--- > drivers/clk/at91/pmc.h | 11 +++++---- > drivers/clk/at91/sam9x60.c | 2 +- > drivers/clk/at91/sam9x7.c | 21 +++++++++-------- > drivers/clk/at91/sama5d2.c | 2 +- > drivers/clk/at91/sama5d3.c | 2 +- > drivers/clk/at91/sama5d4.c | 2 +- > drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- > 14 files changed, 72 insertions(+), 49 deletions(-) > [ ... ] > @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct device_node *np) > > sam9x7_pmc->chws[PMC_MCK] = hw; > > - parent_names[0] = "plla_divpmcck"; > - parent_names[1] = "upll_divpmcck"; > - parent_names[2] = "main_osc"; > - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); > + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw); > + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw); > + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); > + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3); sam9x60_clk_register_usb() could be converted to use parent_hws member of struct clk_init_data instead of parent_data.
On 10/20/25 12:17, Claudiu Beznea wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > Hi, Ryan, > > On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: >> From: Claudiu Beznea <claudiu.beznea@tuxon.dev> >> >> Add support for clk_parent_data in usb clock driver. >> >> All the SoC based drivers that rely on clk-usb were adapted >> to the new API change. The switch itself for SoCs will be done >> in subsequent patches. >> >> Remove the use of __clk_get_hw() for the slow clocks. >> >> Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> >> [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. >> Change how the main_xtal and slcks are initialized so they match the >> parent_data API] >> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> >> --- >> drivers/clk/at91/at91rm9200.c | 2 +- >> drivers/clk/at91/at91sam9260.c | 2 +- >> drivers/clk/at91/at91sam9g45.c | 2 +- >> drivers/clk/at91/at91sam9n12.c | 2 +- >> drivers/clk/at91/at91sam9x5.c | 2 +- >> drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------ >> drivers/clk/at91/dt-compat.c | 6 ++--- >> drivers/clk/at91/pmc.h | 11 +++++---- >> drivers/clk/at91/sam9x60.c | 2 +- >> drivers/clk/at91/sam9x7.c | 21 +++++++++-------- >> drivers/clk/at91/sama5d2.c | 2 +- >> drivers/clk/at91/sama5d3.c | 2 +- >> drivers/clk/at91/sama5d4.c | 2 +- >> drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- >> 14 files changed, 72 insertions(+), 49 deletions(-) >> > > [ ... ] > >> @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct device_node *np) >> >> sam9x7_pmc->chws[PMC_MCK] = hw; >> >> - parent_names[0] = "plla_divpmcck"; >> - parent_names[1] = "upll_divpmcck"; >> - parent_names[2] = "main_osc"; >> - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); >> + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw); >> + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw); >> + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); >> + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3); > > sam9x60_clk_register_usb() could be converted to use parent_hws member of > struct clk_init_data instead of parent_data. Looking more in depth sam9x60_clk_register_usb() calls at91sam9x_clk_register_usb() which like in 21/31 is called in dt-compact and only the clock name is passed into it. Should I make another function for sam9x60_clk_register_usb() that uses parent_hw? Ryan>
On 1/12/26 23:25, Ryan Wanner wrote: > On 10/20/25 12:17, Claudiu Beznea wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe >> >> Hi, Ryan, >> >> On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: >>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>> >>> Add support for clk_parent_data in usb clock driver. >>> >>> All the SoC based drivers that rely on clk-usb were adapted >>> to the new API change. The switch itself for SoCs will be done >>> in subsequent patches. >>> >>> Remove the use of __clk_get_hw() for the slow clocks. >>> >>> Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>> [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. >>> Change how the main_xtal and slcks are initialized so they match the >>> parent_data API] >>> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> >>> --- >>> drivers/clk/at91/at91rm9200.c | 2 +- >>> drivers/clk/at91/at91sam9260.c | 2 +- >>> drivers/clk/at91/at91sam9g45.c | 2 +- >>> drivers/clk/at91/at91sam9n12.c | 2 +- >>> drivers/clk/at91/at91sam9x5.c | 2 +- >>> drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------ >>> drivers/clk/at91/dt-compat.c | 6 ++--- >>> drivers/clk/at91/pmc.h | 11 +++++---- >>> drivers/clk/at91/sam9x60.c | 2 +- >>> drivers/clk/at91/sam9x7.c | 21 +++++++++-------- >>> drivers/clk/at91/sama5d2.c | 2 +- >>> drivers/clk/at91/sama5d3.c | 2 +- >>> drivers/clk/at91/sama5d4.c | 2 +- >>> drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- >>> 14 files changed, 72 insertions(+), 49 deletions(-) >>> >> >> [ ... ] >> >>> @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct device_node *np) >>> >>> sam9x7_pmc->chws[PMC_MCK] = hw; >>> >>> - parent_names[0] = "plla_divpmcck"; >>> - parent_names[1] = "upll_divpmcck"; >>> - parent_names[2] = "main_osc"; >>> - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); >>> + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw); >>> + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw); >>> + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); >>> + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3); >> >> sam9x60_clk_register_usb() could be converted to use parent_hws member of >> struct clk_init_data instead of parent_data. > > Looking more in depth sam9x60_clk_register_usb() calls > at91sam9x_clk_register_usb() which like in 21/31 is called in dt-compact > and only the clock name is passed into it. Should I make another > function for sam9x60_clk_register_usb() that uses parent_hw? OK! To not overcomplicate this series, let's keep it as is for now. Thank you, Claudiu
On 10/20/25 12:17, Claudiu Beznea wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > Hi, Ryan, > > On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: >> From: Claudiu Beznea <claudiu.beznea@tuxon.dev> >> >> Add support for clk_parent_data in usb clock driver. >> >> All the SoC based drivers that rely on clk-usb were adapted >> to the new API change. The switch itself for SoCs will be done >> in subsequent patches. >> >> Remove the use of __clk_get_hw() for the slow clocks. >> >> Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> >> [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. >> Change how the main_xtal and slcks are initialized so they match the >> parent_data API] >> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> >> --- >> drivers/clk/at91/at91rm9200.c | 2 +- >> drivers/clk/at91/at91sam9260.c | 2 +- >> drivers/clk/at91/at91sam9g45.c | 2 +- >> drivers/clk/at91/at91sam9n12.c | 2 +- >> drivers/clk/at91/at91sam9x5.c | 2 +- >> drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------ >> drivers/clk/at91/dt-compat.c | 6 ++--- >> drivers/clk/at91/pmc.h | 11 +++++---- >> drivers/clk/at91/sam9x60.c | 2 +- >> drivers/clk/at91/sam9x7.c | 21 +++++++++-------- >> drivers/clk/at91/sama5d2.c | 2 +- >> drivers/clk/at91/sama5d3.c | 2 +- >> drivers/clk/at91/sama5d4.c | 2 +- >> drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- >> 14 files changed, 72 insertions(+), 49 deletions(-) >> > > [ ... ] > >> @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct device_node *np) >> >> sam9x7_pmc->chws[PMC_MCK] = hw; >> >> - parent_names[0] = "plla_divpmcck"; >> - parent_names[1] = "upll_divpmcck"; >> - parent_names[2] = "main_osc"; >> - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); >> + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw); >> + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw); >> + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); >> + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3); > > sam9x60_clk_register_usb() could be converted to use parent_hws member of > struct clk_init_data instead of parent_data. So this would mean that I would pass in an array of the plls as parent_hws, and use that to load the clk_init_data struct instead of filling the array of parent_data as it is changed to in this patch set? And this would be functionally the same since parent_data points to clk_hw?>
On 12/18/25 18:23, Ryan.Wanner@microchip.com wrote: > On 10/20/25 12:17, Claudiu Beznea wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe >> >> Hi, Ryan, >> >> On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: >>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>> >>> Add support for clk_parent_data in usb clock driver. >>> >>> All the SoC based drivers that rely on clk-usb were adapted >>> to the new API change. The switch itself for SoCs will be done >>> in subsequent patches. >>> >>> Remove the use of __clk_get_hw() for the slow clocks. >>> >>> Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>> [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. >>> Change how the main_xtal and slcks are initialized so they match the >>> parent_data API] >>> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> >>> --- >>> drivers/clk/at91/at91rm9200.c | 2 +- >>> drivers/clk/at91/at91sam9260.c | 2 +- >>> drivers/clk/at91/at91sam9g45.c | 2 +- >>> drivers/clk/at91/at91sam9n12.c | 2 +- >>> drivers/clk/at91/at91sam9x5.c | 2 +- >>> drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------ >>> drivers/clk/at91/dt-compat.c | 6 ++--- >>> drivers/clk/at91/pmc.h | 11 +++++---- >>> drivers/clk/at91/sam9x60.c | 2 +- >>> drivers/clk/at91/sam9x7.c | 21 +++++++++-------- >>> drivers/clk/at91/sama5d2.c | 2 +- >>> drivers/clk/at91/sama5d3.c | 2 +- >>> drivers/clk/at91/sama5d4.c | 2 +- >>> drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- >>> 14 files changed, 72 insertions(+), 49 deletions(-) >>> >> >> [ ... ] >> >>> @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct device_node *np) >>> >>> sam9x7_pmc->chws[PMC_MCK] = hw; >>> >>> - parent_names[0] = "plla_divpmcck"; >>> - parent_names[1] = "upll_divpmcck"; >>> - parent_names[2] = "main_osc"; >>> - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); >>> + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw); >>> + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw); >>> + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); >>> + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data, 3); >> >> sam9x60_clk_register_usb() could be converted to use parent_hws member of >> struct clk_init_data instead of parent_data. > > So this would mean that I would pass in an array of the plls as > parent_hws, and use that to load the clk_init_data struct instead of > filling the array of parent_data as it is changed to in this patch set? > > And this would be functionally the same since parent_data points to > clk_hw?> > It should be something like: usb = kzalloc(sizeof(*usb), GFP_KERNEL); @@ -235,7 +235,10 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, const clk_hw **parent_hws) init.name = name; init.ops = &at91sam9x5_usb_ops; - init.parent_names = parent_names; + if (parent_hws) + init.parent_hws = parent_hws; + else + init.parent_names = parent_names; Thank you, Claudiu
On 12/23/25 07:00, claudiu beznea wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know > the content is safe > > On 12/18/25 18:23, Ryan.Wanner@microchip.com wrote: >> On 10/20/25 12:17, Claudiu Beznea wrote: >>> EXTERNAL EMAIL: Do not click links or open attachments unless you >>> know the content is safe >>> >>> Hi, Ryan, >>> >>> On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: >>>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>>> >>>> Add support for clk_parent_data in usb clock driver. >>>> >>>> All the SoC based drivers that rely on clk-usb were adapted >>>> to the new API change. The switch itself for SoCs will be done >>>> in subsequent patches. >>>> >>>> Remove the use of __clk_get_hw() for the slow clocks. >>>> >>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>>> [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. >>>> Change how the main_xtal and slcks are initialized so they match the >>>> parent_data API] >>>> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> >>>> --- >>>> drivers/clk/at91/at91rm9200.c | 2 +- >>>> drivers/clk/at91/at91sam9260.c | 2 +- >>>> drivers/clk/at91/at91sam9g45.c | 2 +- >>>> drivers/clk/at91/at91sam9n12.c | 2 +- >>>> drivers/clk/at91/at91sam9x5.c | 2 +- >>>> drivers/clk/at91/clk-usb.c | 41 +++++++++++++++++++++ >>>> +------------ >>>> drivers/clk/at91/dt-compat.c | 6 ++--- >>>> drivers/clk/at91/pmc.h | 11 +++++---- >>>> drivers/clk/at91/sam9x60.c | 2 +- >>>> drivers/clk/at91/sam9x7.c | 21 +++++++++-------- >>>> drivers/clk/at91/sama5d2.c | 2 +- >>>> drivers/clk/at91/sama5d3.c | 2 +- >>>> drivers/clk/at91/sama5d4.c | 2 +- >>>> drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- >>>> 14 files changed, 72 insertions(+), 49 deletions(-) >>>> >>> >>> [ ... ] >>> >>>> @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct >>>> device_node *np) >>>> >>>> sam9x7_pmc->chws[PMC_MCK] = hw; >>>> >>>> - parent_names[0] = "plla_divpmcck"; >>>> - parent_names[1] = "upll_divpmcck"; >>>> - parent_names[2] = "main_osc"; >>>> - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", >>>> parent_names, 3); >>>> + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA] >>>> [PLL_COMPID_DIV0].hw); >>>> + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL] >>>> [PLL_COMPID_DIV0].hw); >>>> + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); >>>> + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, >>>> parent_data, 3); >>> >>> sam9x60_clk_register_usb() could be converted to use parent_hws >>> member of >>> struct clk_init_data instead of parent_data. >> >> So this would mean that I would pass in an array of the plls as >> parent_hws, and use that to load the clk_init_data struct instead of >> filling the array of parent_data as it is changed to in this patch set? >> >> And this would be functionally the same since parent_data points to >> clk_hw?> >> > > It should be something like: I see, I guess my question is why the usbclk system only? Is it just due to how little parents there are for the usbclk? Or is it because this is the only clock that only uses clk_hw for all of its parents? > > usb = kzalloc(sizeof(*usb), GFP_KERNEL); > @@ -235,7 +235,10 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, > const > char *name, const clk_hw **parent_hws) > > init.name = name; > init.ops = &at91sam9x5_usb_ops; > - init.parent_names = parent_names; > + if (parent_hws) > + init.parent_hws = parent_hws; > + else > + init.parent_names = parent_names; > > Thank you, > Claudiu Thank you, Ryan
Hi, Ryan, Sorry for the late reply, I was off for a while. On 1/5/26 19:58, Ryan.Wanner@microchip.com wrote: > On 12/23/25 07:00, claudiu beznea wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know >> the content is safe >> >> On 12/18/25 18:23, Ryan.Wanner@microchip.com wrote: >>> On 10/20/25 12:17, Claudiu Beznea wrote: >>>> EXTERNAL EMAIL: Do not click links or open attachments unless you >>>> know the content is safe >>>> >>>> Hi, Ryan, >>>> >>>> On 9/19/25 00:15, Ryan.Wanner@microchip.com wrote: >>>>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>>>> >>>>> Add support for clk_parent_data in usb clock driver. >>>>> >>>>> All the SoC based drivers that rely on clk-usb were adapted >>>>> to the new API change. The switch itself for SoCs will be done >>>>> in subsequent patches. >>>>> >>>>> Remove the use of __clk_get_hw() for the slow clocks. >>>>> >>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> >>>>> [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. >>>>> Change how the main_xtal and slcks are initialized so they match the >>>>> parent_data API] >>>>> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> >>>>> --- >>>>> drivers/clk/at91/at91rm9200.c | 2 +- >>>>> drivers/clk/at91/at91sam9260.c | 2 +- >>>>> drivers/clk/at91/at91sam9g45.c | 2 +- >>>>> drivers/clk/at91/at91sam9n12.c | 2 +- >>>>> drivers/clk/at91/at91sam9x5.c | 2 +- >>>>> drivers/clk/at91/clk-usb.c | 41 +++++++++++++++++++++ >>>>> +------------ >>>>> drivers/clk/at91/dt-compat.c | 6 ++--- >>>>> drivers/clk/at91/pmc.h | 11 +++++---- >>>>> drivers/clk/at91/sam9x60.c | 2 +- >>>>> drivers/clk/at91/sam9x7.c | 21 +++++++++-------- >>>>> drivers/clk/at91/sama5d2.c | 2 +- >>>>> drivers/clk/at91/sama5d3.c | 2 +- >>>>> drivers/clk/at91/sama5d4.c | 2 +- >>>>> drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- >>>>> 14 files changed, 72 insertions(+), 49 deletions(-) >>>>> >>>> >>>> [ ... ] >>>> >>>>> @@ -882,10 +885,10 @@ static void __init sam9x7_pmc_setup(struct >>>>> device_node *np) >>>>> >>>>> sam9x7_pmc->chws[PMC_MCK] = hw; >>>>> >>>>> - parent_names[0] = "plla_divpmcck"; >>>>> - parent_names[1] = "upll_divpmcck"; >>>>> - parent_names[2] = "main_osc"; >>>>> - usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", >>>>> parent_names, 3); >>>>> + parent_data[0] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA] >>>>> [PLL_COMPID_DIV0].hw); >>>>> + parent_data[1] = AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL] >>>>> [PLL_COMPID_DIV0].hw); >>>>> + parent_data[2] = AT91_CLK_PD_HW(main_osc_hw); >>>>> + usbck_hw = sam9x60_clk_register_usb(regmap, "usbck", NULL, >>>>> parent_data, 3); >>>> >>>> sam9x60_clk_register_usb() could be converted to use parent_hws >>>> member of >>>> struct clk_init_data instead of parent_data. >>> >>> So this would mean that I would pass in an array of the plls as >>> parent_hws, and use that to load the clk_init_data struct instead of >>> filling the array of parent_data as it is changed to in this patch set? >>> >>> And this would be functionally the same since parent_data points to >>> clk_hw?> >>> >> >> It should be something like: > > I see, I guess my question is why the usbclk system only? Is it just due > to how little parents there are for the usbclk? Or is it because this is > the only clock that only uses clk_hw for all of its parents? Because this is the only clock that uses clk_hw for all of its parents. Thank you, Claudiu
© 2016 - 2026 Red Hat, Inc.