From: Jan Weitzel <j.weitzel@phytec.de>
To: barebox@lists.infradead.org
Subject: [RFC 3/3] mtd omap nand: reconfigure buswidth
Date: Wed, 18 Jul 2012 14:37:13 +0200 [thread overview]
Message-ID: <1342615033-3232-4-git-send-email-j.weitzel@phytec.de> (raw)
In-Reply-To: <1342615033-3232-1-git-send-email-j.weitzel@phytec.de>
If nand_scan_ident fail try to reconfigure buswidth from 8bit to 16bit or
the other way around.
There are still the ugly debug messages like:
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xb3 (Micron NAND 1GiB 1,8V 16-bit)
NAND bus width 8 instead 16 bit
No NAND device found (-22)!
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xb3 (Micron NAND 1GiB 1,8V 16-bit)
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
drivers/mtd/nand/nand_omap_gpmc.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index d55dcaa..b80ac14 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -803,6 +803,27 @@ static int omap_gpmc_eccmode_set(struct device_d *dev, struct param_d *param, co
return omap_gpmc_eccmode(oinfo, i);
}
+void gpmc_reconfigure_buswidth(struct gpmc_nand_info *oinfo)
+{
+ struct nand_chip *nand = &oinfo->nand;
+ struct gpmc_config cfg;
+
+ gpmc_get_config(oinfo->gpmc_cs, &cfg);
+
+ if (nand->options & NAND_BUSWIDTH_16) {
+ cfg.cfg[0] = GPMC_CONFIG1_DEVICETYPE_NAND;
+ nand->options ^= NAND_BUSWIDTH_16;
+ } else {
+ cfg.cfg[0] = GPMC_CONFIG1_DEVICETYPE_NAND |
+ GPMC_CONFIG1_DEVICESIZE_16;
+ nand->options |= NAND_BUSWIDTH_16;
+ }
+ debug("reconfigure buswidth to %d bit\n",
+ (nand->options & NAND_BUSWIDTH_16) ? 16 : 8);
+
+ gpmc_cs_config(oinfo->gpmc_cs, &cfg);
+}
+
/**
* @brief nand device probe.
*
@@ -924,8 +945,13 @@ static int gpmc_nand_probe(struct device_d *pdev)
/* first scan to find the device and get the page size */
if (nand_scan_ident(minfo, 1)) {
- err = -ENXIO;
- goto out_release_mem;
+ /* retry with changed buswidth*/
+ gpmc_reconfigure_buswidth(oinfo);
+
+ if (nand_scan_ident(minfo, 1)) {
+ err = -ENXIO;
+ goto out_release_mem;
+ }
}
switch (pdata->device_width) {
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2012-07-18 12:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 12:37 [PATCH 0/3] omap gpmc nand autodetect Jan Weitzel
2012-07-18 12:37 ` [PATCH 1/3] OMAP GPMC NAND: use buswidth from GPMC Jan Weitzel
2012-07-18 22:11 ` Sascha Hauer
2012-07-19 7:54 ` [PATCH 1/3 v2] " Jan Weitzel
2012-07-19 8:31 ` [PATCH 1/3] " Jan Weitzel
2012-07-19 13:09 ` Sascha Hauer
2012-07-18 12:37 ` [PATCH 2/3] gpmc: Add reset to gpmc_generic_init Jan Weitzel
2012-07-18 22:10 ` Sascha Hauer
2012-07-19 7:58 ` [PATCH 2/3 v2] " Jan Weitzel
2012-07-20 7:20 ` Sascha Hauer
2012-07-18 12:37 ` Jan Weitzel [this message]
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=1342615033-3232-4-git-send-email-j.weitzel@phytec.de \
--to=j.weitzel@phytec.de \
--cc=barebox@lists.infradead.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