From: Wolfgang Grandegegr <wg@grandegger.com>
To: linux-mtd@lists.infradead.org
Cc: linuxppc-dev@ozlabs.org,
Anton Vorontsov <avorontsov@ru.mvista.com>,
Wolfgang Grandegger <wg@grandegger.com>
Subject: [PATCH 2/4] NAND: FSL-UPM: add support for selecting chips via MAR
Date: Tue, 17 Mar 2009 10:12:20 +0100 [thread overview]
Message-ID: <1237281143-8768-3-git-send-email-wg@grandegger.com> (raw)
In-Reply-To: <1237281143-8768-2-git-send-email-wg@grandegger.com>
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
next prev parent reply other threads:[~2009-03-17 9:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Wolfgang Grandegegr [this message]
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
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=1237281143-8768-3-git-send-email-wg@grandegger.com \
--to=wg@grandegger.com \
--cc=avorontsov@ru.mvista.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