diff mbox series

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

Message ID 20220816140049.102306-17-linus.walleij@linaro.org
State New
Headers show
Series Ux500 hash cleanup | expand

Commit Message

Linus Walleij Aug. 16, 2022, 2 p.m. UTC
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@linaro.org>
---
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 mbox series

Patch

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: