Skip to contentSkip to conversation

mx6qsabreauto: Configure the WEIM controller like the kernel

PATCH Superseded Fabio Estevam 2 participants 6 messages Dec 15, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mx6qsabreauto: Configure the WEIM controller like the kernel

Do the same WEIM initialization as done in the Linux kernel according to arch/arm/boot/dts/imx6qdl-sabreauto.dtsi from kernel 4.9.

---
 board/freescale/mx6qsabreauto/mx6qsabreauto.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
board/freescale/mx6qsabreauto/mx6qsabreauto.c +12 -4
index 5fca4d1..13a9b5a 100644
@@ -221,12 +221,20 @@ static void eimnor_cs_setup(void)
 {
 	struct weim *weim_regs = (struct weim *)WEIM_BASE_ADDR;
 
-	writel(0x00020181, &weim_regs->cs0gcr1);
+	/*
+	 * Configure weim like the linux kernel.
+	 * From arch/arm/boot/dts/imx6qdl-sabreauto.dtsi:
+	 *
+	 * fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
+	 *			 0x0000c000 0x1404a38e 0x00000000>;
+	 */
+
+	writel(0x00620081, &weim_regs->cs0gcr1);
 	writel(0x00000001, &weim_regs->cs0gcr2);
-	writel(0x0a020000, &weim_regs->cs0rcr1);
+	writel(0x1c022000, &weim_regs->cs0rcr1);
 	writel(0x0000c000, &weim_regs->cs0rcr2);
-	writel(0x0804a240, &weim_regs->cs0wcr1);
-	writel(0x00000120, &weim_regs->wcr);
+	writel(0x1404a38e, &weim_regs->cs0wcr1);
+	writel(0x00000000, &weim_regs->wcr);
 
 	set_chipselect_size(CS0_128);
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 mx6qsabreauto: Pass the correct parallel NOR width

On mx6qsabreauto the parallel NOR width is 16 bits, so configure CONFIG_SYS_FLASH_CFI_WIDTH correctly so that the CFI driver does not use 8-bit withd by default.

---
 include/configs/mx6qsabreauto.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/mx6qsabreauto.h +1 -0
index f849f34..7d68633 100644
@@ -38,6 +38,7 @@
 #define CONFIG_FLASH_CFI_DRIVER         /* Use drivers/cfi_flash.c */
 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE /* Use buffered writes*/
 #define CONFIG_SYS_FLASH_EMPTY_INFO
+#define CONFIG_SYS_FLASH_CFI_WIDTH	FLASH_CFI_16BIT
 
 #define CONFIG_SYS_FSL_USDHC_NUM	2
 #if defined(CONFIG_ENV_IS_IN_MMC)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/3 mx6: Select CONFIG_USE_ARCH_MEMCPY

In reply to Fabio Estevam

The CONFIG_USE_ARCH_MEMCPY option builds an assembly optimized version of memcpy, so select it to gain performance.

---
 include/configs/mx6_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/mx6_common.h +2 -0
index d28654b..d54578a 100644
@@ -18,6 +18,8 @@
 #define CONFIG_SYS_PL310_BASE	L2_PL310_BASE
 #endif
 
+#define CONFIG_USE_ARCH_MEMCPY
+
 #define CONFIG_MP
 #endif
 #define CONFIG_BOARD_POSTCLK_INIT
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/3 mx6: Select CONFIG_USE_ARCH_MEMCPY

Quoted 13 lines · Fabio Estevam

The CONFIG_USE_ARCH_MEMCPY option builds an assembly optimized version of memcpy, so select it to gain performance.

---
 include/configs/mx6_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/mx6_common.h +0 -0
index d28654b..d54578a 100644

include/configs/mx6_common.h line 25

Quoted 8 lines
include/configs/mx6_common.h +2 -0
@@ -18,6 +18,8 @@
 #define CONFIG_SYS_PL310_BASE	L2_PL310_BASE
 #endif
 
+#define CONFIG_USE_ARCH_MEMCPY
+
 #define CONFIG_MP
 #endif
 #define CONFIG_BOARD_POSTCLK_INIT

Can you please migrate USE_ARCH_MEMCPY/MEMSET to Kconfig, and default y them (not select) for ARMv7? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161215/808aa36d/attachment.sig>
#4 lore raw

RFC 1/1 cmd: mem: Allow 'cp' to use the optimized memcpy

In reply to Fabio Estevam

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.

---
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(+)
cmd/mem.c +5 -0
index a690957..c1d9a7c 100644
@@ -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);
Signature · 1 line
2.7.4
#5 lore raw

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

Quoted 6 lines · Fabio Estevam

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.

Quoted 7 lines

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

---
Sending as RFC as I don't know if any extra checks would be required here, so I appreciate any feedback.

We should re-work this to simply call memcpy() always, outside of the case of dealing with flash/dataflash as that would simplify this code, no?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161215/8f62991c/attachment.sig>