Skip to contentSkip to conversation

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

PATCH Superseded Wolfgang Grandegegr 4 participants 14 messages Mar 17, 2009 – Mar 18, 2009

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

The following patch series adds 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:

[PATCH 1/4] NAND: FSL-UPM: add multi chip support
[PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support

Wolfgang.

#1 lore raw

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

From: Wolfgang Grandegger <[email protected]>

This patch adds support for multi-chip NAND devices to the FSL-UPM driver. This requires support for multiple GPIOs for the RNB pins.

---
 drivers/mtd/nand/fsl_upm.c |   90 +++++++++++++++++++++++++++++++++----------
 1 files changed, 69 insertions(+), 21 deletions(-)
drivers/mtd/nand/fsl_upm.c +69 -21
index 7815a40..ca7e85a 100644
@@ -23,6 +23,8 @@
 #include <linux/io.h>
 #include <asm/fsl_lbc.h>
 
+#define FSL_UPM_NAND_MAX_CHIPS 4
+
 struct fsl_upm_nand {
 	struct device *dev;
 	struct mtd_info mtd;
@@ -36,8 +38,11 @@ struct fsl_upm_nand {
 	uint8_t upm_addr_offset;
 	uint8_t upm_cmd_offset;
 	void __iomem *io_base;
-	int rnb_gpio;
+	int rnb_gpio[FSL_UPM_NAND_MAX_CHIPS];
 	int chip_delay;
+	uint32_t max_chips;
+	uint32_t chip_number;
+	uint32_t chip_offset;
 };
 
 #define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd)
@@ -46,7 +51,7 @@ static int fun_chip_ready(struct mtd_info *mtd)
 {
 	struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
 
-	if (gpio_get_value(fun->rnb_gpio))
+	if (gpio_get_value(fun->rnb_gpio[fun->chip_number]))
 		return 1;
 
 	dev_vdbg(fun->dev, "busy\n");
@@ -55,9 +60,9 @@ static int fun_chip_ready(struct mtd_info *mtd)
 
 static void fun_wait_rnb(struct fsl_upm_nand *fun)
 {
-	int cnt = 1000000;
 
-	if (fun->rnb_gpio >= 0) {
+	if (fun->rnb_gpio[fun->chip_number] >= 0) {
+		int cnt = 1000000;
 		while (--cnt && !fun_chip_ready(&fun->mtd))
 			cpu_relax();
 		if (!cnt)
@@ -92,6 +97,22 @@ static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 	fun_wait_rnb(fun);
 }
 
+static void fun_select_chip(struct mtd_info *mtd, int chip_nr)
+{
+	struct nand_chip *chip = mtd->priv;
+	struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
+
+	if (chip_nr == -1) {
+		chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE);
+	} else if (chip_nr >= 0) {
+		fun->chip_number = chip_nr;
+		chip->IO_ADDR_R = chip->IO_ADDR_W =
+			fun->io_base + chip_nr * fun->chip_offset;
+	} else {
+		BUG();
+	}
+}
+
 static uint8_t fun_read_byte(struct mtd_info *mtd)
 {
 	struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
@@ -137,8 +158,10 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun,
 	fun->chip.read_buf = fun_read_buf;
 	fun->chip.write_buf = fun_write_buf;
 	fun->chip.ecc.mode = NAND_ECC_SOFT;
+	if (fun->max_chips > 1)
+		fun->chip.select_chip = fun_select_chip;
 
-	if (fun->rnb_gpio >= 0)
+	if (fun->rnb_gpio[0] >= 0)
 		fun->chip.dev_ready = fun_chip_ready;
 
 	fun->mtd.priv = &fun->chip;
@@ -155,7 +178,7 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun,
 		goto err;
 	}
 
-	ret = nand_scan(&fun->mtd, 1);
+	ret = nand_scan(&fun->mtd, fun->max_chips);
 	if (ret)
 		goto err;
 
@@ -187,6 +210,7 @@ static int __devinit fun_probe(struct of_device *ofdev,
 	const uint32_t *prop;
 	int ret;
 	int size;
+	int i;
 
 	fun = kzalloc(sizeof(*fun), GFP_KERNEL);
 	if (!fun)
@@ -208,7 +232,7 @@ static int __devinit fun_probe(struct of_device *ofdev,
 	if (!prop || size != sizeof(uint32_t)) {
 		dev_err(&ofdev->dev, "can't get UPM address offset\n");
 		ret = -EINVAL;
-		goto err2;
+		goto err1;
 	}
 	fun->upm_addr_offset = *prop;
 
@@ -216,21 +240,36 @@ static int __devinit fun_probe(struct of_device *ofdev,
 	if (!prop || size != sizeof(uint32_t)) {
 		dev_err(&ofdev->dev, "can't get UPM command offset\n");
 		ret = -EINVAL;
-		goto err2;
+		goto err1;
 	}
 	fun->upm_cmd_offset = *prop;
 
-	fun->rnb_gpio = of_get_gpio(ofdev->node, 0);
-	if (fun->rnb_gpio >= 0) {
-		ret = gpio_request(fun->rnb_gpio, dev_name(&ofdev->dev));
-		if (ret) {
-			dev_err(&ofdev->dev, "can't request RNB gpio\n");
+	prop = of_get_property(ofdev->node, "max-chips", &size);
+	if (prop && size == sizeof(uint32_t)) {
+		fun->max_chips = *prop;
+		if (fun->max_chips >= FSL_UPM_NAND_MAX_CHIPS) {
+			dev_err(&ofdev->dev, "too much chips");
+			ret = -EINVAL;
+			goto err1;
+		}
+	} else {
+		fun->max_chips = 1;
+	}
+
+	for (i = 0; i < fun->max_chips; i++) {
+		fun->rnb_gpio[i] = of_get_gpio(ofdev->node, i);
+		if (fun->rnb_gpio[i] >= 0) {
+			ret = gpio_request(fun->rnb_gpio[i], 
+					   dev_name(&ofdev->dev));
+			if (ret) {
+				dev_err(&ofdev->dev, "can't request RNB gpio\n");
+				goto err2;
+			}
+			gpio_direction_input(fun->rnb_gpio[i]);
+		} else if (fun->rnb_gpio[i]  == -EINVAL) {
+			dev_err(&ofdev->dev, "specified RNB gpio is invalid\n");
 			goto err2;
 		}
-		gpio_direction_input(fun->rnb_gpio);
-	} else if (fun->rnb_gpio == -EINVAL) {
-		dev_err(&ofdev->dev, "specified RNB gpio is invalid\n");
-		goto err2;
 	}
 
 	prop = of_get_property(ofdev->node, "chip-delay", NULL);
@@ -239,6 +278,10 @@ static int __devinit fun_probe(struct of_device *ofdev,
 	else
 		fun->chip_delay = 50;
 
+	prop = of_get_property(ofdev->node, "chip-offset", &size);
+	if (prop && size == sizeof(uint32_t))
+		fun->chip_offset = *prop;
+
 	fun->io_base = devm_ioremap_nocache(&ofdev->dev, io_res.start,
 					  io_res.end - io_res.start + 1);
 	if (!fun->io_base) {
@@ -257,8 +300,10 @@ static int __devinit fun_probe(struct of_device *ofdev,
 
 	return 0;
 err2:
-	if (fun->rnb_gpio >= 0)
-		gpio_free(fun->rnb_gpio);
+	for (i = 0; i < fun->max_chips; i++) {
+		if (fun->rnb_gpio[i] >= 0)
+			gpio_free(fun->rnb_gpio[i]);
+	}
 err1:
 	kfree(fun);
 
@@ -268,12 +313,15 @@ err1:
 static int __devexit fun_remove(struct of_device *ofdev)
 {
 	struct fsl_upm_nand *fun = dev_get_drvdata(&ofdev->dev);
+	int i;
 
 	nand_release(&fun->mtd);
 	kfree(fun->mtd.name);
 
-	if (fun->rnb_gpio >= 0)
-		gpio_free(fun->rnb_gpio);
+        for (i = 0; i < fun->max_chips; i++) {
+                if (fun->rnb_gpio[i] >= 0)
+                        gpio_free(fun->rnb_gpio[i]);
+        }
 
 	kfree(fun);
 
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 2/4 NAND: FSL-UPM: add support for selecting chips via MAR

From: Wolfgang Grandegger <[email protected]>

For the NAND chips on the TQM8548 modules, a special chip-select logic is used. It uses dedicated address lines to be set via UPM machine address register (mar). This patch also adds that support to the FSL-UPM driver.

---
 arch/powerpc/sysdev/fsl_lbc.c |    2 +-
 drivers/mtd/nand/fsl_upm.c    |   13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/fsl_lbc.c +1 -1
index 0494ee5..dceb8d1 100644
@@ -150,7 +150,7 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
 
 	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 +12 -1
index ca7e85a..f42955c 100644
@@ -37,6 +37,7 @@ struct fsl_upm_nand {
 	struct fsl_upm upm;
 	uint8_t upm_addr_offset;
 	uint8_t upm_cmd_offset;
+	uint32_t upm_mar_chip_offset;
 	void __iomem *io_base;
 	int rnb_gpio[FSL_UPM_NAND_MAX_CHIPS];
 	int chip_delay;
@@ -74,7 +75,9 @@ static void fun_wait_rnb(struct fsl_upm_nand *fun)
 
 static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
+	struct nand_chip *chip = mtd->priv;
 	struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
+	u32 mar;
 
 	if (!(ctrl & fun->last_ctrl)) {
 		fsl_upm_end_pattern(&fun->upm);
@@ -92,7 +95,11 @@ static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 			fsl_upm_start_pattern(&fun->upm, fun->upm_cmd_offset);
 	}
 
-	fsl_upm_run_pattern(&fun->upm, fun->io_base, cmd);
+	mar = cmd << (32 - fun->upm.width);
+	if (fun->upm_mar_chip_offset && fun->chip_number > 0) {
+		mar |= fun->chip_number * fun->upm_mar_chip_offset;
+	}
+	fsl_upm_run_pattern(&fun->upm, chip->IO_ADDR_R, mar);
 
 	fun_wait_rnb(fun);
 }
@@ -244,6 +251,10 @@ static int __devinit fun_probe(struct of_device *ofdev,
 	}
 	fun->upm_cmd_offset = *prop;
 
+	prop = of_get_property(ofdev->node, "fsl,upm-mar-chip-offset", &size);
+	if (prop && size == sizeof(uint32_t))
+		fun->upm_mar_chip_offset = *prop;
+
 	prop = of_get_property(ofdev->node, "max-chips", &size);
 	if (prop && size == sizeof(uint32_t)) {
 		fun->max_chips = *prop;
Signature · 1 line
1.6.0.6
#3 lore raw

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

From: Wolfgang Grandegger <[email protected]>

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 "wait_flags" field allowing the board-specific driver to specify various types of extra delay.

---
 drivers/mtd/nand/fsl_upm.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsl_upm.c +18 -2
index f42955c..0ffc872 100644
@@ -25,6 +25,10 @@
 
 #define FSL_UPM_NAND_MAX_CHIPS 4
 
+#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;
@@ -44,6 +48,7 @@ struct fsl_upm_nand {
 	uint32_t max_chips;
 	uint32_t chip_number;
 	uint32_t chip_offset;
+	uint32_t wait_flags;
 };
 
 #define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd)
@@ -101,7 +106,8 @@ static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 	}
 	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 chip_nr)
@@ -143,8 +149,11 @@ static void fun_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 
 	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,
@@ -293,6 +302,13 @@ static int __devinit fun_probe(struct of_device *ofdev,
 	if (prop && size == sizeof(uint32_t))
 		fun->chip_offset = *prop;
 
+	prop = of_get_property(ofdev->node, "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) {
Signature · 1 line
1.6.0.6
#4 lore raw

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

From: Wolfgang Grandegger <[email protected]>

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

This patch should go through the powerpc/85xx channel.

---
 arch/powerpc/boot/dts/tqm8548.dts |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/tqm8548.dts +5 -0
index 81d3fbb..e5c3c67 100644
@@ -389,6 +389,11 @@
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			wait-flags = <0x05>;
+			/* Multi-chip device */
+			fsl,upm-mar-chip-offset = <0x200>;
+			max-chips = <2>;
+			chip-offset = <0x200>;
 			chip-delay = <25>; // in micro-seconds
 
 			nand@0 {
Signature · 1 line
1.6.0.6
#5 lore raw

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

From: Wolfgang Grandegger <[email protected]>

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

It should go through the powerpc/85xx maintainer.

---
 arch/powerpc/boot/dts/tqm8548.dts |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/tqm8548.dts +5 -0
index 81d3fbb..e5c3c67 100644
@@ -389,6 +389,11 @@
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			wait-flags = <0x05>;
+			/* Multi-chip device */
+			fsl,upm-mar-chip-offset = <0x200>;
+			max-chips = <2>;
+			chip-offset = <0x200>;
 			chip-delay = <25>; // in micro-seconds
 
 			nand@0 {
Signature · 1 line
1.6.0.6
#6 lore raw

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

In reply to Wolfgang Grandegegr
Quoted 17 lines · Wolfgang Grandegegr

From: Wolfgang Grandegger <[email protected]>

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

This patch should go through the powerpc/85xx channel.

---
 arch/powerpc/boot/dts/tqm8548.dts |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/tqm8548.dts +0 -0
index 81d3fbb..e5c3c67 100644

arch/powerpc/boot/dts/tqm8548.dts line 392

Quoted 4 lines
arch/powerpc/boot/dts/tqm8548.dts +1 -0
@@ -389,6 +389,11 @@
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			wait-flags = <0x05>;

Should be at least fsl,upm-wait-flags. (And the flags should be documented in dts-bindings ;-).

arch/powerpc/boot/dts/tqm8548.dts line 395

Quoted 3 lines
arch/powerpc/boot/dts/tqm8548.dts +3 -0
+			/* Multi-chip device */
+			fsl,upm-mar-chip-offset = <0x200>;
+			max-chips = <2>;

num-chips would be more appropriate, no?

arch/powerpc/boot/dts/tqm8548.dts line 396

Quoted 1 line
arch/powerpc/boot/dts/tqm8548.dts +1 -0
+			chip-offset = <0x200>;

I believe this is from some old code...

Thanks!

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#7 lore raw

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

Quoted 13 lines · Anton Vorontsov
Quoted 12 lines · Wolfgang Grandegegr

From: Wolfgang Grandegger <[email protected]>

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

This patch should go through the powerpc/85xx channel.

---
 arch/powerpc/boot/dts/tqm8548.dts |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Quoted 12 lines

arch/powerpc/boot/dts/tqm8548.dts line 392

Quoted 9 lines
arch/powerpc/boot/dts/tqm8548.dts +1 -0
index 81d3fbb..e5c3c67 100644
@@ -389,6 +389,11 @@
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			wait-flags = <0x05>;

Should be at least fsl,upm-wait-flags. (And the flags should be documented in dts-bindings ;-).

OK.

Quoted 5 lines

arch/powerpc/boot/dts/tqm8548.dts line 395

Quoted 3 lines
arch/powerpc/boot/dts/tqm8548.dts +3 -0
+			/* Multi-chip device */
+			fsl,upm-mar-chip-offset = <0x200>;
+			max-chips = <2>;

num-chips would be more appropriate, no?

Yep.

Quoted 4 lines

arch/powerpc/boot/dts/tqm8548.dts line 396

Quoted 2 lines
arch/powerpc/boot/dts/tqm8548.dts +1 -0
+			chip-offset = <0x200>;

I believe this is from some old code...

No, it's the address offset between the multiple chips. As Kumar already pointed out, I also need to document the new properties.

Wolfgang.

#8 lore raw

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

In reply to Wolfgang Grandegegr

arch/powerpc/boot/dts/tqm8548.dts line 396

Quoted 11 lines · Wolfgang Grandegegr
arch/powerpc/boot/dts/tqm8548.dts +5 -0
@@ -389,6 +389,11 @@
 			reg = <3 0x0 0x800>;
 			fsl,upm-addr-offset = <0x10>;
 			fsl,upm-cmd-offset = <0x08>;
+			wait-flags = <0x05>;
+			/* Multi-chip device */
+			fsl,upm-mar-chip-offset = <0x200>;
+			max-chips = <2>;
+			chip-offset = <0x200>;

Device-specific properties (especially vaguely-named ones like wait-flags) should have at least an "fsl," prefix (or better, an "fsl,upm-" or "fsl,upm-nand-" prefix).

Please update Documentation/powerpc/dts-bindings/fsl/upm-nand.txt with the definitions of these new properties.

-Scott

#9 lore raw

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

In reply to Wolfgang Grandegegr
Quoted 10 lines · Wolfgang Grandegegr

From: Wolfgang Grandegger <[email protected]>

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 "wait_flags" field allowing the board-specific driver to specify various types of extra delay.

Quoted 2 lines

---

Just a nitpick...

drivers/mtd/nand/fsl_upm.c static int __devinit fun_probe(struct of_device *ofdev, · line 310

Quoted 6 lines
drivers/mtd/nand/fsl_upm.c +6 -0
+	prop = of_get_property(ofdev->node, "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);

No need for parenthesis here.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#10 lore raw

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

In reply to Wolfgang Grandegegr
Quoted 15 lines · Wolfgang Grandegegr

From: Wolfgang Grandegger <[email protected]>

This patch adds support for multi-chip NAND devices to the FSL-UPM driver. This requires support for multiple GPIOs for the RNB pins.

---
 drivers/mtd/nand/fsl_upm.c |   90 +++++++++++++++++++++++++++++++++----------
 1 files changed, 69 insertions(+), 21 deletions(-)
drivers/mtd/nand/fsl_upm.c +0 -0
index 7815a40..ca7e85a 100644

drivers/mtd/nand/fsl_upm.c line 26

Quoted 4 lines
drivers/mtd/nand/fsl_upm.c +1 -0
@@ -23,6 +23,8 @@
 #include <linux/io.h>
 #include <asm/fsl_lbc.h>
 
+#define FSL_UPM_NAND_MAX_CHIPS 4

Is there any reason to hardcode max chips? Some obscure limit in the UPMs maybe?

Otherwise we'd better allocate the rnb_gpios dynamically, depending on the num-chips property.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#11 lore raw

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

Quoted 19 lines · Anton Vorontsov
Quoted 18 lines · Wolfgang Grandegegr

From: Wolfgang Grandegger <[email protected]>

This patch adds support for multi-chip NAND devices to the FSL-UPM driver. This requires support for multiple GPIOs for the RNB pins.

---
 drivers/mtd/nand/fsl_upm.c |   90 +++++++++++++++++++++++++++++++++----------
 1 files changed, 69 insertions(+), 21 deletions(-)
drivers/mtd/nand/fsl_upm.c +0 -0
index 7815a40..ca7e85a 100644
@@ -23,6 +23,8 @@
 #include <linux/io.h>
 #include <asm/fsl_lbc.h>
 
Quoted 4 lines

drivers/mtd/nand/fsl_upm.c line 26

Quoted 1 line
drivers/mtd/nand/fsl_upm.c +1 -0
+#define FSL_UPM_NAND_MAX_CHIPS 4

Is there any reason to hardcode max chips? Some obscure limit in the UPMs maybe?

Not really. It's limited by NAND_MAX_CHIP. See
http://lxr.linux.no/linux+v2.6.28.8/include/linux/mtd/nand.h#L40

Quoted 2 lines

Otherwise we'd better allocate the rnb_gpios dynamically, depending on the num-chips property.

Could be done.

Wolfgang.

#12 lore raw

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

Quoted 20 lines · Wolfgang Grandegger
Quoted 19 lines · Anton Vorontsov
Quoted 18 lines · Wolfgang Grandegegr

From: Wolfgang Grandegger <[email protected]>

This patch adds support for multi-chip NAND devices to the FSL-UPM driver. This requires support for multiple GPIOs for the RNB pins.

---
 drivers/mtd/nand/fsl_upm.c |   90 +++++++++++++++++++++++++++++++++----------
 1 files changed, 69 insertions(+), 21 deletions(-)
drivers/mtd/nand/fsl_upm.c +0 -0
index 7815a40..ca7e85a 100644
@@ -23,6 +23,8 @@
 #include <linux/io.h>
 #include <asm/fsl_lbc.h>
 
Quoted 7 lines
Quoted 4 lines

drivers/mtd/nand/fsl_upm.c line 26

Quoted 1 line
drivers/mtd/nand/fsl_upm.c +1 -0
+#define FSL_UPM_NAND_MAX_CHIPS 4

Is there any reason to hardcode max chips? Some obscure limit in the UPMs maybe?

Not really. It's limited by NAND_MAX_CHIP. See
http://lxr.linux.no/linux+v2.6.28.8/include/linux/mtd/nand.h#L40

OK, then you could just use that constant, since we'll only allocate the 8 ints.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#13 lore raw
In reply to Wolfgang Grandegegr
Quoted 10 lines · Wolfgang Grandegegr

The following patch series adds 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:

[PATCH 1/4] NAND: FSL-UPM: add multi chip support
[PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support

Wolfgang.

You need to update:

Documentation/powerpc/dts-bindings/fsl/upm-nand.txt

I see some new properties defined in this code and not documented ;)

- k