Commit 6ef7aa32 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Vinod Koul

phy: cadence: Sierra: Replace `clk_register(`) with `clk_hw_register()`

The `devm_clk_register()` API is deprecated. Switch to
`devm_clk_hw_register()`.

Since the driver enables its own internal PLLs using the clock API we
still need to get a reference to the PLL clocks using the
`devm_clk_hw_get_clk()` API.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20230326011416.363318-1-lars@metafoo.deSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent c8481d99
...@@ -371,8 +371,8 @@ struct cdns_sierra_phy { ...@@ -371,8 +371,8 @@ struct cdns_sierra_phy {
u32 num_lanes; u32 num_lanes;
bool autoconf; bool autoconf;
int already_configured; int already_configured;
struct clk_onecell_data clk_data; struct clk *pll_clks[SIERRA_NUM_CMN_PLLC];
struct clk *output_clks[CDNS_SIERRA_OUTPUT_CLOCKS]; struct clk_hw_onecell_data clk_data;
}; };
static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val) static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val)
...@@ -726,6 +726,7 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp, ...@@ -726,6 +726,7 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp,
unsigned int num_parents; unsigned int num_parents;
char clk_name[100]; char clk_name[100];
struct clk *clk; struct clk *clk;
int ret;
int i; int i;
mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL);
...@@ -761,11 +762,14 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp, ...@@ -761,11 +762,14 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp,
mux->termen_field = termen_field; mux->termen_field = termen_field;
mux->hw.init = init; mux->hw.init = init;
clk = devm_clk_register(dev, &mux->hw); ret = devm_clk_hw_register(dev, &mux->hw);
if (IS_ERR(clk)) if (ret)
return PTR_ERR(clk); return ret;
sp->clk_data.hws[clk_index] = &mux->hw;
sp->output_clks[clk_index] = clk; sp->pll_clks[clk_index] = devm_clk_hw_get_clk(dev, &mux->hw,
clk_names[clk_index]);
return 0; return 0;
} }
...@@ -838,7 +842,7 @@ static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp) ...@@ -838,7 +842,7 @@ static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp)
struct clk_init_data *init; struct clk_init_data *init;
struct regmap *regmap; struct regmap *regmap;
char clk_name[100]; char clk_name[100];
struct clk *clk; int ret;
derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL);
if (!derived_refclk) if (!derived_refclk)
...@@ -871,11 +875,11 @@ static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp) ...@@ -871,11 +875,11 @@ static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp)
derived_refclk->hw.init = init; derived_refclk->hw.init = init;
clk = devm_clk_register(dev, &derived_refclk->hw); ret = devm_clk_hw_register(dev, &derived_refclk->hw);
if (IS_ERR(clk)) if (ret)
return PTR_ERR(clk); return ret;
sp->output_clks[CDNS_SIERRA_DERIVED_REFCLK] = clk; sp->clk_data.hws[CDNS_SIERRA_DERIVED_REFCLK] = &derived_refclk->hw;
return 0; return 0;
} }
...@@ -906,9 +910,9 @@ static int cdns_sierra_clk_register(struct cdns_sierra_phy *sp) ...@@ -906,9 +910,9 @@ static int cdns_sierra_clk_register(struct cdns_sierra_phy *sp)
return ret; return ret;
} }
sp->clk_data.clks = sp->output_clks; sp->clk_data.num = CDNS_SIERRA_OUTPUT_CLOCKS;
sp->clk_data.clk_num = CDNS_SIERRA_OUTPUT_CLOCKS; ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
ret = of_clk_add_provider(node, of_clk_src_onecell_get, &sp->clk_data); &sp->clk_data);
if (ret) if (ret)
dev_err(dev, "Failed to add clock provider: %s\n", node->name); dev_err(dev, "Failed to add clock provider: %s\n", node->name);
...@@ -1190,26 +1194,26 @@ static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp) ...@@ -1190,26 +1194,26 @@ static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp)
{ {
int ret; int ret;
ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); ret = clk_prepare_enable(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]);
if (ret) if (ret)
return ret; return ret;
ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); ret = clk_prepare_enable(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC1]);
if (ret) if (ret)
goto err_pll_cmnlc1; goto err_pll_cmnlc1;
return 0; return 0;
err_pll_cmnlc1: err_pll_cmnlc1:
clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]);
return ret; return ret;
} }
static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp) static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp)
{ {
clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC1]);
clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]);
if (!sp->already_configured) if (!sp->already_configured)
clk_disable_unprepare(sp->input_clks[PHY_CLK]); clk_disable_unprepare(sp->input_clks[PHY_CLK]);
} }
...@@ -1370,7 +1374,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -1370,7 +1374,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
if (!data) if (!data)
return -EINVAL; return -EINVAL;
sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL); sp = devm_kzalloc(dev, struct_size(sp, clk_data.hws,
CDNS_SIERRA_OUTPUT_CLOCKS),
GFP_KERNEL);
if (!sp) if (!sp)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(dev, sp); dev_set_drvdata(dev, sp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment