*/
 #include <linux/device.h>
 #include <asm/unaligned.h>
+#include <linux/iopoll.h>
 #include "rk3288_crypto.h"
 
 /*
                sg = sg_next(sg);
        }
 
-               /*
-                * it will take some time to process date after last dma
-                * transmission.
-                *
-                * waiting time is relative with the last date len,
-                * so cannot set a fixed time here.
-                * 10us makes system not call here frequently wasting
-                * efficiency, and make it response quickly when dma
-                * complete.
-                */
-       while (!CRYPTO_READ(tctx->dev, RK_CRYPTO_HASH_STS))
-               udelay(10);
+       /*
+        * it will take some time to process date after last dma
+        * transmission.
+        *
+        * waiting time is relative with the last date len,
+        * so cannot set a fixed time here.
+        * 10us makes system not call here frequently wasting
+        * efficiency, and make it response quickly when dma
+        * complete.
+        */
+       readl_poll_timeout(tctx->dev->reg + RK_CRYPTO_HASH_STS, v, v == 0, 10, 1000);
 
        for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++) {
                v = readl(tctx->dev->reg + RK_CRYPTO_HASH_DOUT_0 + i * 4);