Commit 37bc2215 authored by Corentin Labbe's avatar Corentin Labbe Committed by Herbert Xu

crypto: rockchip - use read_poll_timeout

Use read_poll_timeout instead of open coding it.
In the same time, fix indentation of related comment.
Reviewed-by: default avatarJohn Keeping <john@metanate.com>
Signed-off-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e8031884
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
*/ */
#include <linux/device.h> #include <linux/device.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <linux/iopoll.h>
#include "rk3288_crypto.h" #include "rk3288_crypto.h"
/* /*
...@@ -295,18 +296,17 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq) ...@@ -295,18 +296,17 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)
sg = sg_next(sg); sg = sg_next(sg);
} }
/* /*
* it will take some time to process date after last dma * it will take some time to process date after last dma
* transmission. * transmission.
* *
* waiting time is relative with the last date len, * waiting time is relative with the last date len,
* so cannot set a fixed time here. * so cannot set a fixed time here.
* 10us makes system not call here frequently wasting * 10us makes system not call here frequently wasting
* efficiency, and make it response quickly when dma * efficiency, and make it response quickly when dma
* complete. * complete.
*/ */
while (!CRYPTO_READ(tctx->dev, RK_CRYPTO_HASH_STS)) readl_poll_timeout(tctx->dev->reg + RK_CRYPTO_HASH_STS, v, v == 0, 10, 1000);
udelay(10);
for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++) { for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++) {
v = readl(tctx->dev->reg + RK_CRYPTO_HASH_DOUT_0 + i * 4); v = readl(tctx->dev->reg + RK_CRYPTO_HASH_DOUT_0 + i * 4);
......
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