summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2013-11-29 14:23:22 +0000
committerian <ian@FreeBSD.org>2013-11-29 14:23:22 +0000
commitb59bb1bd462243d6d56f7341ab65f72cad649e69 (patch)
tree47422ef33f1af330a13f2def910ac0f7e2090879
parent89468053e3a9c76aa369f6e87cb691a3993e3029 (diff)
downloadFreeBSD-src-b59bb1bd462243d6d56f7341ab65f72cad649e69.zip
FreeBSD-src-b59bb1bd462243d6d56f7341ab65f72cad649e69.tar.gz
Look up a nand chip by id in the static table before trying to obtain
ONFI parameters. This allows a static table entry to provide valid data for chips known to provide invalid ONFI data.
-rw-r--r--sys/dev/nand/nandbus.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/sys/dev/nand/nandbus.c b/sys/dev/nand/nandbus.c
index a79cd4d..5dc2e2f 100644
--- a/sys/dev/nand/nandbus.c
+++ b/sys/dev/nand/nandbus.c
@@ -195,8 +195,27 @@ nandbus_attach(device_t dev)
if (chip_id.man_id == 0xff)
continue;
- /* Check if chip is ONFI compliant */
- if (nand_probe_onfi(dev, &onfi) != 0) {
+ /*
+ * First try to get info from the table. If that fails, see if
+ * the chip can provide ONFI info. We check the table first to
+ * allow table entries to override info from chips that are
+ * known to provide bad ONFI data.
+ */
+ onfi = 0;
+ chip_params = nand_get_params(&chip_id);
+ if (chip_params == NULL) {
+ nand_probe_onfi(dev, &onfi);
+ }
+
+ /*
+ * At this point it appears there is a chip at this chipselect,
+ * so if we can't work with it, whine about it.
+ */
+ if (chip_params == NULL && onfi == 0) {
+ if (bootverbose || (nand_debug_flag & NDBG_BUS))
+ printf("Chip params not found, chipsel: %d "
+ "(manuf: 0x%0x, chipid: 0x%0x, onfi: %d)\n",
+ cs, chip_id.man_id, chip_id.dev_id, onfi);
continue;
}
@@ -218,15 +237,6 @@ nandbus_attach(device_t dev)
continue;
}
- chip_params = nand_get_params(&chip_id);
- if (chip_params == NULL) {
- nand_debug(NDBG_BUS,"Chip description not found! "
- "(manuf: 0x%0x, chipid: 0x%0x)\n",
- chip_id.man_id, chip_id.dev_id);
- free(ivar, M_NAND);
- continue;
- }
-
ivar->cs = cs;
ivar->cols = 1;
ivar->rows = 2;
OpenPOWER on IntegriCloud