From d84f6269ce24eb4c468e246b24fc0fdce34ab6f6 Mon Sep 17 00:00:00 2001 From: Ofir Drang Date: Mon, 17 Jun 2019 11:46:28 +0300 Subject: crypto: ccree - check that cryptocell reset completed In case of driver probe and pm resume we need to check that the cryptocell hardware reset cycle is completed. during the reset cycle that Cryptocell provide read only access to the APB interface which allows to verify through the CC registers that the reset is completed. Until reset completion we assume that any write/crypto operation is blocked. Signed-off-by: Ofir Drang Signed-off-by: Herbert Xu --- drivers/crypto/ccree/cc_pm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/crypto/ccree/cc_pm.c') diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_pm.c index 2dad9c9543c6..20f7f3d34e27 100644 --- a/drivers/crypto/ccree/cc_pm.c +++ b/drivers/crypto/ccree/cc_pm.c @@ -49,6 +49,11 @@ int cc_pm_resume(struct device *dev) dev_err(dev, "failed getting clock back on. We're toast.\n"); return rc; } + /* wait for Crytpcell reset completion */ + if (!cc_wait_for_reset_completion(drvdata)) { + dev_err(dev, "Cryptocell reset not completed"); + return -EBUSY; + } cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE); rc = init_cc_regs(drvdata, false); -- cgit v1.2.3