How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

Here is an example for i.MX28 EVK board to support SPI NOR boot in uboot, kernel and MFGTool.

 

Attached files are the patches to support SPI NOR flash on i.MX28 EVK bord based on L2.6.35 ER11.09.01 BSP. It was verified on Spansion s25fl256s SPI NOR.

"ER11.09.01_uboot_imx28_spi_nor.patch" is the Uboot patch.
"ER11.09.01_kernel_imx28_spi_nor.patch" is the kernel patch.
"ucl.xml" is the updated MFGTool config file, please update it to "Mfgtools-Rel\Profiles\MX28 Linux Update\OS Firmware\ucl.xml".

 

The uboot boot paramters for SPI:
setenv bootargs_base 'setenv bootargs console=ttyAM0,115200'
setenv loadaddr 0x42000000
setenv bootargs_spi 'setenv bootargs ${bootargs} root=/dev/mtdblock2 rootfstype=jffs2 rootwait rw ip=none'
setenv bootcmd_spi 'run bootargs_base bootargs_spi;sf probe 2:0; sf read ${loadaddr} 0x100000 0x300000;bootm'
setenv bootcmd 'run bootcmd_spi'
saveenv

 

To boot the board from SPI NOR s25fl256s, the 4KB page region of the NOR should be put to top, the last 128KB of the NOR address space. The uboot.sb is about 220KB, it can't be put to 4KB and 64KB combined region. The IMX28 boot ROM can only handle simple page size for boot. All 4KB page region or all 64KB page region are both OK for boot, but combined region can't boot.

 

For default, the s25fl256s NOR's 128KB 4KB page size region is at the bottom of the NOR, we should update the OTP to set this region to TOP, in Uboot, we run the followed command to burn the OTP:
MX28 U-Boot -> sf probe 2:0
MX28 U-Boot -> sf set_config_reg 0x04

 

To boot the i.MX28 EVK board from SPI2 NOR flash, the BM3~0 should be 0010.

 

In this example, we only used the JFFS2 file system. To support the UBIFS, there is a known issue, that the UBIFS will use vmalloc to alloc memory, and if SPI driver used the DMA, kernel will halt with error "kernel BUG at arch/arm/mm/dma-mapping.c:409!".

 

For 11.09.01 BSP, the default MFGTool rootfs "initramfs.cpio.gz" will be bigger than 4MB, but in i.MX28 bootlets code, the BSP only set ramdisk to 4MB, so we need modify this limitation for MFGTool.

 

Use command "./ltib -p imx-bootlets -m prep" to get the bootlets code, modify "ltib/rpm/BUILD/imx-bootlets-src-11.09.01/linux_prep/core/setup.c", function setup_initrd_tag(), change from "params->u.initrd.size =  0x00400000;" to "params->u.initrd.size =  0x00500000;".

Modify "ltib/rpm/BUILD/imx-bootlets-src-11.09.01/updater.bd" and "updater_ivt.bd", change from "load 0.b    > 0x40800000..0x40c00000;" to "load 0.b    > 0x40800000..0x40d00000;".

 

Now the MFGTool rootfs size can be 5MB.

 

2013-05-09: Updated hardware rework:

On iMX28 EVK board, rework J89 as followed and mount R320,R321,R322 and C178.

MX28 U49 Pin1 /CS <-> NOR Pin7 CS#

MX28 U49 Pin2  D0 <-> NOR Pin8 SI/IO1

MX28 U49 Pin5 DIO <-> NOR Pin15 SI/IO0

MX28 U49 Pin6 CLK<-> NOR pin 16 SCK.

MX28 U49 Pin8 VCC <-> NOR Pin2 VCC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

MX28 U49 Pin4 GND <-> NOR Pin10 VSS

MX28 U49 Pin3 /WP <-> NOR Pin9 WP

MX28 U49 Pin7 /Hold <-> NOR Pin pin1 hold

 

Software reset issue for 32MB SPI NOR:

For 32MB SPI NOR, after booted into kernel, the kernel driver will set SPI NOR to 4 bytes address mode, but for iMX28 SPI boot, it can only boot with 3 bytes address mode, if reset the iMX28 board but SPI NOR was not reset, it will fail to reboot.

Hardware solution: when iMX28 was reboot, reset the SPI NOR too, the SPI NOR will work in 3 bytes address mode as default.

Software solution: In kernel SPI NOR driver, always switch SPI NOR to 3 bytes address mode after each SPI NOR access, and switch to 4 bytes address mode before each access.

There is no such issue if the SPI NOR size is less than 32MB.

 

 

ラベル(2)
添付
評価なし
バージョン履歴
最終更新日:
‎10-16-2012 12:11 AM
更新者: