Hi
I have a working i.MX28EVK, booting from SDCARD. My image has mtd-utils and the kernel is compiled to support NAND, JFFS and UBIFS.
I added a NAND chip using the available socket and this memory is recognized when booting (full log attached as lognand.txt)
NAND device: Manufacturer ID: 0x20, Chip ID: 0xda (ST Micro NAND 256MiB 3,3V 8-bit)
The default partitions are created (mtd0 and mtd1) as well. However, I can not write to these partitions. For instance, if I try to use the nandtest utility, I receive many "Input/output" errors:
root@host ~$ nandtest /dev/mtd0
ECC corrections: 0
ECC failures : 0
Bad blocks : 0
BBT blocks : 0
00000000: erasing... MEMERASE: Input/output error
00020000: erasing... MEMERASE: Input/output error
...
The same error if I try uibformat:
root@host ~$ ubiformat /dev/mtd1
ubiformat: mtd1 (nand), size 247463936 bytes (236.0 MiB), 1888 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1887 -- 100 % complete
ubiformat: 1888 eraseblocks are supposedly empty
ubiformat: formatting eraseblock 0 -- 0 % complete
ubiformat: error!: failed to erase eraseblock 0
error 5 (Input/output error)
It seems that some write protection is enabled or I am missing something.
Any tips ?
Thanks in advance
PS: I checked the board layout and it is possible to see the write protection pin connected to GPIO0_28. Searching, I discovered that it is necessary to add /sys/class/gpio option to kernel image in order to read/write any GPIO pin. I did it by I am not sure how to map GPIO0_28 into /sys/class/gpio/gpio[n]. Worst, I am not sure if the problem is related to this pin or not.
I managed to solve this problem by myself. It was necessary to change the pin assignment of GMPI_RESETN/GPIO0_28 inside kernel sources. I will describe the process here.
1) Inside your ltib directory, unpack the kernel sources:
./ltib -m prep -p kernel
2) open the file mx28evk_pins.c
vi rpm/BUILD/linux-2.6.35.3/arch/arm/mach-mx28/mx28evk_pins.c
3) Look for the following code inside this file:
.name = "GPMI RST-",
.id = PINID_GPMI_RESETN,
.fun = PIN_FUN1,
.strength = PAD_12MA,
.voltage = PAD_3_3V,
.pullup = 0,
.drive = !0
Change the pin function:
.fun = PIN_GPIO,
4) Create a patch:
./ltib -m patchmerge -p kernel
Now your next kernel build will include this patch.
It is useful to add mtd-utils to your package selection if you want to test your nand flash chip in a running system.