I am trying to bring up a Custom board with SAMA5D28 (MRL C) processor. This board design is based on SAMA5D2 xplained (XULT) rev 2 board. We have also added nandflash additionally to our custom board.
I'm using sam-ba_3.2.0 for programming the nandflash.
I'm facing some issue with nandflash in u-boot. Here are the details of nandflash I'm using
Model: Micron MT29F8G08ABABAWP (1 Giga Bytes, 8 bit)
– Page size x8: 4320 bytes (4096 + 224 bytes)
– Block size: 128 pages (512K +28 K bytes)
– Plane size: 2 planes x 1024 blocks per plane
– Device size: 8Gb: 2048 blocks
- Minimum required ECC: 4-bit ECC
I have used "0xc2a02e07" as pmecc header value while programming the nandflash.
I have been able to get the at91bootstrap up and it copies uboot code into appropriate RAM location.usePmecc = 1, (0x1)
nbSectorPerPage = 3, (0x3) - 8 sectors per page
spareSize = 224, (0xe0)
eccBitReq = 1, (0x1) - 4 bits ECC
sectorSize = 0, (0x0) - 512 bytes per secor consideration
eccOffset = 168, (0xa8) - 7 bytes/sector, so 224-(7*8) = 168.
Even uboot comes up and detects the nandflash correctly (that its 1024 MiB nand). Now, uboot throws an error saying that NO valid environment area found in nandflash. Also, reports that a bad block in offset 0x100000 while trying to save an environment variable using saveenv command.
Here is the log:
Please refer to attached schematics for nandflash connectionsRomBOOT
AT91Bootstrap 3.8.9-dirty (Wed Oct 11 19:11:44 IST 2017) SemaConnect
All interrupts redirected to AIC
Auto-Config the TWI Bus by the board
NAND: ONFI flash detected
NAND: Manufacturer ID: 0x2c Chip ID: 0x38
NAND: Page Bytes: 4096, Spare Bytes: 224
NAND: ECC Correctability Bits: 4, ECC Sector Bytes: 512
NAND: Disable On-Die ECC
PMECC: version is: 0x0
PMECC: page_size: 4096, oob_size: 224, pmecc_cap: 4, sector_size: 512
NAND: Initialize PMECC params, cap: 4, sector: 512
NAND: Image: Copy 0xa0000 bytes from 0x40000 to 0x26f00000
NAND: Done to load image
U-Boot 2017.03-linux4sam_5.7-dirty (Oct 17 2017 - 16:01:17 +0530)
Crystal frequency: 12 MHz
CPU clock : 498 MHz
Master clock : 166 MHz
DRAM: 256 MiB
NAND: 1024 MiB
MMC: sdio-host@a0000000: 0, sdio-host@b0000000: 1
*** Error - No Valid Environment Area found
*** Warning - bad CRC, using default environment
Failed to read ethernet address from EEPROM
Warning: ethernet@f8008000 (eth0) using random MAC address - aa:1a:25:4c:28:89
Hit any key to stop autoboot: 0
=> setenv ethaddr aa:1a:25:4c:28:89
Saving Environment to NAND...
Erasing redundant NAND...
Attempt to erase non block-aligned data
Skipping bad block at 0x00100000
Writing to NAND... FAILED!
Please help in resolving the issue.