Skip to contentSkip to conversation

nand/mpc512x: Add MPC512x NAND support (NFC)

PATCH New Stefan Roese 4 participants 13 messages Jun 8, 2009 – Jun 9, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 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 poont 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.

Cc Piotr Ziecik <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc John Rigby <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/Makefile      |    1 +
 drivers/mtd/nand/mpc5121_nfc.c |  663 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 664 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/Makefile +1 -0
index 471cd6b..71dd5b9 100644
@@ -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 +663 -0

663 lines not on this page · raw message

Signature · 1 line
1.6.3.2
#1 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Dear Stefan Roese,

Quoted 10 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 poont of view):

s/poont/point/

And please reduce the line length for the commit message.

...

drivers/mtd/nand/mpc5121_nfc.c line 3

Quoted 9 lines
drivers/mtd/nand/mpc5121_nfc.c new file +3 -0
new file mode 100644
index 0000000..b0305b5
@@ -0,0 +1,663 @@
+/*
+ * Copyright 2004-2008 Freescale Semiconductor, Inc.
+ * Copyright 2009 Semihalf.

You did not add/modify any significant amount of code?

Best regards,

Wolfgang Denk

Signature · 6 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 find this a nice feature but it is not according to  the  documen-
tation. Or is it a BUG?"   "Let's call it an accidental feature. :-)"
                       - Larry Wall in <[email protected]>
#2 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Hi Wolfgang,

Quoted 8 lines · On Monday 08 June 2009 12:41:35 Wolfgang Denk wrote:
Quoted 8 lines

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"

Quoted 7 lines
Quoted 3 lines

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 poont of view):

s/poont/point/

And please reduce the line length for the commit message.

OK.

Quoted 11 lines

drivers/mtd/nand/mpc5121_nfc.c line 3

Quoted 9 lines
(quoted diff) +0 -0

b/drivers/mtd/nand/mpc5121_nfc.c new file mode 100644 index 0000000..b0305b5

drivers/mtd/nand/mpc5121_nfc.c new file +3 -0
@@ -0,0 +1,663 @@
+/*
+ * Copyright 2004-2008 Freescale Semiconductor, Inc.
+ * Copyright 2009 Semihalf.

You did not add/modify any significant amount of code?

Yes, I just forgot to add myself to this list. Thanks for reminding.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#3 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

In reply to Stefan Roese
Quoted 6 lines · Monday 08 June 2009 09:51:15 Stefan Roese 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:

Quoted 7 lines

"[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 poont of view):

- Compatibility with the Linux NAND driver (e.g. ECC usage)

I do not see ADS5121 support in posted driver code. ADS5121 board controls NAND chip selects via external CPLD and do not use controller chip select signals. Linux driver has workaround for this special case.

Signature · 2 lines
Best regards.
Piotr Ziecik
#4 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Quoted 13 lines · On Monday 08 June 2009 12:54:45 Piotr Zi?cik wrote:
Quoted 12 lines · Monday 08 June 2009 09:51:15 Stefan Roese 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 poont of view):

Quoted 5 lines
Quoted 1 line

- Compatibility with the Linux NAND driver (e.g. ECC usage)

I do not see ADS5121 support in posted driver code. ADS5121 board controls NAND chip selects via external CPLD and do not use controller chip select signals. Linux driver has workaround for this special case.

Yes, I know. I explicitly removed this code because of two reasons:

a) My basic testing platform was the esd mecp5123 board.

b) I did some quick tests on the MCP5121ADS with this code (without this ADS specific chip-select handling) and didn't see any error.

So I suggest to add the code as is for now. Such board specific routines can be added later on when really needed.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#5 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Dear Stefan Roese,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 4 lines

I do not see ADS5121 support in posted driver code. ADS5121 board controls NAND chip selects via external CPLD and do not use controller chip select signals. Linux driver has workaround for this special case.

Yes, I know. I explicitly removed this code because of two reasons:

Argh. That's a really stupid thing to do.

Quoted 7 lines

a) My basic testing platform was the esd mecp5123 board.

b) I did some quick tests on the MCP5121ADS with this code (without this ADS specific chip-select handling) and didn't see any error.

So I suggest to add the code as is for now. Such board specific routines can be added later on when really needed.

Nope. If the original version of the code contained this support, it makes no sense to me to actively remove it now and add additional effort later to re-add it.

Please undo that removal.

Best regards,

Wolfgang Denk

Signature · 6 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
Lots of people drink from the wrong bottle sometimes.
	-- Edith Keeler, "The City on the Edge of Forever",
	   stardate unknown
#6 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Quoted 7 lines · On Monday 08 June 2009 20:08:21 Wolfgang Denk wrote:
Quoted 5 lines
Quoted 3 lines

I do not see ADS5121 support in posted driver code. ADS5121 board controls NAND chip selects via external CPLD and do not use controller chip select signals. Linux driver has workaround for this special case.

Yes, I know. I explicitly removed this code because of two reasons:

Argh. That's a really stupid thing to do.

Did you actually see the code? Did you see the board specific code added to the "common" NFC driver code? This is not really something I like to see in common drivers. And such code usually get's a NAK from you as well.

Quoted 11 lines
Quoted 7 lines

a) My basic testing platform was the esd mecp5123 board.

b) I did some quick tests on the MCP5121ADS with this code (without this ADS specific chip-select handling) and didn't see any error.

So I suggest to add the code as is for now. Such board specific routines can be added later on when really needed.

Nope. If the original version of the code contained this support, it makes no sense to me to actively remove it now and add additional effort later to re-add it.

As stated above this ADS addition is not a "clean" one. So there is effort necessary to make it acceptable. And as I also stated the driver works without this code just fine and the ADS. At least my tests didn't show any problems.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#7 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Stephan,

Are you able to read the second half of the NAND? The NAND package on the ADS contains two chips with two separate chip selects. Without the chip select code you will likely only see 512M instead of 1G.

John

Quoted 43 lines · Stefan Roese
Quoted 2 lines · On Monday 08 June 2009 20:08:21 Wolfgang Denk wrote:
Quoted 2 lines
Quoted 2 lines

I do not see ADS5121 support in posted driver code. ADS5121 board controls NAND chip selects via external CPLD and do not use

controller

Quoted 1 line
Quoted 1 line
Quoted 1 line

chip select signals. Linux driver has workaround for this special

case.

Quoted 4 lines
Quoted 2 lines

Yes, I know. I explicitly removed this code because of two reasons:

Argh. That's a really stupid thing to do.

Did you actually see the code? Did you see the board specific code added to the "common" NFC driver code? This is not really something I like to see in common drivers. And such code usually get's a NAK from you as well.

Quoted 6 lines
Quoted 6 lines

a) My basic testing platform was the esd mecp5123 board.

b) I did some quick tests on the MCP5121ADS with this code (without this ADS specific chip-select handling) and didn't see any error.

So I suggest to add the code as is for now. Such board specific

routines

Quoted 5 lines
Quoted 1 line

can be added later on when really needed.

Nope. If the original version of the code contained this support, it makes no sense to me to actively remove it now and add additional effort later to re-add it.

As stated above this ADS addition is not a "clean" one. So there is effort necessary to make it acceptable. And as I also stated the driver works without
this code just fine and the ADS. At least my tests didn't show any problems.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#8 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

John,

Quoted 3 lines · On Monday 08 June 2009 21:09:01 John Rigby wrote:

Are you able to read the second half of the NAND? The NAND package on the ADS contains two chips with two separate chip selects. Without the chip select code you will likely only see 512M instead of 1G.

No, I didn't test the whole chip. This might explain why my tests in the first 16MiB worked just fine. Thanks for letting me know.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#9 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

In reply to Stefan Roese

Dear Stefan,

Quoted 4 lines · In message <[email protected]> you wrote:

Did you actually see the code? Did you see the board specific code added to the "common" NFC driver code? This is not really something I like to see in common drivers. And such code usually get's a NAK from you as well.

No, I didn't check that code.

Hm... but then we need a clean way to implement this - in U-Boot and Linux.

Quoted 3 lines

As stated above this ADS addition is not a "clean" one. So there is effort necessary to make it acceptable. And as I also stated the driver works without this code just fine and the ADS. At least my tests didn't show any problems.

What exactly did you test? Did your tests include (for example) reading and writing to a file system on NAND?

Best regards,

Wolfgang Denk

Signature · 6 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
At the source of every error which is blamed on the computer you will
find at least two human errors, including the error of blaming it  on
the computer.
#10 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Hi Wolfgang,

Quoted 9 lines · On Monday 08 June 2009 21:46:08 Wolfgang Denk wrote:
Quoted 4 lines

Did you actually see the code? Did you see the board specific code added to the "common" NFC driver code? This is not really something I like to see in common drivers. And such code usually get's a NAK from you as well.

No, I didn't check that code.

Hm... but then we need a clean way to implement this - in U-Boot and Linux.

ACK. But please note that the scope of my current project is not support NAND on MPC5121ADS, but on esd MECP5123. MPC5121ADS support can be added in a clean way later on.

Quoted 7 lines
Quoted 4 lines

As stated above this ADS addition is not a "clean" one. So there is effort necessary to make it acceptable. And as I also stated the driver works without this code just fine and the ADS. At least my tests didn't show any problems.

What exactly did you test? Did your tests include (for example) reading and writing to a file system on NAND?

I used "nand read/write" for testing.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#11 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Dear Stefan Roese,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Quoted 5 lines

Did you actually see the code? Did you see the board specific code added to the "common" NFC driver code? This is not really something I like to see in common drivers. And such code usually get's a NAK from you as well.

No, I didn't check that code.

Now I did check the code. You are right - that's not really nice.

Quoted 6 lines
Quoted 2 lines

Hm... but then we need a clean way to implement this - in U-Boot and Linux.

ACK. But please note that the scope of my current project is not support NAND on MPC5121ADS, but on esd MECP5123. MPC5121ADS support can be added in a clean way later on.

When pushing code into mainline, the purpose of the review is to make sure the code optimally supports the ideas and purposes of the mainline version - it is pretty much normal that this is in conflkict with the interests of any specific project, which has to be interested in minimizing efforts.

Quoted 4 lines
Quoted 2 lines

What exactly did you test? Did your tests include (for example) reading and writing to a file system on NAND?

I used "nand read/write" for testing.

Given John's comments it seems you accessed only the lower half of the device.

Please rework the patch so it keeps all the features we support in the Linux driver. Thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
Don't hit a man when he's down - kick him; it's easier.
#12 lore raw

PATCH 1/1 nand/mpc512x: Add MPC512x NAND support (NFC)

Hi Wolfgang,

Quoted 2 lines · On Tuesday 09 June 2009 10:46:42 Wolfgang Denk wrote:

Please rework the patch so it keeps all the features we support in the Linux driver. Thanks.

I'll give it a try this afternoon...

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================