What needs to be contained in UBOOT to start/access nand0 (SOM Flash)

      What needs to be contained in UBOOT to start/access nand0 (SOM Flash)

      Hello gentleman,

      I made some changes in uboot. But nothing regarding the flash nand memory (to my way of thinking). But afterwards I can not access the nand flash any more. I also checked the original uboot from F+S and compared the sourced and enviroment variables. My modified UBootEnv can be seen under [1].

      I also noticed that some variables are not there anymore (see [2]). But when I set them and try to work with the nand flash they disappear and I get the following error:
      unexpected character 'r' at the end of partition

      What variables needs to be set to access the nand flash memory?


      Thanks so far.


      [2]:
      mtddevnum=0
      partition=nand0,0


      [1]:

      Source Code

      1. efusA9X # printenv
      2. EEPROM_ver=01.01.01
      3. HW_ver=01
      4. MAC_base=00:05:51
      5. arch=fsimx6sx
      6. baudrate=115200
      7. bootargs=console=ttymxc0,115200 login_tty=ttymxc0,115200 mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw,8m(Kernel)ro,1792k(FDT)ro,-(w
      8. bootcmd=run set_bootargs; run kernel; run fdt
      9. bootdelay=0
      10. bootfdt=efusa9x.dtb
      11. bootfile=uImage
      12. console=console=ttymxc0,115200
      13. eth1addr=00:05:51:00:00:05
      14. ethact=FEC1
      15. ethaddr=00:05:51:00:00:04
      16. ethprime=FEC1
      17. fdt=nand read 81000000 FDT; bootm 80800000 - 81000000
      18. fdt_high=ffffffff
      19. gatewayip=192.168.255.253
      20. installcheck=undef
      21. ipaddr=192.168.255.129
      22. kernel=nboot Kernel
      23. loadaddr=80800000
      24. login=login_tty=ttymxc0,115200
      25. m4=nand read . UserDef ${m4size} && cp.b $loadaddr ${m4addr} ${m4size} && dcache flush; bootaux ${m4addr}
      26. m4support=y
      27. mem=1046528k
      28. mode=rw
      29. mtdids=nand0=gpmi-nand
      30. mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)
      31. netdev=eth1
      32. netmask=255.255.255.0
      33. platform=efusa9x
      34. recovercheck=undef
      35. reserved_ram_size=10000
      36. rootfs=rootfstype=ubifs ubi.mtd=TargetFS root=ubi0:rootfs
      37. rootpath=/rootfs
      38. sercon=ttymxc0
      39. serverip=192.168.255.253
      40. set_bootargs=setenv bootargs ${console} ${login} ${mtdparts} ${network} ${rootfs} ${mode} ${init} ${extra}
      41. set_bootfdt=setenv bootfdt ${platform}.dtb
      42. set_updatescript=setenv updatescript ${platform}/uboot/update.scr
      43. updatecheck=tftp
      44. updatescript=efusa9x/uboot/update.scr
      45. Environment size: 1670/16380 bytes
      46. efusA9X # update
      47. ---- Trying update from tftp with efusa9x/uboot/update.scr ----
      48. Using FEC1 device
      49. TFTP from server 192.168.255.253; our IP address is 192.168.255.129
      50. Filename 'efusa9x/uboot/update.scr'.
      51. Load address: 0x80800000
      52. Loading:
      53. *
      54. 259.8 KiB/s
      55. done
      56. Bytes transferred = 1332 (0x534)
      57. Loaded!
      58. Check to update UBOOT.
      59. Update uboot from release # to #1.
      60. Using FEC1 device
      61. TFTP from server 192.168.255.253; our IP address is 192.168.255.129
      62. Filename 'efusa9x/uboot/1/1_efusa9x.nb0'.
      63. Load address: 0x80800000
      64. Loading:
      65. ################################################################ 511 KiB
      66. 1.9 MiB/s
      67. done
      68. Bytes transferred = 524288 (0x80000)
      69. NAND erase.part: unexpected character 'r' at the end of partition
      70. ----! UBOOT Update failed to finished without errors. !----
      71. ---- update COMPLETE! ----
      72. efusA9X # nand erase.part UBoot
      73. NAND erase.part: unexpected character 'r' at the end of partition
      Is the U-Boot based on our U-Boot sources only with some modifications? Or is this a different U-Boot source and you are trying to port all our changes?

      One of the changes we did was to increase the size of the buffer for the command line. So maybe when the mdtparts variable is evaluated at startup, this results in a too long command line and is truncated. So maybe only a final 'r' from a 'ro' for "read-only" is visible and the whole partition list is ignored. This would explain the error and also the missing NAND support because of the missing partitions.

      EDIT: Is 'rw' allowed after partition UBootEnv? I think it is automatically read-write if there is no suffix and suffix 'ro' after the parenthesis is for read-only. I do not think that other suffixes are possible.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      Yes. It is only a modified version of the original F+S uboot image. I tried not to change any FLASH related options (only make UBootEnv rw). But my image only access the nand flash when I use the enviroment on the original uboot image from F+S.

      As you can see in [1] there is no difference in variable mtdparts. The command "mtdparts" shows the same behavior as you can see in [2].

      [1]:
      myUBOOT:
      mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)

      F+S UBOOT:
      mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)ro,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)


      [2]:

      Source Code

      1. myUBOOT:
      2. # mtdparts
      3. unexpected character 'r' at the end of partition
      4. F+S UBOOT:
      5. efusA9X # mtdparts
      6. device nand0 <gpmi-nand>, # parts = 8
      7. #: name size offset mask_flags
      8. 0: NBoot 0x00040000 0x00000000 1
      9. 1: UserDef 0x000c0000 0x00040000 0
      10. 2: Refresh 0x00040000 0x00100000 1
      11. 3: UBoot 0x000c0000 0x00140000 1
      12. 4: UBootEnv 0x00040000 0x00200000 1
      13. 5: Kernel 0x00800000 0x00240000 1
      14. 6: FDT 0x001c0000 0x00a40000 1
      15. 7: TargetFS 0x0f400000 0x00c00000 0
      16. active partition: nand0,0 - (NBoot) 0x00040000 @ 0x00000000
      17. defaults:
      18. mtdids : nand0=gpmi-nand
      19. mtdparts: none
      [1] shows the only change from my side regarding on modul nand flash in the F+S uboot sou res. I made a test and yes: If UBootEnv is 'rw' the bootloader is not able to access the nand flash. If I change the mode back to 'ro' my bootloader is working and can access the nand flash.

      Can you confirm this behavior on your side to?


      [1] in include/configs/fsimx6sx.h:
      /* Define MTD partition info */
      #if CONFIG_SYS_MAX_NAND_DEVICE > 1
      #define MTDIDS_DEFAULT "nand0=gpmi-nand0,nand1=gpmi-nand1"
      #define MTDPART_DEFAULT "nand0,0"
      #define MTDPARTS_PART1 "fsnand1:256k(NBoot)ro\\\\;fsnand0:768k@256k(UserDef)"
      #else
      #define MTDIDS_DEFAULT "nand0=gpmi-nand"
      #define MTDPART_DEFAULT "nand0,1"
      #define MTDPARTS_PART1 "gpmi-nand:256k(NBoot)ro,768k(UserDef)"
      #endif
      //#define MTDPARTS_PART2 "256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)ro"
      #define MTDPARTS_PART2 "256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw"
      #define MTDPARTS_PART3 "8m(Kernel)ro,1792k(FDT)ro"
      #define MTDPARTS_PART4 "-(TargetFS)"
      #define MTDPARTS_STD "setenv mtdparts mtdparts=" MTDPARTS_PART1 "," MTDPARTS_PART2 "," MTDPARTS_PART3 "," MTDPARTS_PART4
      #define MTDPARTS_UBIONLY "setenv mtdparts mtdparts=" MTDPARTS_PART1 "," MTDPARTS_PART2 "," MTDPARTS_PART4

      BrenkeM wrote:


      mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)

      What I meant was: To have read-write, you must not write "rw", you have to leave the place empty. So simply remove this "rw", then you have the partition read-write. "rw" is an invalid suffix to a partition. The suffix is either empty or "ro". See partitions UserDef and TargetFS for example, these two partitions are both read-write and have no suffix. A partition is read-write by default, so you only have to append something to the declaration if it should *not* be read-write.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.