* [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules
@ 2009-03-17 9:12 Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Wolfgang Grandegegr
2009-03-17 13:56 ` [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Kumar Gala
0 siblings, 2 replies; 14+ messages in thread
From: Wolfgang Grandegegr @ 2009-03-17 9:12 UTC (permalink / raw)
To: linux-mtd; +Cc: linuxppc-dev
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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/4] NAND: FSL-UPM: add multi chip support
2009-03-17 9:12 [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Wolfgang Grandegegr
@ 2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR Wolfgang Grandegegr
2009-03-17 19:27 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Anton Vorontsov
2009-03-17 13:56 ` [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Kumar Gala
1 sibling, 2 replies; 14+ messages in thread
From: Wolfgang Grandegegr @ 2009-03-17 9:12 UTC (permalink / raw)
To: linux-mtd; +Cc: linuxppc-dev
From: Wolfgang Grandegger <wg@grandegger.com>
This patch adds support for multi-chip NAND devices to the FSL-UPM
driver. This requires support for multiple GPIOs for the RNB pins.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/mtd/nand/fsl_upm.c | 90 +++++++++++++++++++++++++++++++++----------
1 files changed, 69 insertions(+), 21 deletions(-)
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index 7815a40..ca7e85a 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -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);
--
1.6.0.6
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR
2009-03-17 9:12 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Wolfgang Grandegegr
@ 2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Wolfgang Grandegegr
2009-03-17 19:27 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Anton Vorontsov
1 sibling, 1 reply; 14+ messages in thread
From: Wolfgang Grandegegr @ 2009-03-17 9:12 UTC (permalink / raw)
To: linux-mtd; +Cc: linuxppc-dev
From: Wolfgang Grandegger <wg@grandegger.com>
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.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
arch/powerpc/sysdev/fsl_lbc.c | 2 +-
drivers/mtd/nand/fsl_upm.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index 0494ee5..dceb8d1 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -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:
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index ca7e85a..f42955c 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -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;
--
1.6.0.6
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays
2009-03-17 9:12 ` [PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR Wolfgang Grandegegr
@ 2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegegr
2009-03-17 19:01 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Anton Vorontsov
0 siblings, 2 replies; 14+ messages in thread
From: Wolfgang Grandegegr @ 2009-03-17 9:12 UTC (permalink / raw)
To: linux-mtd; +Cc: linuxppc-dev
From: Wolfgang Grandegger <wg@grandegger.com>
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.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/mtd/nand/fsl_upm.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index f42955c..0ffc872 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -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) {
--
1.6.0.6
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support
2009-03-17 9:12 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Wolfgang Grandegegr
@ 2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 9:12 ` Wolfgang Grandegegr
` (2 more replies)
2009-03-17 19:01 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Anton Vorontsov
1 sibling, 3 replies; 14+ messages in thread
From: Wolfgang Grandegegr @ 2009-03-17 9:12 UTC (permalink / raw)
To: linux-mtd; +Cc: linuxppc-dev
From: Wolfgang Grandegger <wg@grandegger.com>
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.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
arch/powerpc/boot/dts/tqm8548.dts | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
index 81d3fbb..e5c3c67 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -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 {
--
1.6.0.6
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support
2009-03-17 9:12 ` [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegegr
@ 2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 19:23 ` Anton Vorontsov
2009-03-18 18:51 ` Scott Wood
2 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Grandegegr @ 2009-03-17 9:12 UTC (permalink / raw)
To: linux-mtd; +Cc: linuxppc-dev
From: Wolfgang Grandegger <wg@grandegger.com>
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.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
arch/powerpc/boot/dts/tqm8548.dts | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
index 81d3fbb..e5c3c67 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -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 {
--
1.6.0.6
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules
2009-03-17 9:12 [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Wolfgang Grandegegr
@ 2009-03-17 13:56 ` Kumar Gala
1 sibling, 0 replies; 14+ messages in thread
From: Kumar Gala @ 2009-03-17 13:56 UTC (permalink / raw)
To: Wolfgang Grandegegr; +Cc: linuxppc-dev, linux-mtd
On Mar 17, 2009, at 4:12 AM, Wolfgang Grandegegr wrote:
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays
2009-03-17 9:12 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegegr
@ 2009-03-17 19:01 ` Anton Vorontsov
1 sibling, 0 replies; 14+ messages in thread
From: Anton Vorontsov @ 2009-03-17 19:01 UTC (permalink / raw)
To: Wolfgang Grandegegr; +Cc: linuxppc-dev, linux-mtd
On Tue, Mar 17, 2009 at 10:12:21AM +0100, Wolfgang Grandegegr wrote:
> From: Wolfgang Grandegger <wg@grandegger.com>
>
> 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.
>
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
> ---
Just a nitpick...
> + 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,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support
2009-03-17 9:12 ` [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegegr
2009-03-17 9:12 ` Wolfgang Grandegegr
@ 2009-03-17 19:23 ` Anton Vorontsov
2009-03-18 7:34 ` Wolfgang Grandegger
2009-03-18 18:51 ` Scott Wood
2 siblings, 1 reply; 14+ messages in thread
From: Anton Vorontsov @ 2009-03-17 19:23 UTC (permalink / raw)
To: Wolfgang Grandegegr; +Cc: linuxppc-dev, linux-mtd
On Tue, Mar 17, 2009 at 10:12:22AM +0100, Wolfgang Grandegegr wrote:
> From: Wolfgang Grandegger <wg@grandegger.com>
>
> 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.
>
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
> ---
> arch/powerpc/boot/dts/tqm8548.dts | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
> index 81d3fbb..e5c3c67 100644
> --- a/arch/powerpc/boot/dts/tqm8548.dts
> +++ b/arch/powerpc/boot/dts/tqm8548.dts
> @@ -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 ;-).
> + /* Multi-chip device */
> + fsl,upm-mar-chip-offset = <0x200>;
> + max-chips = <2>;
num-chips would be more appropriate, no?
> + chip-offset = <0x200>;
I believe this is from some old code...
Thanks!
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] NAND: FSL-UPM: add multi chip support
2009-03-17 9:12 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR Wolfgang Grandegegr
@ 2009-03-17 19:27 ` Anton Vorontsov
2009-03-18 7:41 ` Wolfgang Grandegger
1 sibling, 1 reply; 14+ messages in thread
From: Anton Vorontsov @ 2009-03-17 19:27 UTC (permalink / raw)
To: Wolfgang Grandegegr; +Cc: linuxppc-dev, linux-mtd
On Tue, Mar 17, 2009 at 10:12:19AM +0100, Wolfgang Grandegegr wrote:
> From: Wolfgang Grandegger <wg@grandegger.com>
>
> This patch adds support for multi-chip NAND devices to the FSL-UPM
> driver. This requires support for multiple GPIOs for the RNB pins.
>
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
> ---
> drivers/mtd/nand/fsl_upm.c | 90 +++++++++++++++++++++++++++++++++----------
> 1 files changed, 69 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
> index 7815a40..ca7e85a 100644
> --- a/drivers/mtd/nand/fsl_upm.c
> +++ b/drivers/mtd/nand/fsl_upm.c
> @@ -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,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support
2009-03-17 19:23 ` Anton Vorontsov
@ 2009-03-18 7:34 ` Wolfgang Grandegger
0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Grandegger @ 2009-03-18 7:34 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev, linux-mtd
Anton Vorontsov wrote:
> On Tue, Mar 17, 2009 at 10:12:22AM +0100, Wolfgang Grandegegr wrote:
>> From: Wolfgang Grandegger <wg@grandegger.com>
>>
>> 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.
>>
>> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
>> ---
>> arch/powerpc/boot/dts/tqm8548.dts | 5 +++++
>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
>> index 81d3fbb..e5c3c67 100644
>> --- a/arch/powerpc/boot/dts/tqm8548.dts
>> +++ b/arch/powerpc/boot/dts/tqm8548.dts
>> @@ -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.
>> + /* Multi-chip device */
>> + fsl,upm-mar-chip-offset = <0x200>;
>> + max-chips = <2>;
>
> num-chips would be more appropriate, no?
Yep.
>
>> + 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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] NAND: FSL-UPM: add multi chip support
2009-03-17 19:27 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Anton Vorontsov
@ 2009-03-18 7:41 ` Wolfgang Grandegger
2009-03-18 13:02 ` Anton Vorontsov
0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Grandegger @ 2009-03-18 7:41 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev, linux-mtd
Anton Vorontsov wrote:
> On Tue, Mar 17, 2009 at 10:12:19AM +0100, Wolfgang Grandegegr wrote:
>> From: Wolfgang Grandegger <wg@grandegger.com>
>>
>> This patch adds support for multi-chip NAND devices to the FSL-UPM
>> driver. This requires support for multiple GPIOs for the RNB pins.
>>
>> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
>> ---
>> drivers/mtd/nand/fsl_upm.c | 90 +++++++++++++++++++++++++++++++++----------
>> 1 files changed, 69 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
>> index 7815a40..ca7e85a 100644
>> --- a/drivers/mtd/nand/fsl_upm.c
>> +++ b/drivers/mtd/nand/fsl_upm.c
>> @@ -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?
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
> Otherwise we'd better allocate the rnb_gpios dynamically, depending
> on the num-chips property.
Could be done.
Wolfgang.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] NAND: FSL-UPM: add multi chip support
2009-03-18 7:41 ` Wolfgang Grandegger
@ 2009-03-18 13:02 ` Anton Vorontsov
0 siblings, 0 replies; 14+ messages in thread
From: Anton Vorontsov @ 2009-03-18 13:02 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: linuxppc-dev, linux-mtd
On Wed, Mar 18, 2009 at 08:41:17AM +0100, Wolfgang Grandegger wrote:
> Anton Vorontsov wrote:
> > On Tue, Mar 17, 2009 at 10:12:19AM +0100, Wolfgang Grandegegr wrote:
> >> From: Wolfgang Grandegger <wg@grandegger.com>
> >>
> >> This patch adds support for multi-chip NAND devices to the FSL-UPM
> >> driver. This requires support for multiple GPIOs for the RNB pins.
> >>
> >> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
> >> ---
> >> drivers/mtd/nand/fsl_upm.c | 90 +++++++++++++++++++++++++++++++++----------
> >> 1 files changed, 69 insertions(+), 21 deletions(-)
> >>
> >> diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
> >> index 7815a40..ca7e85a 100644
> >> --- a/drivers/mtd/nand/fsl_upm.c
> >> +++ b/drivers/mtd/nand/fsl_upm.c
> >> @@ -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?
>
> 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,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support
2009-03-17 9:12 ` [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegegr
2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 19:23 ` Anton Vorontsov
@ 2009-03-18 18:51 ` Scott Wood
2 siblings, 0 replies; 14+ messages in thread
From: Scott Wood @ 2009-03-18 18:51 UTC (permalink / raw)
To: Wolfgang Grandegegr; +Cc: linuxppc-dev, linux-mtd
On Tue, Mar 17, 2009 at 10:12:22AM +0100, Wolfgang Grandegegr wrote:
> --- a/arch/powerpc/boot/dts/tqm8548.dts
> +++ b/arch/powerpc/boot/dts/tqm8548.dts
> @@ -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
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2009-03-18 18:52 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-17 9:12 [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Wolfgang Grandegegr
2009-03-17 9:12 ` [PATCH 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegegr
2009-03-17 9:12 ` Wolfgang Grandegegr
2009-03-17 19:23 ` Anton Vorontsov
2009-03-18 7:34 ` Wolfgang Grandegger
2009-03-18 18:51 ` Scott Wood
2009-03-17 19:01 ` [PATCH 3/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Anton Vorontsov
2009-03-17 19:27 ` [PATCH 1/4] NAND: FSL-UPM: add multi chip support Anton Vorontsov
2009-03-18 7:41 ` Wolfgang Grandegger
2009-03-18 13:02 ` Anton Vorontsov
2009-03-17 13:56 ` [PATCH 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).