Skip to contentSkip to conversation

NAND: Multi-chip support for FSL-UPM for TQM8548 modules

PATCH In review Wolfgang Grandegger 3 participants 8 messages Mar 30, 2009 – Mar 31, 2009 2 messages not in the archive

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

v4 cover NAND: Multi-chip support for FSL-UPM for TQM8548 modules

This is my forth version of the patch series adding generic support for multi-chip NAND devices to the FSL-UPM driver and support for the Micron MT29F8G08FAB NAND flash memory on the TQM8548 modules. It addresses the issues reported on the mailing list, e.g. the new bindings are now documented as well:

NAND: FSL-UPM: add multi chip support
NAND: FSL-UPM: Add wait flags to support board/chip specific delays
powerpc: NAND: FSL UPM: document new bindings powerpc/85xx: TQM8548: Update DTS file for multi-chip support

Changes since v3:
- As Grant suggested, the property "fsl,upm-addr-line-cs-offsets" is now used to define multi-chip support using dedicated address lines for chip selection. This make the properties "num-chips" and "chip-offset" obsolte.

- As Grant suggested, I added the string "tqc,tqm8548-upm-nand" to the list of compatible devices for the TQM8548 modules in case it turns out in the future that the "fsl,upm-addr-line-cs-offsets" method is not generic enough.

- For multi-chip chip devices, the name "mchip" is now used in the code to avoid confusion with the normal NAND "chip".

- Coding style fixes as pointed out by Anton.

Patch 3 and 4 should go through the powerpc maintainer(s).

Hope this patch series is fine now for inclusion into 2.6.30.

Thanks,

Wolfgang.

#1 lore raw

PATCH v4 1/4 NAND: FSL-UPM: add multi chip support

This patch adds support for multi-chip NAND devices to the FSL-UPM driver. This requires support for multiple GPIOs for the RNB pins. The NAND chips are selected through address lines defined by the FDT property "fsl,upm-addr-line-cs-offsets".

---
 arch/powerpc/sysdev/fsl_lbc.c |    2 
 drivers/mtd/nand/fsl_upm.c    |   99 ++++++++++++++++++++++++++++++++----------
 2 files changed, 77 insertions(+), 24 deletions(-)
arch/powerpc/sysdev/fsl_lbc.c +1 -1
Index: linux-2.6/arch/powerpc/sysdev/fsl_lbc.c
===================================================================
@@ -150,7 +150,7 @@
 
 	spin_lock_irqsave(&fsl_lbc_lock, flags);
 
-	out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width));
+	out_be32(&fsl_lbc_regs->mar, mar);
 
 	switch (upm->width) {
 	case 8:
drivers/mtd/nand/fsl_upm.c +76 -23

194 lines not on this page · raw message

Acked-by on v4 1/4
#2 lore raw

Re: [PATCH v4 1/4] NAND: FSL-UPM: add multi chip support

Quoted 6 lines · Wolfgang Grandegger

This patch adds support for multi-chip NAND devices to the FSL-UPM driver. This requires support for multiple GPIOs for the RNB pins. The NAND chips are selected through address lines defined by the FDT property "fsl,upm-addr-line-cs-offsets".

#3 lore raw

PATCH v4 2/4 NAND: FSL-UPM: Add wait flags to support board/chip specific delays

In reply to Wolfgang Grandegger

The NAND flash on the TQM8548_BE modules requires a short delay after running the UPM pattern. The TQM8548_BE requires a further short delay after writing out a buffer. Normally the R/B pin should be checked, but it's not connected on the TQM8548_BE. The existing driver uses similar fixed delay points. To manage these extra delays in a more general way, I introduced the "fsl,ump-wait-flags" property allowing the board- specific driver to specify various types of extra delay.

---
 drivers/mtd/nand/fsl_upm.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsl_upm.c +18 -2
Index: linux-2.6/drivers/mtd/nand/fsl_upm.c
===================================================================
@@ -23,6 +23,10 @@
 #include <linux/io.h>
 #include <asm/fsl_lbc.h>
 
+#define FSL_UPM_WAIT_RUN_PATTERN  0x1
+#define FSL_UPM_WAIT_WRITE_BYTE   0x2
+#define FSL_UPM_WAIT_WRITE_BUFFER 0x4
+
 struct fsl_upm_nand {
 	struct device *dev;
 	struct mtd_info mtd;
@@ -41,6 +45,7 @@
 	uint32_t mchip_count;
 	uint32_t mchip_number;
 	int chip_delay;
+	uint32_t wait_flags;
 };
 
 #define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd)
@@ -96,7 +101,8 @@
 		fun->mchip_offsets[fun->mchip_number];
 	fsl_upm_run_pattern(&fun->upm, chip->IO_ADDR_R, mar);
 
-	fun_wait_rnb(fun);
+	if (fun->wait_flags & FSL_UPM_WAIT_RUN_PATTERN)
+		fun_wait_rnb(fun);
 }
 
 static void fun_select_chip(struct mtd_info *mtd, int mchip_nr)
@@ -138,8 +144,11 @@
 
 	for (i = 0; i < len; i++) {
 		out_8(fun->chip.IO_ADDR_W, buf[i]);
-		fun_wait_rnb(fun);
+		if (fun->wait_flags & FSL_UPM_WAIT_WRITE_BYTE)
+			fun_wait_rnb(fun);
 	}
