[U-Boot] [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.
Signed-off-by: Fabio Estevam fabio.estevam@nxp.com --- board/freescale/mx6qsabreauto/mx6qsabreauto.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c index 5fca4d1..13a9b5a 100644 --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c @@ -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); }

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.
Signed-off-by: Fabio Estevam fabio.estevam@nxp.com --- include/configs/mx6qsabreauto.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h index f849f34..7d68633 100644 --- a/include/configs/mx6qsabreauto.h +++ b/include/configs/mx6qsabreauto.h @@ -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)

The CONFIG_USE_ARCH_MEMCPY option builds an assembly optimized version of memcpy, so select it to gain performance.
Signed-off-by: Fabio Estevam fabio.estevam@nxp.com --- include/configs/mx6_common.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h index d28654b..d54578a 100644 --- a/include/configs/mx6_common.h +++ b/include/configs/mx6_common.h @@ -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

On Thu, Dec 15, 2016 at 01:23:14PM -0200, Fabio Estevam wrote:
The CONFIG_USE_ARCH_MEMCPY option builds an assembly optimized version of memcpy, so select it to gain performance.
Signed-off-by: Fabio Estevam fabio.estevam@nxp.com
include/configs/mx6_common.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h index d28654b..d54578a 100644 --- a/include/configs/mx6_common.h +++ b/include/configs/mx6_common.h @@ -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!

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 --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);

On Thu, Dec 15, 2016 at 01:23:15PM -0200, Fabio Estevam wrote:
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.
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?
participants (2)
-
Fabio Estevam
-
Tom Rini