mmc: meson-mx-sdhc: Use devm_clk_hw_get_clk() for clock retrieval

Now that devm_clk_hw_get_clk() has been available for a while we can
resolve an older TODO where this API did not exist yet. No functional
changes intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20240217100200.1494980-2-martin.blumenstingl@googlemail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Martin Blumenstingl 2024-02-17 11:01:59 +01:00 committed by Ulf Hansson
parent 25e69172db
commit 4c5e3efae6

View File

@ -71,12 +71,23 @@ static int meson_mx_sdhc_clk_hw_register(struct device *dev,
static int meson_mx_sdhc_gate_clk_hw_register(struct device *dev, static int meson_mx_sdhc_gate_clk_hw_register(struct device *dev,
const char *name_suffix, const char *name_suffix,
struct clk_hw *parent, struct clk_hw *parent,
struct clk_hw *hw) struct clk_hw *hw,
struct clk_bulk_data *clk_bulk_data,
u8 bulk_index)
{ {
struct clk_parent_data parent_data = { .hw = parent }; struct clk_parent_data parent_data = { .hw = parent };
int ret;
return meson_mx_sdhc_clk_hw_register(dev, name_suffix, &parent_data, 1, ret = meson_mx_sdhc_clk_hw_register(dev, name_suffix, &parent_data, 1,
&clk_gate_ops, hw); &clk_gate_ops, hw);
if (ret)
return ret;
clk_bulk_data[bulk_index].clk = devm_clk_hw_get_clk(dev, hw, name_suffix);
if (IS_ERR(clk_bulk_data[bulk_index].clk))
return PTR_ERR(clk_bulk_data[bulk_index].clk);
return 0;
} }
int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
@ -115,7 +126,8 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
clkc_data->mod_clk_en.bit_idx = 15; clkc_data->mod_clk_en.bit_idx = 15;
ret = meson_mx_sdhc_gate_clk_hw_register(dev, "mod_clk_on", ret = meson_mx_sdhc_gate_clk_hw_register(dev, "mod_clk_on",
&clkc_data->div.hw, &clkc_data->div.hw,
&clkc_data->mod_clk_en.hw); &clkc_data->mod_clk_en.hw,
clk_bulk_data, 0);
if (ret) if (ret)
return ret; return ret;
@ -123,7 +135,8 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
clkc_data->tx_clk_en.bit_idx = 14; clkc_data->tx_clk_en.bit_idx = 14;
ret = meson_mx_sdhc_gate_clk_hw_register(dev, "tx_clk_on", ret = meson_mx_sdhc_gate_clk_hw_register(dev, "tx_clk_on",
&clkc_data->div.hw, &clkc_data->div.hw,
&clkc_data->tx_clk_en.hw); &clkc_data->tx_clk_en.hw,
clk_bulk_data, 1);
if (ret) if (ret)
return ret; return ret;
@ -131,7 +144,8 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
clkc_data->rx_clk_en.bit_idx = 13; clkc_data->rx_clk_en.bit_idx = 13;
ret = meson_mx_sdhc_gate_clk_hw_register(dev, "rx_clk_on", ret = meson_mx_sdhc_gate_clk_hw_register(dev, "rx_clk_on",
&clkc_data->div.hw, &clkc_data->div.hw,
&clkc_data->rx_clk_en.hw); &clkc_data->rx_clk_en.hw,
clk_bulk_data, 2);
if (ret) if (ret)
return ret; return ret;
@ -139,18 +153,7 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
clkc_data->sd_clk_en.bit_idx = 12; clkc_data->sd_clk_en.bit_idx = 12;
ret = meson_mx_sdhc_gate_clk_hw_register(dev, "sd_clk_on", ret = meson_mx_sdhc_gate_clk_hw_register(dev, "sd_clk_on",
&clkc_data->div.hw, &clkc_data->div.hw,
&clkc_data->sd_clk_en.hw); &clkc_data->sd_clk_en.hw,
if (ret) clk_bulk_data, 3);
return ret; return ret;
/*
* TODO: Replace clk_hw.clk with devm_clk_hw_get_clk() once that is
* available.
*/
clk_bulk_data[0].clk = clkc_data->mod_clk_en.hw.clk;
clk_bulk_data[1].clk = clkc_data->sd_clk_en.hw.clk;
clk_bulk_data[2].clk = clkc_data->tx_clk_en.hw.clk;
clk_bulk_data[3].clk = clkc_data->rx_clk_en.hw.clk;
return 0;
} }