@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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_hw **parent_hws,
+ 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_hws)
+ init.parent_hws = (const struct clk_hw **)parent_hws;
+ 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_hw **parent_hws,
+ u8 num_parents)
{
return _at91sam9x5_clk_register_usb(regmap, name, parent_names,
- num_parents, SAM9X5_USBS_MASK);
+ parent_hws, 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_hw **parent_hws,
+ u8 num_parents)
{
return _at91sam9x5_clk_register_usb(regmap, name, parent_names,
- num_parents, SAM9X60_USBS_MASK);
+ parent_hws, 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_hw *parent_hw)
{
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_hw)
+ init.parent_hws = (const struct clk_hw **)&parent_hw;
+ 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_hw *parent_hw,
+ 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_hw)
+ init.parent_hws = (const struct clk_hw **)&parent_hw;
+ else
+ init.parent_names = &parent_name;
init.num_parents = 1;
init.flags = CLK_SET_RATE_PARENT;
@@ -945,7 +945,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;
@@ -975,7 +975,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;
@@ -1008,7 +1008,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;
@@ -257,16 +257,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_hw **parent_hws,
+ 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_hw *parent_hw);
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_hw **parent_hws,
+ 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_hw *parent_hw,
+ const u32 *divisors);
struct clk_hw * __init
at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
@@ -297,7 +297,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;
@@ -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;
@@ -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;
@@ -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;
Add support for parent_hw in usb clock driver. With this parent-child relation is described with pointers rather than strings making registration a bit faster. 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. Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> --- 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/sama5d2.c | 2 +- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 12 files changed, 46 insertions(+), 30 deletions(-)