From: Wolfgang Grandegger <wg@grandegger.com>
To: linux-mtd@lists.infradead.org, linuxppc-dev@ozlabs.org
Subject: [PATCH v3 2/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays
Date: Wed, 25 Mar 2009 11:08:19 +0100 [thread overview]
Message-ID: <1237975701-23201-3-git-send-email-wg@grandegger.com> (raw)
In-Reply-To: <1237975701-23201-2-git-send-email-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" property 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 9b314ce..3ecfc1e 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/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 @@ struct fsl_upm_nand {
uint32_t num_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)
@@ -97,7 +102,8 @@ static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
mar |= fun->chip_number * fun->chip_offset;
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)
@@ -139,8 +145,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,
@@ -285,6 +294,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, "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) {
--
1.6.0.6
next prev parent reply other threads:[~2009-03-25 10:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 10:08 [PATCH v3 0/4] NAND: Multi-chip support for FSL-UPM for TQM8548 modules Wolfgang Grandegger
2009-03-25 10:08 ` [PATCH v3 1/4] NAND: FSL-UPM: add multi chip support Wolfgang Grandegger
2009-03-25 10:08 ` Wolfgang Grandegger [this message]
2009-03-25 10:08 ` [PATCH v3 3/4] powerpc: NAND: FSL UPM: document new bindings Wolfgang Grandegger
2009-03-25 10:08 ` [PATCH v3 4/4] powerpc/85xx: TQM8548: Update DTS file for multi-chip support Wolfgang Grandegger
2009-03-25 15:11 ` [PATCH v3 3/4] powerpc: NAND: FSL UPM: document new bindings Anton Vorontsov
2009-03-25 17:48 ` Grant Likely
2009-03-25 20:48 ` Wolfgang Grandegger
2009-03-26 5:09 ` Grant Likely
2009-03-26 7:42 ` Wolfgang Grandegger
2009-03-26 14:27 ` Grant Likely
2009-03-26 15:33 ` Wolfgang Grandegger
2009-03-26 16:04 ` Grant Likely
2009-03-26 16:35 ` Wolfgang Grandegger
2009-03-26 17:02 ` Grant Likely
2009-03-26 17:33 ` Anton Vorontsov
2009-03-26 22:14 ` Wolfgang Grandegger
2009-03-26 23:22 ` Grant Likely
2009-03-26 23:32 ` Anton Vorontsov
2009-03-27 8:07 ` Wolfgang Grandegger
2009-03-25 15:01 ` [PATCH v3 2/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays Anton Vorontsov
2009-03-25 10:43 ` [PATCH v3 1/4] NAND: FSL-UPM: add multi chip support Singh, Vimal
2009-03-25 10:57 ` Wolfgang Grandegger
2009-03-25 13:31 ` Grant Likely
2009-03-25 13:32 ` Grant Likely
2009-03-25 13:43 ` Wolfgang Grandegger
2009-03-25 17:26 ` Grant Likely
2009-03-25 14:57 ` Anton Vorontsov
2009-03-25 15:25 ` Wolfgang Grandegger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237975701-23201-3-git-send-email-wg@grandegger.com \
--to=wg@grandegger.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).