diff mbox

[U-Boot,RFC] cmd: mem: Allow 'cp' to use the optimized memcpy

Message ID 1481815395-4277-4-git-send-email-fabio.estevam@nxp.com
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Fabio Estevam Dec. 15, 2016, 3:23 p.m. UTC
If CONFIG_USE_ARCH_MEMCPY is selected, let's use the assembly optimized
memcpy implementation for the 'cp' command.

Currently only Blackfin uses memcpy for the 'cp' command, so extend
this to the CONFIG_USE_ARCH_MEMCPY users.

Tested on a mx6qsabreauto board where a 5x gain in performance is seen
when reading 10MB from the parallel NOR memory.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Sending as RFC as I don't know if any extra checks would be required here,
so I appreciate any feedback.

 cmd/mem.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/cmd/mem.c b/cmd/mem.c
index a690957..c1d9a7c 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -465,6 +465,11 @@  static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 #endif
 
+#ifdef CONFIG_USE_ARCH_MEMCPY
+	memcpy((void *)dest, (void *)addr, count * size);
+	return 0;
+#endif
+
 	bytes = size * count;
 	buf = map_sysmem(dest, bytes);
 	src = map_sysmem(addr, bytes);