From: Scott Wood <scottwood@freescale.com>
To: dwmw2@infradead.org
Cc: linuxppc-dev@ozlabs.org, linux-mtd@lists.infradead.org
Subject: [PATCH 2/4] nand base: Give drivers a chance to do late initialization.
Date: Thu, 13 Dec 2007 11:15:51 -0600 [thread overview]
Message-ID: <20071213171551.GA4459@loki.buserror.net> (raw)
In-Reply-To: <20071213171528.GA4440@loki.buserror.net>
Some nand controllers, such as the Freescale enhanced local bus controller,
need to do late initialization based on details of the chip that has been
probed, such as chip size, large/small pages, etc. A late_init() callback
method is added to allow this.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
drivers/mtd/nand/nand_base.c | 12 ++++++++++++
include/linux/mtd/nand.h | 2 ++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 85a7283..119a6f7 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2593,6 +2593,18 @@ int nand_scan_tail(struct mtd_info *mtd)
/* propagate ecc.layout to mtd_info */
mtd->ecclayout = chip->ecc.layout;
+ /* Give the driver a chance to do any remaining setup
+ * based on the chip details.
+ */
+ if (chip->late_init) {
+ int ret = chip->late_init(mtd);
+
+ if (ret) {
+ kfree(chip->buffers);
+ return ret;
+ }
+ }
+
/* Check, if we should skip the bad block table scan */
if (chip->options & NAND_SKIP_BBTSCAN)
return 0;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c42bc7f..27bc879 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -360,6 +360,7 @@ struct nand_buffers {
* @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
* (determine if errors are correctable)
* @write_page: [REPLACEABLE] High-level page write function
+ * @late_init: [OPTIONAL] initialization callback after identification
*/
struct nand_chip {
@@ -384,6 +385,7 @@ struct nand_chip {
int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf, int page, int cached, int raw);
+ int (*late_init)(struct mtd_info *mtd);
int chip_delay;
unsigned int options;
--
1.5.3.7
next prev parent reply other threads:[~2007-12-13 17:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 17:15 [PATCH 1/4] nand base: Don't panic if a controller driver does ecc its own way Scott Wood
2007-12-13 17:15 ` Scott Wood [this message]
2008-01-08 7:57 ` [PATCH 2/4] nand base: Give drivers a chance to do late initialization David Woodhouse
2008-01-08 17:48 ` Scott Wood
2007-12-13 17:15 ` [PATCH 3/4] mtd: Factor out OF partition support from the NOR driver Scott Wood
2008-01-08 7:45 ` Stefan Roese
2008-01-08 8:10 ` David Woodhouse
2007-12-13 17:15 ` [PATCH 4/4] MPC8313 enhanced Local Bus Controller NAND support Scott Wood
2007-12-14 5:14 ` 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=20071213171551.GA4459@loki.buserror.net \
--to=scottwood@freescale.com \
--cc=dwmw2@infradead.org \
--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).