AnsweredAssumed Answered

How to setup NOR flash partitions for MPC8308 in U-Boot or Linux?

Question asked by Nikolay Chernov on Jul 12, 2012
Latest reply on Aug 6, 2012 by Nikolay Chernov

Hi all,

 

The question is about MPC8308-RDB BSP.

 

BSP version (according to README.BSP file): 20100413Kernel version: Linux-2.6.29.6-rt23Host Linux: Debian 6, kernel 2.6.32-5-686

In our project based on MPC8308 we want to have possibility to update entire file system and probably kernel and U-Boot images as well from Linux user space application (not from U-Boot).

 

Default flash partitions look like following:

[root@mpc8308erdb /]# cat /proc/mtddev:    size   erasesize  namemtd0: 00100000 00010000 "u-boot"mtd1: 00400000 00010000 "fs"mtd2: 00200000 00010000 "kernel"mtd3: 00100000 00010000 "dtb"mtd4: 00100000 00004000 "U-Boot-NAND"mtd5: 00800000 00004000 "JFFS2-NAND"mtd6: 00400000 00004000 "Ramdisk-NAND"mtd7: 01000000 00004000 "Reserved-NAND"mtd8: 00200000 00004000 "Kernel-NAND"mtd9: 00100000 00004000 "DTB-NAND"

Just for test I tried to use flashcp utility to update kernel image in flash:

flashcp -v /tmp/uImage /dev/mtd2

Operation succeeded but when I tried to boot from flash CRC check failed for ramdisk image.

 

As far as I understand this partitions structure is defined in DTB file. I have used dtc compiler to generate readable DTS file and realized that partitions defined there don't match real U-Boot, kernel, ramdisk and dtb image locations. Real image locations are set by U-Boot environment variables and described in "BSP Targeting the Freescale MPC8308E RDB Board - User's Guide":

The 8M NOR flash starts at address 0xfe000000: Range Start   Range End      Definition                         0xfe00_0000   0xfe05_ffff    U-Boot              0xfe0a_0000   0xfe2f_ffff    Kernel              0xfe30_0000   0xfe7e_ffff    Ramdisk file system 0xfe7f_0000   0xfe7f_3fff    DTB                 0xfe7f_e000   0xfe7f_ffff    Vitesse            

Piece of DTS file describing partitions of NOR flash

flash@0,0 {  #address-cells = <0x1>;  #size-cells = <0x1>;  compatible = "cfi-flash";  reg = <0x0 0x0 0x800000>;  bank-width = <0x2>;  device-width = <0x1>;   u-boot@0 {   reg = <0x0 0x100000>;   read-only;  };  fs@100000 {   reg = <0x100000 0x400000>;  };  kernel@500000 {   reg = <0x500000 0x200000>;  };  dtb@700000 {   reg = <0x700000 0x100000>;  }; };

So at this moment I decided that I need to change partitions. First way that I saw was to modify somehow DTB file. But it is much better to have possibility to control partitions in U-Boot and Linux so I started to study MTD utilities.

 

When I call mtdpart it reports two issues:

=> mtdpartmtdparts variable not set, see 'help mtdparts'Device nor0 not found!

 

First issue is easy to fix - mtdparts syntax seems to be clear, but I haven't managed how to fix second. As far as I understand this is related to the value of mtdids variable. Its default value is following

mtdids=nor0=nor,nand0=nand

So there is some problem with nor0 declaration... I have tried some different combinations (like nor0=nor0, nor0=flash0, flash0=nor... etc. Probably it looks silly but I have seen a lot of strange mtdids declarations while I have been studying this issue).

 

So could anybody say how to setup mtdids variable properly for MPC8308?

 

It there any other way to setup flash partitions for MPC8308 in U-Boot or Linux?

Outcomes