Commit 176cae38 authored by Philipp Zabel's avatar Philipp Zabel

reset: uniphier-glue: Use reset_control_bulk API

This driver already uses the clk_bulk API. Simplify the driver by using
the reset_control_bulk API as well.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/20211215093829.3209416-1-p.zabel@pengutronix.deSigned-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 31231092
...@@ -23,7 +23,7 @@ struct uniphier_glue_reset_soc_data { ...@@ -23,7 +23,7 @@ struct uniphier_glue_reset_soc_data {
struct uniphier_glue_reset_priv { struct uniphier_glue_reset_priv {
struct clk_bulk_data clk[MAX_CLKS]; struct clk_bulk_data clk[MAX_CLKS];
struct reset_control *rst[MAX_RSTS]; struct reset_control_bulk_data rst[MAX_RSTS];
struct reset_simple_data rdata; struct reset_simple_data rdata;
const struct uniphier_glue_reset_soc_data *data; const struct uniphier_glue_reset_soc_data *data;
}; };
...@@ -34,8 +34,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -34,8 +34,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
struct uniphier_glue_reset_priv *priv; struct uniphier_glue_reset_priv *priv;
struct resource *res; struct resource *res;
resource_size_t size; resource_size_t size;
const char *name; int i, ret;
int i, ret, nr;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -58,22 +57,20 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -58,22 +57,20 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
for (i = 0; i < priv->data->nrsts; i++) { for (i = 0; i < priv->data->nrsts; i++)
name = priv->data->reset_names[i]; priv->rst[i].id = priv->data->reset_names[i];
priv->rst[i] = devm_reset_control_get_shared(dev, name); ret = devm_reset_control_bulk_get_shared(dev, priv->data->nrsts,
if (IS_ERR(priv->rst[i])) priv->rst);
return PTR_ERR(priv->rst[i]); if (ret)
} return ret;
ret = clk_bulk_prepare_enable(priv->data->nclks, priv->clk); ret = clk_bulk_prepare_enable(priv->data->nclks, priv->clk);
if (ret) if (ret)
return ret; return ret;
for (nr = 0; nr < priv->data->nrsts; nr++) { ret = reset_control_bulk_deassert(priv->data->nrsts, priv->rst);
ret = reset_control_deassert(priv->rst[nr]);
if (ret) if (ret)
goto out_rst_assert; goto out_clk_disable;
}
spin_lock_init(&priv->rdata.lock); spin_lock_init(&priv->rdata.lock);
priv->rdata.rcdev.owner = THIS_MODULE; priv->rdata.rcdev.owner = THIS_MODULE;
...@@ -91,9 +88,9 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -91,9 +88,9 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
return 0; return 0;
out_rst_assert: out_rst_assert:
while (nr--) reset_control_bulk_assert(priv->data->nrsts, priv->rst);
reset_control_assert(priv->rst[nr]);
out_clk_disable:
clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); clk_bulk_disable_unprepare(priv->data->nclks, priv->clk);
return ret; return ret;
...@@ -102,10 +99,8 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -102,10 +99,8 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
static int uniphier_glue_reset_remove(struct platform_device *pdev) static int uniphier_glue_reset_remove(struct platform_device *pdev)
{ {
struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev); struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev);
int i;
for (i = 0; i < priv->data->nrsts; i++) reset_control_bulk_assert(priv->data->nrsts, priv->rst);
reset_control_assert(priv->rst[i]);
clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); clk_bulk_disable_unprepare(priv->data->nclks, priv->clk);
......
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