Skip to contentSkip to conversation

driver extension to support NAND on TQM85xx modules

PATCH Superseded Wolfgang Grandegger 4 participants 8 messages Jun 5, 2008 – Jun 9, 2008

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 driver extension to support NAND on TQM85xx modules

[NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to support NAND on the TQM85xx modules. Unfortunately, the hardware does not support the R/B pins of the NAND chip and therefore the specified maximum delay time must used. It therefore re-introduces the chip-delay property.

Note: this patch is based on various patches from Anton Vorontsov posted

      to this list:

      http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.
      http://ozlabs.org/pipermail/linuxppc-dev/2008-May/057158.html
      http://ozlabs.org/pipermail/linuxppc-dev/2008-May/056531.html
      http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057244.html

      They should show up mainstream soon.
---
 Documentation/powerpc/booting-without-of.txt |    1 +
 drivers/mtd/nand/Kconfig                     |    2 +-
 drivers/mtd/nand/fsl_upm.c                   |   17 +++++++++++++----
 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/mtd/nand/Kconfig +1 -1
Index: linux-2.6-galak/drivers/mtd/nand/Kconfig
===================================================================
@@ -380,7 +380,7 @@ config MTD_NAND_FSL_ELBC
 
 config MTD_NAND_FSL_UPM
 	tristate "Support for NAND on Freescale UPM"
-	depends on MTD_NAND && OF_GPIO && (PPC_83xx || PPC_85xx)
+	depends on MTD_NAND && (PPC_83xx || PPC_85xx)
 	select FSL_LBC
 	help
 	  Enables support for NAND Flash chips wired onto Freescale PowerPC
drivers/mtd/nand/fsl_upm.c +13 -4
Index: linux-2.6-galak/drivers/mtd/nand/fsl_upm.c
===================================================================
@@ -13,6 +13,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
@@ -36,6 +37,7 @@ struct fsl_upm_nand {
 	uint8_t upm_cmd_offset;
 	void __iomem *io_base;
 	int rnb_gpio;
+	int chip_delay;
 };
 
 #define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd)
@@ -58,10 +60,11 @@ static void fun_wait_rnb(struct fsl_upm_
 	if (fun->rnb_gpio >= 0) {
 		while (--cnt && !fun_chip_ready(&fun->mtd))
 			cpu_relax();
+		if (!cnt)
+			dev_err(fun->dev, "tired waiting for RNB\n");
+	} else {
+		ndelay(100);
 	}
-
-	if (!cnt)
-		dev_err(fun->dev, "tired waiting for RNB\n");
 }
 
 static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
@@ -129,7 +132,7 @@ static int __devinit fun_chip_init(struc
 	fun->chip.IO_ADDR_R = fun->io_base;
 	fun->chip.IO_ADDR_W = fun->io_base;
 	fun->chip.cmd_ctrl = fun_cmd_ctrl;
-	fun->chip.chip_delay = 50;
+	fun->chip.chip_delay = fun->chip_delay;
 	fun->chip.read_byte = fun_read_byte;
 	fun->chip.read_buf = fun_read_buf;
 	fun->chip.write_buf = fun_write_buf;
@@ -233,6 +236,12 @@ static int __devinit fun_probe(struct of
 		goto err2;
 	}
 
+	prop = of_get_property(ofdev->node, "chip-delay", NULL);
+	if (prop)
+		fun->chip_delay = *prop;
+	else
+		fun->chip_delay = 50;
+
 	fun->io_base = devm_ioremap_nocache(&ofdev->dev, io_res.start,
 					  io_res.end - io_res.start + 1);
 	if (!fun->io_base) {
Documentation/powerpc/booting-without-of.txt +1 -0
Index: linux-2.6-galak/Documentation/powerpc/booting-without-of.txt
===================================================================
@@ -3007,6 +3007,7 @@ platforms are moved over to use the flat
       - reg : should specify localbus chip select and size used for the chip.
       - fsl,upm-addr-offset : UPM pattern offset for the address latch.
       - fsl,upm-cmd-offset : UPM pattern offset for the command latch.
+      - chip-delay : may specify a delay value in milliseconds.
       - gpios : may specify optional GPIO connected to the Ready-Not-Busy pin.
 
       Example:
#1 lore raw
Quoted 8 lines · Wolfgang Grandegger

[NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to support NAND on the TQM85xx modules. Unfortunately, the hardware does not support the R/B pins of the NAND chip and therefore the specified maximum delay time must used. It therefore re-introduces the chip-delay property.

Quoted 4 lines

Note: this patch is based on various patches from Anton Vorontsov posted
to this list:

http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.

Do you also want me to apply that patch (on which this one depends)? It says 'Signed-off-by: not yet' ...

You should probably comment on the removal of the OF_GPIO dependency. It looks fine, since the relevant functions all get stubbed out and will do the right thing, but it's worth a comment in the commit text.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Wolfgang Grandegger

[NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to support NAND on the TQM85xx modules. Unfortunately, the hardware does not support the R/B pins of the NAND chip and therefore the specified maximum delay time must used. It therefore re-introduces the chip-delay property.

Quoted 7 lines
Quoted 4 lines

Note: this patch is based on various patches from Anton Vorontsov posted
to this list:

http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.

Do you also want me to apply that patch (on which this one depends)? It says 'Signed-off-by: not yet' ...

Well, I have no objections to applying that patch, feel free to add my sign off. But if OF people will NAK the bindings, I'll have to bother you once again with the update to that driver. :-/

I've tried to push the bindings several times already, and always there were [absolutely legitimate] issues. The last RFC is here (along with other new bindings):

http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057244.html

so far no comments.. Probably a good sign. :-)

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#3 lore raw
Quoted 21 lines · Anton Vorontsov
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Wolfgang Grandegger

[NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to support NAND on the TQM85xx modules. Unfortunately, the hardware does not support the R/B pins of the NAND chip and therefore the specified maximum delay time must used. It therefore re-introduces the chip-delay property.

Quoted 6 lines
Quoted 4 lines

Note: this patch is based on various patches from Anton Vorontsov posted
to this list:

http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.

Do you also want me to apply that patch (on which this one depends)? It says 'Signed-off-by: not yet' ...

Well, I have no objections to applying that patch, feel free to add my sign off. But if OF people will NAK the bindings, I'll have to bother you once again with the update to that driver. :-/

Quoted 7 lines

I've tried to push the bindings several times already, and always there were [absolutely legitimate] issues. The last RFC is here (along with other new bindings):

http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057244.html

so far no comments.. Probably a good sign. :-)

I see. I think I should then also post the bindings (update of booting-without-of.txt) separately.

Wolfgang.

#4 lore raw
Quoted 2 lines

I see. I think I should then also post the bindings (update of booting-without-of.txt) separately.

Yes please. They are much easier to review that way (and they should be reviewed as a separate entity anyway).

Segher

#5 lore raw
Quoted 5 lines · Segher Boessenkool
Quoted 2 lines

I see. I think I should then also post the bindings (update of booting-without-of.txt) separately.

Yes please. They are much easier to review that way (and they should be reviewed as a separate entity anyway).

I just sent the patch "[PATCH] booting-without-of: add more bindings for FSL UPM driver" describing the binding separately.

Wolfgang.

#6 lore raw
In reply to David Woodhouse
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Wolfgang Grandegger

[NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to support NAND on the TQM85xx modules. Unfortunately, the hardware does not support the R/B pins of the NAND chip and therefore the specified maximum delay time must used. It therefore re-introduces the chip-delay property.

Quoted 7 lines
Quoted 4 lines

Note: this patch is based on various patches from Anton Vorontsov posted
to this list:

http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.

Do you also want me to apply that patch (on which this one depends)? It says 'Signed-off-by: not yet' ...

Anton has already answer that question.

Quoted 3 lines

You should probably comment on the removal of the OF_GPIO dependency. It looks fine, since the relevant functions all get stubbed out and will do the right thing, but it's worth a comment in the commit text.

OK, will do so.

Wolfgang.

#7 lore raw
In reply to David Woodhouse
Quoted 12 lines · David Woodhouse
Quoted 11 lines · Wolfgang Grandegger

[NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to support NAND on the TQM85xx modules. Unfortunately, the hardware does not support the R/B pins of the NAND chip and therefore the specified maximum delay time must used. It therefore re-introduces the chip-delay property.

Note: this patch is based on various patches from Anton Vorontsov posted
to this list:

Quoted 8 lines
Quoted 1 line
      http://ozlabs.org/pipermail/linuxppc-dev/2008-April/055587.html.

Do you also want me to apply that patch (on which this one depends)? It says 'Signed-off-by: not yet' ...

You should probably comment on the removal of the OF_GPIO dependency. It looks fine, since the relevant functions all get stubbed out and will do the right thing, but it's worth a comment in the commit text.

I just sent v3 of this patch with some better description.

Thanks,

Wolfgang.