[PATCH 013/102] crypto: rockchip: explicitly request exclusive reset control

2017-07-19 Thread Philipp Zabel
Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.

No functional changes.

Cc: Herbert Xu <herb...@gondor.apana.org.au>
Cc: "David S. Miller" <da...@davemloft.net>
Cc: Heiko Stuebner <he...@sntech.de>
Cc: linux-crypto@vger.kernel.org
Cc: linux-rockc...@lists.infradead.org
Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
 drivers/crypto/rockchip/rk3288_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/rockchip/rk3288_crypto.c 
b/drivers/crypto/rockchip/rk3288_crypto.c
index d0f80c6241f95..fdfd1f02911e9 100644
--- a/drivers/crypto/rockchip/rk3288_crypto.c
+++ b/drivers/crypto/rockchip/rk3288_crypto.c
@@ -294,7 +294,7 @@ static int rk_crypto_probe(struct platform_device *pdev)
goto err_crypto;
}
 
-   crypto_info->rst = devm_reset_control_get(dev, "crypto-rst");
+   crypto_info->rst = devm_reset_control_get_exclusive(dev, "crypto-rst");
if (IS_ERR(crypto_info->rst)) {
err = PTR_ERR(crypto_info->rst);
goto err_crypto;
-- 
2.11.0



[PATCH 014/102] crypto: sun4i-ss - request exclusive reset control

2017-07-19 Thread Philipp Zabel
Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.

No functional changes.

Cc: Corentin Labbe <clabbe.montj...@gmail.com>
Cc: Herbert Xu <herb...@gondor.apana.org.au>
Cc: "David S. Miller" <da...@davemloft.net>
Cc: Maxime Ripard <maxime.rip...@free-electrons.com>
Cc: Chen-Yu Tsai <w...@csie.org>
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
 drivers/crypto/sunxi-ss/sun4i-ss-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c 
b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
index 02ad8256e9002..69374e42ad05f 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-core.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
@@ -255,7 +255,8 @@ static int sun4i_ss_probe(struct platform_device *pdev)
}
dev_dbg(>dev, "clock ahb_ss acquired\n");
 
-   ss->reset = devm_reset_control_get_optional(>dev, "ahb");
+   ss->reset = devm_reset_control_get_optional_exclusive(>dev,
+ "ahb");
if (IS_ERR(ss->reset)) {
if (PTR_ERR(ss->reset) == -EPROBE_DEFER)
return PTR_ERR(ss->reset);
-- 
2.11.0



[PATCH v2 01/14] crypto: sun4i-ss - simplify optional reset handling

2017-03-15 Thread Philipp Zabel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.

This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.

Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
 drivers/crypto/sunxi-ss/sun4i-ss-core.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c 
b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
index 3ac6c6c4ad18e..e310e311d23ea 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-core.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
@@ -258,10 +258,11 @@ static int sun4i_ss_probe(struct platform_device *pdev)
 
ss->reset = devm_reset_control_get_optional(>dev, "ahb");
if (IS_ERR(ss->reset)) {
-   if (PTR_ERR(ss->reset) == -EPROBE_DEFER)
-   return PTR_ERR(ss->reset);
-   dev_info(>dev, "no reset control found\n");
-   ss->reset = NULL;
+   err = PTR_ERR(ss->reset);
+   if (err == -EPROBE_DEFER)
+   return err;
+   dev_err(>dev, "Cannot get reset control err=%d\n", err);
+   return err;
}
 
/* Enable both clocks */
@@ -287,12 +288,10 @@ static int sun4i_ss_probe(struct platform_device *pdev)
}
 
/* Deassert reset if we have a reset control */
-   if (ss->reset) {
-   err = reset_control_deassert(ss->reset);
-   if (err) {
-   dev_err(>dev, "Cannot deassert reset control\n");
-   goto error_clk;
-   }
+   err = reset_control_deassert(ss->reset);
+   if (err) {
+   dev_err(>dev, "Cannot deassert reset control\n");
+   goto error_clk;
}
 
/*
@@ -372,8 +371,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
break;
}
}
-   if (ss->reset)
-   reset_control_assert(ss->reset);
+   reset_control_assert(ss->reset);
 error_clk:
clk_disable_unprepare(ss->ssclk);
 error_ssclk:
@@ -398,8 +396,7 @@ static int sun4i_ss_remove(struct platform_device *pdev)
}
 
writel(0, ss->base + SS_CTL);
-   if (ss->reset)
-   reset_control_assert(ss->reset);
+   reset_control_assert(ss->reset);
clk_disable_unprepare(ss->busclk);
clk_disable_unprepare(ss->ssclk);
return 0;
-- 
2.11.0