+	if (fun->wait_flags & FSL_UPM_WAIT_WRITE_BUFFER)
+		fun_wait_rnb(fun);
 }
 
 static int __devinit fun_chip_init(struct fsl_upm_nand *fun,
@@ -285,6 +294,13 @@
 	else
 		fun->chip_delay = 50;
 
+	prop = of_get_property(ofdev->node, "fsl,upm-wait-flags", &size);
+	if (prop && size == sizeof(uint32_t))
+		fun->wait_flags = *prop;
+	else
+		fun->wait_flags = FSL_UPM_WAIT_RUN_PATTERN |
+				  FSL_UPM_WAIT_WRITE_BYTE;
+
 	fun->io_base = devm_ioremap_nocache(&ofdev->dev, io_res.start,
 					    io_res.end - io_res.start + 1);
 	if (!fun->io_base) {

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH v4 2/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays

Quoted 9 lines · Wolfgang Grandegger

The NAND flash on the TQM8548_BE modules requires a short delay after running the UPM pattern. The TQM8548_BE requires a further short delay after writing out a buffer. Normally the R/B pin should be checked, but it's not connected on the TQM8548_BE. The existing driver uses similar fixed delay points. To manage these extra delays in a more general way, I introduced the "fsl,ump-wait-flags" property allowing the board- specific driver to specify various types of extra delay.

#6 lore raw

PATCH v4 3/4 powerpc: NAND: FSL UPM: document new bindings

In reply to Wolfgang Grandegger

This patch adds documentation for the new NAND FSL UPM bindings for:

NAND: FSL-UPM: add multi chip support
NAND: FSL-UPM: Add wait flags to support board/chip specific delays

It also documents the old binding for "chip-delay".

---
 Documentation/powerpc/dts-bindings/fsl/upm-nand.txt |   39 ++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)
Documentation/powerpc/dts-bindings/fsl/upm-nand.txt +37 -2
Index: linux-2.6/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt
===================================================================
@@ -5,9 +5,21 @@
 - 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.
-- gpios : may specify optional GPIO connected to the Ready-Not-Busy pin.
 
-Example:
+Optional properties:
+- fsl,upm-wait-flags : add chip-dependent short delays after running the
+	UPM pattern (0x1), after writing a data byte (0x2) or after
+	writing out a buffer (0x4).
+- fsl,upm-addr-line-cs-offsets : address offsets for multi-chip support.
+	The corresponding address lines are used to select the chip.
+- gpios : may specify optional GPIOs connected to the Ready-Not-Busy pins
+	(R/B#). For multi-chip devices, "n" GPIO definitions are required
+	according to the number of chips.
+- chip-delay : chip dependent delay for transfering data from array to
+	read registers (tR). Required if property "gpios" is not used
+	(R/B# pins not connected).
+
+Examples:
 
 upm@1,0 {
 	compatible = "fsl,upm-nand";
@@ -26,3 +38,26 @@
 		};
 	};
 };
+
+upm@3,0 {
+	#address-cells = <0>;
+	#size-cells = <0>;
+	compatible = "tqc,tqm8548-upm-nand", "fsl,upm-nand";
+	reg = <3 0x0 0x800>;
+	fsl,upm-addr-offset = <0x10>;
+	fsl,upm-cmd-offset = <0x08>;
+	/* Multi-chip NAND device */
+	fsl,upm-addr-line-cs-offsets = <0x0 0x200>;
+	fsl,upm-wait-flags = <0x5>;
+	chip-delay = <25>; // in micro-seconds
+
+	nand@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			    label = "fs";
+			    reg = <0x00000000 0x10000000>;
+		};
+	};
+};

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

PATCH v4 4/4 powerpc/85xx: TQM8548: Update DTS file for multi-chip support

In reply to Wolfgang Grandegger

This patch adds multi-chip support for the Micron MT29F8G08FAB NAND flash memory on the TQM8548 modules.

---
 arch/powerpc/boot/dts/tqm8548-bigflash.dts |    7 +++++--
 arch/powerpc/boot/dts/tqm8548.dts          |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
arch/powerpc/boot/dts/tqm8548-bigflash.dts +5 -2
Index: linux-2.6/arch/powerpc/boot/dts/tqm8548-bigflash.dts
===================================================================
@@ -380,10 +380,13 @@
 		upm@3,0 {
 			#address-cells = <0>;
 			#size-cells = <0>;
-			compatible = "fsl,upm-nand";
+			compatible = "tqc,tqm8548-upm-nand", "fsl,upm-nand";
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			/* Micron MT29F8G08FAB multi-chip device */
+			fsl,upm-addr-line-cs-offsets = <0x0 0x200>;
+			fsl,upm-wait-flags = <0x5>;
 			chip-delay = <25>; // in micro-seconds
 
 			nand@0 {
@@ -392,7 +395,7 @@
 
 				partition@0 {
 					    label = "fs";
-					    reg = <0x00000000 0x01000000>;
+					    reg = <0x00000000 0x10000000>;
 				};
 			};
 		};
arch/powerpc/boot/dts/tqm8548.dts +5 -2
Index: linux-2.6/arch/powerpc/boot/dts/tqm8548.dts
===================================================================
@@ -380,10 +380,13 @@
 		upm@3,0 {
 			#address-cells = <0>;
 			#size-cells = <0>;
-			compatible = "fsl,upm-nand";
+			compatible = "tqc,tqm8548-upm-nand", "fsl,upm-nand";
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			/* Micron MT29F8G08FAB multi-chip device */
+			fsl,upm-addr-line-cs-offsets = <0x0 0x200>;
+			fsl,upm-wait-flags = <0x5>;
 			chip-delay = <25>; // in micro-seconds
 
 			nand@0 {
@@ -392,7 +395,7 @@
 
 				partition@0 {
 					    label = "fs";
-					    reg = <0x00000000 0x01000000>;
+					    reg = <0x00000000 0x10000000>;
 				};
 			};
 		};