Commit 13f53697 authored by Wolfgang Grandegger's avatar Wolfgang Grandegger Committed by David Woodhouse

[MTD] [NAND] driver extension to support NAND on TQM85xx modules

This patch extends the FSL UPM NAND driver from Anton Vorontsov to
support hardware which does not have the R/B pin of the NAND chip
connected, like the TQM8548 module:

- The OF_GPIO dependency has been removed from the Kconfig option
  because GPIO is not needed. The relevant gpio_* function are then
  stubbed out in <linux/gpio.h>.

- It re-introduces the chip-delay property to define an appropriate
  maximum delay time (tR) required for read operations. The binding
  will be documented in a separate patch.
Signed-off-by: default avatarWolfgang Grandegger <wg@grandegger.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 95ebffd7
...@@ -401,7 +401,7 @@ config MTD_NAND_FSL_ELBC ...@@ -401,7 +401,7 @@ config MTD_NAND_FSL_ELBC
config MTD_NAND_FSL_UPM config MTD_NAND_FSL_UPM
tristate "Support for NAND on Freescale 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 select FSL_LBC
help help
Enables support for NAND Flash chips wired onto Freescale PowerPC Enables support for NAND Flash chips wired onto Freescale PowerPC
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h> #include <linux/mtd/nand_ecc.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -36,6 +37,7 @@ struct fsl_upm_nand { ...@@ -36,6 +37,7 @@ struct fsl_upm_nand {
uint8_t upm_cmd_offset; uint8_t upm_cmd_offset;
void __iomem *io_base; void __iomem *io_base;
int rnb_gpio; int rnb_gpio;
int chip_delay;
}; };
#define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd) #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_nand *fun) ...@@ -58,10 +60,11 @@ static void fun_wait_rnb(struct fsl_upm_nand *fun)
if (fun->rnb_gpio >= 0) { if (fun->rnb_gpio >= 0) {
while (--cnt && !fun_chip_ready(&fun->mtd)) while (--cnt && !fun_chip_ready(&fun->mtd))
cpu_relax(); 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) static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
...@@ -129,7 +132,7 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun, ...@@ -129,7 +132,7 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun,
fun->chip.IO_ADDR_R = fun->io_base; fun->chip.IO_ADDR_R = fun->io_base;
fun->chip.IO_ADDR_W = fun->io_base; fun->chip.IO_ADDR_W = fun->io_base;
fun->chip.cmd_ctrl = fun_cmd_ctrl; 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_byte = fun_read_byte;
fun->chip.read_buf = fun_read_buf; fun->chip.read_buf = fun_read_buf;
fun->chip.write_buf = fun_write_buf; fun->chip.write_buf = fun_write_buf;
...@@ -228,6 +231,12 @@ static int __devinit fun_probe(struct of_device *ofdev, ...@@ -228,6 +231,12 @@ static int __devinit fun_probe(struct of_device *ofdev,
goto err2; 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, fun->io_base = devm_ioremap_nocache(&ofdev->dev, io_res.start,
io_res.end - io_res.start + 1); io_res.end - io_res.start + 1);
if (!fun->io_base) { if (!fun->io_base) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment