[PATCH v3 16/16] crypto: ux500/hash: Use accelerated noinc MMIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After fixes to regmap we can use accelerated MMIO access to
quickly fill up the hash with new data.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
ChangeLog v1->v3:
- New patch based on v6.0-rc1
---
 drivers/crypto/ux500/hash/hash_core.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index be703fe4d0ec..aa91bfecba15 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -256,18 +256,13 @@ static void hash_fill_din(struct hash_device_data *device_data,
 			  const void *data, unsigned int len)
 {
 	const u8 *datap = data;
+	int evenbytes = (len / 4) * 4;
 	u32 val;
 
-	/*
-	 * We cannot use regmap_write_noinc() because regmap MMIO does
-	 * not support the noinc operations (requires .write() callback).
-	 * TODO: revisit when regmap MMIO supports regmap_write_noinc().
-	 */
-	while (len > 4) {
-		val = *((u32 *)datap);
-		regmap_write(device_data->map, UX500_HASH_DIN, val);
-		datap += 4;
-		len -= 4;
+	if (evenbytes) {
+		regmap_noinc_write(device_data->map, UX500_HASH_DIN,
+				   data, evenbytes);
+		len -= evenbytes;
 	}
 
 	if (len) {
@@ -1472,6 +1467,7 @@ static bool ux500_hash_reg_volatile(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
 	case UX500_HASH_CR:
+	case UX500_HASH_DIN:
 	case UX500_HASH_STR:
 	case UX500_HASH_H(0) ... UX500_HASH_H(7):
 	case UX500_HASH_ITCR:
-- 
2.37.2




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux