This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM437X: Increasing the Nand bit width did not improve the startup speed

Part Number: PROCESSOR-SDK-AM437X

Tool/software:

Hi,

 
We have an Am437x gp evm board that has been in use for a long time, and the system is Ubi NAND. The startup also starts from NAND. Recently, I wanted to improve the system's read and write speed by successfully increasing the NAND bit width from 8 bits to 16 bits with the support of Hong. However, I found that the speed did not increase after booting from NAND, but instead became slower. I want to know if increasing the bit width cannot improve the startup speed? Is it due to the reason that the system speed has actually decreased? Uboot and Linux kernel, system, applications, etc. remain the same as before.
 The general understanding is that increasing the data bit width should improve read and write speed.
the DTS timing for 8bit NAND:

	nand@0,0 {
		compatible = "ti,omap2-nand";
		reg = <0 0 4>;		/* device IO registers */
		interrupt-parent = <&gpmc>;
		interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
			     <1 IRQ_TYPE_NONE>;	/* termcount */
		rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>;	/* gpmc_wait0 */
		ti,nand-xfer-type = "prefetch-dma";
		ti,nand-ecc-opt = "bch16";
		ti,elm-id = <&elm>;
		nand-bus-width = <8>;
		gpmc,device-width = <1>;
		gpmc,sync-clk-ps = <0>;
		/*CONFIG2*/
		gpmc,cs-on-ns = <0>;
		gpmc,cs-rd-off-ns = <40>;
		gpmc,cs-wr-off-ns = <40>;
		/*CONFIG3*/
		gpmc,adv-on-ns = <0>;
		gpmc,adv-rd-off-ns = <25>;
		gpmc,adv-wr-off-ns = <25>;
		/*CONFIG4*/
		gpmc,we-on-ns = <0>;
		gpmc,we-off-ns = <20>;
		gpmc,oe-on-ns = <3>;
		gpmc,oe-off-ns = <30>;
		/*CONFIG5*/
		gpmc,access-ns = <30>;
		gpmc,rd-cycle-ns = <40>;
		gpmc,wr-cycle-ns = <40>;
		/*CONFIG6*/
		gpmc,bus-turnaround-ns = <0>;
		gpmc,cycle2cycle-delay-ns = <0>;
		gpmc,clk-activation-ns = <0>;
		gpmc,wr-access-ns = <40>;
		gpmc,wr-data-mux-bus-ns = <0>;
		/* MTD partition table */
		/* All SPL-* partitions are sized to minimal length
		 * which can be independently programmable. For
		 * NAND flash this is equal to size of erase-block */
		#address-cells = <1>;
		#size-cells = <1>;

the DTS timing for 16bit NAND:

	nand@0,0 {
		compatible = "ti,omap2-nand";
		reg = <0 0 4>;		/* device IO registers */
		interrupt-parent = <&gpmc>;
		interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
			     <1 IRQ_TYPE_NONE>;	/* termcount */
		rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>;	/* gpmc_wait0 */
		ti,nand-xfer-type = "prefetch-dma";
		ti,elm-id = <&elm>;
		
		ti,nand-ecc-opt = "bch8";
		nand-bus-width = <16>; 
		gpmc,wait-pin = <0>;

		gpmc,sync-clk-ps = <0>;
		gpmc,cs-on-ns = <0>;
		gpmc,cs-rd-off-ns = <44>;
		gpmc,cs-wr-off-ns = <44>;
		gpmc,adv-on-ns = <6>;
		gpmc,adv-rd-off-ns = <34>;
		gpmc,adv-wr-off-ns = <44>;
		gpmc,we-off-ns = <40>;
		gpmc,oe-off-ns = <54>;
		gpmc,access-ns = <64>;
		gpmc,rd-cycle-ns = <82>;
		gpmc,wr-cycle-ns = <82>;
		gpmc,wr-access-ns = <40>;
		gpmc,wr-data-mux-bus-ns = <0>;

Best Regard!

Dudechao

  • The 16 bits NAND is MT29F4G16ABADAWP-IT:D, datasheet is:

    4520.MT29F8G08ADADAH4D.PDF

    Best Regard,

    Dudechao

  • From the early e2e, it looks like U-Boot 2018.01 is used on your setup.
    PROCESSOR-SDK-AM437X: How to config u-boot to support 16-bit width NAND flash in Am437x SDK 

    The gpmc-nand timing parameter in u-boot DTS board file is currently not used. Instead gpmc-nand parameters are configured in u-boot src.
    Please refer to the patch (in SDK 9.3) for updating gpmc-nand parameters in u-boot src to improve nand performance.
    https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/arch/arm/include/asm/arch-am33xx?h=09.03.05&id=cd5b656a60fa778a3a4f435361550d0c84681f48
    Best,
    -Hong

  • Hong,

    I am delighted to receive your reply again.
    According to your guidance, after modifying the code in mem.h under uboot, the startup speed of uboot has improved significantly compared to before. However, after entering the Linux system, the loading speed of applications is still very slow. Should I modify the timing of nand in the arch/arm/boot/dts file under kernel? Or should I locate the nand driver and configure the following parameters like in u-boot?
    #define M_NAND_GPMC_CONFIG1 0x00000800
    #define M_NAND_GPMC_CONFIG2 0x00050500
    #define M_NAND_GPMC_CONFIG3 0x00050401
    #define M_NAND_GPMC_CONFIG4 0x04000600
    #define M_NAND_GPMC_CONFIG5 0x00070909
    #define M_NAND_GPMC_CONFIG6 0x84000000
    #define M_NAND_GPMC_CONFIG7 0x00000008
    Thank you!

    Best Regard,

    Dudecchao

  • It is good to know the u-boot patch helps improving u-boot gpmc-nand performance on your setup.
    BTW. u-boot gpmc-nand read performance was improved x4 with the u-boot patch on AM335x GP EVM.

    The kernel board dts file is used for kernel gpmc-nand configurations.
    In fact, the gpmc-nand parameters in the u-boot patch should match the kernel dts board file for gpmc-nand configuration for AM335x GP EVM
    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm/boot/dts/am335x-evm.dts?h=09.03.05#n504
    Best,
    -Hong

  • Hong,

    Hello, we have modified the am437x-gp-evm.dts file under the kernel as follows: 

    &gpmc {
    	/*
    	 * When enabling GPMC, disable eMMC and set
    	 * SelEMMCorNAND to output-low
    	 */
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&nand_flash_x8>;/*<&gpmc_bus_default>;*//*<&nand_flash_x8>*/
    	ranges = <0 0 0x01000000 0x01000000>,	/* <0 0 0x08000000 0x01000000>,CS0 space. Min partition = 16MB */
    			 <2 0 0x08000000 0x01000000>,	/* <2 0 0x01000000 0x01000000>,CS2 space, FPGA cs2 */
    			 <3 0 0x02000000 0x01000000>;   /* <3 0 0x02000000 0x01000000>;CS3 space, FPGA cs3 */
    	nand@0,0 {
    		compatible = "ti,omap2-nand";
    		reg = <0 0 4>;		/* device IO registers */
    		interrupt-parent = <&gpmc>;
    		interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
    			     <1 IRQ_TYPE_NONE>;	/* termcount */
    		rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>;	/* gpmc_wait0 */
    		ti,nand-xfer-type = "prefetch-dma";
    		ti,elm-id = <&elm>;
    		
    
    		ti,nand-ecc-opt = "bch8";
    		nand-bus-width = <16>; 
    		
    		gpmc,device-width = <1>;
    		gpmc,sync-clk-ps = <0>;
    		gpmc,cs-on-ns = <0>;
    		gpmc,cs-rd-off-ns = <44>;
    		gpmc,cs-wr-off-ns = <44>;
    		gpmc,adv-on-ns = <6>;
    		gpmc,adv-rd-off-ns = <34>;
    		gpmc,adv-wr-off-ns = <44>;
    		gpmc,we-on-ns = <0>;
    		gpmc,we-off-ns = <40>;
    		gpmc,oe-on-ns = <0>;
    		gpmc,oe-off-ns = <54>;
    		gpmc,access-ns = <64>;
    		gpmc,rd-cycle-ns = <82>;
    		gpmc,wr-cycle-ns = <82>;
    		gpmc,bus-turnaround-ns = <0>;
    		gpmc,cycle2cycle-delay-ns = <0>;
    		gpmc,clk-activation-ns = <0>;
    		gpmc,wr-access-ns = <40>;
    		gpmc,wr-data-mux-bus-ns = <0>;
    

    However, we found that the speed had not improved. After comparison, we found that the timing parameters used here were the same as those we used before (also provided by you previously): 
    Is this timing parameter the same as the one under u-boot? 
    #define M_NAND_GPMC_CONFIG1 0x00000800 
    #define M_NAND_GPMC_CONFIG2 0x00050500 
    #define M_NAND_GPMC_CONFIG3 0x00050401 
    #define M_NAND_GPMC_CONFIG4 0x04000600 
    #define M_NAND_GPMC_CONFIG5 0x00070909 
    #define M_NAND_GPMC_CONFIG6 0x84000000 
    #define M_NAND_GPMC_CONFIG7 0x00000008 
      
    Thank you.

    Best Regard,

    Dudechao

  • Is this timing parameter the same as the one under u-boot? 
    The gpmc-nand timing parameter in u-boot DTS board file is currently not used. Instead gpmc-nand parameters are configured in u-boot src.
    Please refer to the patch (in SDK 9.3) for updating gpmc-nand parameters in u-boot src to improve nand performance.
    The kernel board dts file is used for kernel gpmc-nand configurations.
    In fact, the gpmc-nand parameters in the u-boot patch should match the kernel dts board file for gpmc-nand configuration for AM335x GP EVM

    I'm attaching two logs listing GPMC_CONFIGx (x=1 to 7) for your reference: one @u-boot; one @kernel
    Best,
    -Hong

    U-Boot SPL 2023.04-gd74d0993e2 (Oct 18 2023 - 17:49:46 +0000)
    Trying to boot from MMC1
    
    
    U-Boot 2023.04-gd74d0993e2 (Oct 18 2023 - 17:49:46 +0000)
    
    CPU  : AM335X-GP rev 2.1
    Model: TI AM335x EVM
    DRAM:  1 GiB
    Core:  156 devices, 17 uclasses, devicetree: separate
    WDT:   Started wdt@44e35000 with servicing every 1000ms (60s timeout)
    NAND:  256 MiB
    MMC:   OMAP SD/MMC: 0
    Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... 
    <ethaddr> not set. Validating first E-fuse MAC
    Net:   eth2: ethernet@4a100000, eth3: usb_ether
    Hit any key to stop autoboot:  2  0 
    => nand info
    
    Device 0: nand0, sector size 128 KiB
      Page size         2048 b
      OOB size            64 b
      Erase size      131072 b
      ecc strength         8 bits
      ecc step size      512 b
      subpagesize        512 b
      options       0x0000400c
      bbt options   0x00008000
      
    => mtdparts
    
    device nand0 <nand.0>, # parts = 10
     #: name		size		offset		mask_flags
     0: NAND.SPL            0x00020000	0x00000000	0
     1: NAND.SPL.backup1    0x00020000	0x00020000	0
     2: NAND.SPL.backup2    0x00020000	0x00040000	0
     3: NAND.SPL.backup3    0x00020000	0x00060000	0
     4: NAND.u-boot-spl-os  0x00040000	0x00080000	0
     5: NAND.u-boot         0x00100000	0x000c0000	0
     6: NAND.u-boot-env     0x00020000	0x001c0000	0
     7: NAND.u-boot-env.backup10x00020000	0x001e0000	0
     8: NAND.kernel         0x00800000	0x00200000	0
     9: NAND.file-system    0x0f600000	0x00a00000	0
    
    active partition: nand0,0 - (NAND.SPL) 0x00020000 @ 0x00000000
    
    defaults:
    mtdids  : nand0=nand.0
    mtdparts: mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)
    
    => md.l 0x50000060 0x7
    50000060: 00000800 001e1e00 001e1e00 16051807  ................
    50000070: 00151e1e 16000f80 00000f48           ........H...
    
    => time nand read ${loadaddr} NAND.kernel
    
    NAND read: device 0 offset 0x200000, size 0x800000
     8388608 bytes read: OK
    
    time: 4.332 seconds
    
    => mw.l 0x50000064  0x00050500 1
    => mw.l 0x50000068  0x00050401 1
    => mw.l 0x5000006C  0x04000600 1
    => mw.l 0x50000070  0x00070909 1
    => mw.l 0x50000074  0x84000000 1
    
    => md.l 0x50000060 0x7
    50000060: 00000800 00050500 00050401 04000600  ................
    50000070: 00070909 84000000 00000f48           ........H...
    
    => time nand read ${loadaddr} NAND.kernel
    
    NAND read: device 0 offset 0x200000, size 0x800000
     8388608 bytes read: OK
    
    time: 0.996 seconds
    => 

    root@am335x-evm:~# uname -a
    Linux am335x-evm 6.1.69-gf98180658f #1 PREEMPT Wed Jan 31 17:20:51 UTC 2024 armv7l armv7l armv7l GNU/Linux
    root@am335x-evm:~# time dd if=/dev/mtd9 of=/dev/null bs=1M count=10
    10+0 records in
    10+0 records out
    10485760 bytes (10 MB, 10 MiB) copied, 1.39651 s, 7.5 MB/s
    real    0m 1.40s
    user    0m 0.00s
    sys     0m 0.37s
    root@am335x-evm:~# devmem2 0x50000060
    /dev/mem opened.
    Memory mapped at address 0xb6f40000.
    Read at address  0x50000060 (0xb6f40060): 0x00000800
    root@am335x-evm:~# devmem2 0x50000064
    /dev/mem opened.
    Memory mapped at address 0xb6f6c000.
    Read at address  0x50000064 (0xb6f6c064): 0x00050500
    root@am335x-evm:~# devmem2 0x50000068
    /dev/mem opened.
    Memory mapped at address 0xb6fb9000.
    Read at address  0x50000068 (0xb6fb9068): 0x00050401
    root@am335x-evm:~# devmem2 0x5000006c
    /dev/mem opened.
    Memory mapped at address 0xb6f07000.
    Read at address  0x5000006C (0xb6f0706c): 0x04000600
    root@am335x-evm:~# devmem2 0x50000070
    /dev/mem opened.
    Memory mapped at address 0xb6f70000.
    Read at address  0x50000070 (0xb6f70070): 0x00070909
    root@am335x-evm:~# devmem2 0x50000074
    /dev/mem opened.
    Memory mapped at address 0xb6f8a000.
    Read at address  0x50000074 (0xb6f8a074): 0x84000000
    root@am335x-evm:~# devmem2 0x50000078
    /dev/mem opened.
    Memory mapped at address 0xb6fbb000.
    Read at address  0x50000078 (0xb6fbb078): 0x00000F48
    root@am335x-evm:~#