Skip to content

Commit 1fbef61

Browse files
mranostayvinodkoul
authored andcommitted
phy: ti: phy-j721e-wiz: stop name conflict if multiple serdes are initialized
When multiple serdes instances are initialized the first will succeed but additional will conflict over clocks names and probing fails. Signed-off-by: Matt Ranostay <mranostay@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Link: https://lore.kernel.org/r/20220909200026.3422-1-mranostay@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 931c05a commit 1fbef61

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/phy/ti/phy-j721e-wiz.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,8 @@ static int wiz_phy_en_refclk_register(struct wiz *wiz)
717717
struct device *dev = wiz->dev;
718718
struct clk_init_data *init;
719719
struct clk *clk;
720+
char *clk_name;
721+
unsigned int sz;
720722

721723
wiz_phy_en_refclk = devm_kzalloc(dev, sizeof(*wiz_phy_en_refclk), GFP_KERNEL);
722724
if (!wiz_phy_en_refclk)
@@ -726,12 +728,23 @@ static int wiz_phy_en_refclk_register(struct wiz *wiz)
726728

727729
init->ops = &wiz_phy_en_refclk_ops;
728730
init->flags = 0;
729-
init->name = output_clk_names[TI_WIZ_PHY_EN_REFCLK];
731+
732+
sz = strlen(dev_name(dev)) + strlen(output_clk_names[TI_WIZ_PHY_EN_REFCLK]) + 2;
733+
734+
clk_name = kzalloc(sz, GFP_KERNEL);
735+
if (!clk_name)
736+
return -ENOMEM;
737+
738+
snprintf(clk_name, sz, "%s_%s", dev_name(dev), output_clk_names[TI_WIZ_PHY_EN_REFCLK]);
739+
init->name = clk_name;
730740

731741
wiz_phy_en_refclk->phy_en_refclk = wiz->phy_en_refclk;
732742
wiz_phy_en_refclk->hw.init = init;
733743

734744
clk = devm_clk_register(dev, &wiz_phy_en_refclk->hw);
745+
746+
kfree(clk_name);
747+
735748
if (IS_ERR(clk))
736749
return PTR_ERR(clk);
737750

0 commit comments

Comments
 (0)