nand/mpc512x: Add MPC512x NAND support (NFC)
Subsystems (2)
PATCH v3 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)
This patch adds NAND Flash Controller driver for MPC5121 revision 2. All device features, except hardware ECC and power management, are supported.
This NFC driver replaces the one orignally posted by John Rigby:
"[PATCH] Freescale NFC NAND driver"
It's a port of the Linux driver version posted by Piotr Ziecik a few weeks ago. Using this driver has the following advantages (from my point of view):
- Compatibility with the Linux NAND driver (e.g. ECC usage)
- Better code quality in general
- Resulting U-Boot image is a bit smaller (approx. 3k)
- Better to sync with newer Linux driver versions
The only disadvantage I can see, is that HW-ECC is not supported right now. But this could be added later (e.g. port from Linux driver after it's supported there). Using HW-ECC on the MCP5121 NFC has a general problem because of the ECC usage in the spare area. This collides with JFFS2 for example.
---
v3:
- Reworked chip-select routines after testing on MPC5121ADS with 2 NAND chips. Tested successfully on MPC5121ADS and esd MECP5123.
v2:
- Added (C) for myself
- Reduced line length of commit text
- Fixed spelling error in commit text
- chip select function is implemented as weak default so that board may implement a board specific variant (e.g. MPC5121ADS)
drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/mpc5121_nfc.c | 692 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 693 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/Makefile +1 -0
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o +COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
drivers/mtd/nand/mpc5121_nfc.c new file +692 -0
692 lines not on this page · raw message
Signature · 1 line
1.6.3.2
PATCH v3 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)
Dear Stefan Roese,
Quoted 41 lines · In message <[email protected]> you wrote:
This patch adds NAND Flash Controller driver for MPC5121 revision 2. All device features, except hardware ECC and power management, are supported.
This NFC driver replaces the one orignally posted by John Rigby:
"[PATCH] Freescale NFC NAND driver"
It's a port of the Linux driver version posted by Piotr Ziecik a few weeks ago. Using this driver has the following advantages (from my point of view):
- Compatibility with the Linux NAND driver (e.g. ECC usage)
- Better code quality in general
- Resulting U-Boot image is a bit smaller (approx. 3k)
- Better to sync with newer Linux driver versionsThe only disadvantage I can see, is that HW-ECC is not supported right now. But this could be added later (e.g. port from Linux driver after it's supported there). Using HW-ECC on the MCP5121 NFC has a general problem because of the ECC usage in the spare area. This collides with JFFS2 for example.
Signed-off-by Stefan Roese <[email protected]>Cc Piotr Ziecik <[email protected]>Cc Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>Cc Scott Wood <[email protected]>---
v3:
- Reworked chip-select routines after testing on MPC5121ADS with 2 NAND chips. Tested successfully on MPC5121ADS and esd MECP5123.v2:
- Added (C) for myself
- Reduced line length of commit text
- Fixed spelling error in commit text
- chip select function is implemented as weak default so that board may implement a board specific variant (e.g. MPC5121ADS)
Quoted 4 lines
drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/mpc5121_nfc.c | 692 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 693 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/mpc5121_nfc.c
Applied to u-boot-mpc5xxx repo, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de One difference between a man and a machine is that a machine is quiet when well oiled.
PATCH v3 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)
In reply to Stefan RoeseDear Stefan,
Quoted 7 lines · In message <[email protected]> you wrote:
This patch adds NAND Flash Controller driver for MPC5121 revision 2. All device features, except hardware ECC and power management, are supported.
This NFC driver replaces the one orignally posted by John Rigby:
"[PATCH] Freescale NFC NAND driver"
I think ther emust be still problems with that driver.
I tried and enabled mtdparts and JFFS2 support, but I get strange errors.
For example on MPS5121ADS:
...
U-Boot 2009.06-rc3-00151-g2ac050e-dirty (Jun 14 2009 - 19:31:39) MPC512X
CPU: MPC5121e rev. 2.0, Core e300c4 at 400 MHz, CSB at 200 MHz
Board: ADS5121 rev. 0x0400 (CPLD rev. 0x05)
I2C: ready
DRAM: 512 MB
FLASH: 64 MB
NAND: 1024 MiB
PCI: Bus Dev VenId DevId Class Int
00 15 8086 107c 0200 00...
=> chpart nand0,0
+ id=1: nor0 67108864 bytes fc000000.flash
+ id=2: nand0 536870912 bytes mpc5121.nand
partition changed to nand0,0
=> ls
Scanning JFFS2 FS: read_nand_cached: error reading nand off 0x75fe00 size 8192 bytesread_nand_cached: error reading nand off 0x77fe00 size 8192 bytesread_nand_cached: error reading nand off 0x760000 size 8192 bytesread_nand_cached: error reading nand off 0xeffe00 size 8192 bytesread_nand_cached: error reading nand off 0xf1fe00 size 8192 bytesread_nand_cached: error reading nand off 0xf00000 size 8192 bytesread_nand_cached: error reading nand off 0x905fe00 size 8192 bytesread_nand_cached: error reading nand off 0x907fe00 size 8192 bytesread_nand_cached: error reading nand off 0x9060000 size 8192 bytesread_nand_cached: error reading nand off 0x909fe00 size 8192 bytesread_nand_cached: error reading nand off 0x9080000 size 8192 bytesread_nand_cached: error reading nand off 0xb3ffe00 size 8192 bytesread_nand_cached: error reading nand off 0xb400000 size 8192 bytesread_nand_cached: error reading nand off 0xc5ffe00 size 8192 bytesread_nand_cached: error reading nand off 0xc600000 size 8192 bytesread_nand_cached: error reading nand off 0xfaffe00 size 8192 bytesread_nand_cached: error reading nand off 0xfb1fe00 size 8192 bytesread_nand_cached: error reading nand off 0xfb00000 size 8192 bytesread_nand_cached: error reading nand off 0xfb3fe00 size 8192 bytesread_nand_cached: error reading nand off 0xfb20000 size 8192 bytesread_nand_cached: error reading nand off 0x1f05fe00 size 8192 bytesread_nand_cached: error reading nand off 0x1f07fe00 size 8192 bytesread_nand_cached: error reading nand off 0x1f060000 size 8192 bytesread_nand_cached: error reading nand off 0x1ffbfe00 size 8192 bytesread_nand_cached: error reading nand off 0x1ffdfe00 size 8192 bytesread_nand_cached: error reading nand off 0x1ffc0000 size 8192 bytesread_nand_cached: error reading nand off 0x1ffffe00 size 8192 bytesread_nand_cached: error reading nand off 0x1ffe0000 size 8192 bytes done.
=>
Note that the debug output above indicates that the partition support seems to see only 512 MB of NAND flash, while there are actually 1024 MB available (see U-Boot start message above).
On ARIA I see this:
=> nand bad Device 0 bad blocks: Bad block table found at page 65472, version 0x01 Bad block table found at page 65408, version 0x01 nand_read_bbt: Bad block at 0x01480000 01480000 07f80000 07fa0000 07fc0000 07fe0000 => nand bad Device 0 bad blocks: 01480000 07f80000 07fa0000 07fc0000 07fe0000
Why does the output of the two invocations of the "nand bad" command differ?
Are above lines debug messages that should be silenced, or is it useful information that should always be printed?
Then:
=> chpar nand0,0 partition changed to nand0,0 => ls Scanning JFFS2 FS: read_nand_cached: error reading nand off 0x147fe00 size 8192 bytes read_nand_cached: error reading nand off 0x1480000 size 8192 bytes ...... read_nand_cached: error reading nand off 0x7fffe00 size 8192 bytes done. -rwxr-xr-x 26616 Wed Apr 02 00:27:17 2008 zipnote -rwxr-xr-x 26616 Wed Apr 02 00:27:17 2008 zipsplit -rwxr-xr-x 1731 Tue Apr 01 23:20:08 2008 zless -rwxr-xr-x 2605 Tue Apr 01 23:20:08 2008 zmore -rwxr-xr-x 5234 Tue Apr 01 23:20:08 2008 znew -rwxr-xr-x 22260 Tue Apr 01 23:24:04 2008 zsoelim -rwxr-xr-x 15088 Tue Apr 01 22:51:21 2008 yes -rwxr-xr-x 67 Tue Apr 01 23:20:08 2008 zcmp -rwxr-xr-x 4417 Tue Apr 01 23:20:08 2008 zdiff -rwxr-xr-x 62 Tue Apr 01 23:20:08 2008 zegrep ...
What do the "read_nand_cached" error messages mean? They kind of match the bad block information above - so is this debug code that should be silenced?
Also, do you think it is normal that the listing above takes 6.5 seconds or so - per line of output?!?!
Any help appreciated.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I can type faster than I can move a mouse, so I find menu-driven drawing packages time consuming and frustrating. - W. R. Stevens