Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/nand Remove trailing tabs, add RCS IDs.
details: https://anonhg.NetBSD.org/src/rev/656719f98c86
branches: trunk
changeset: 764707:656719f98c86
user: rmind <rmind%NetBSD.org@localhost>
date: Sun May 01 13:20:28 2011 +0000
description:
Remove trailing tabs, add RCS IDs.
diffstat:
sys/dev/nand/nand.c | 25 ++++++++---------------
sys/dev/nand/nand_bbt.c | 23 +++++++++++++--------
sys/dev/nand/nand_io.c | 48 +++++++++++++++++++++------------------------
sys/dev/nand/nand_micron.c | 6 ++++-
4 files changed, 50 insertions(+), 52 deletions(-)
diffs (truncated from 373 to 300 lines):
diff -r 0e0c456f3006 -r 656719f98c86 sys/dev/nand/nand.c
--- a/sys/dev/nand/nand.c Sun May 01 11:44:41 2011 +0000
+++ b/sys/dev/nand/nand.c Sun May 01 13:20:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nand.c,v 1.10 2011/04/26 17:31:57 ahoka Exp $ */
+/* $NetBSD: nand.c,v 1.11 2011/05/01 13:20:28 rmind Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@@ -34,7 +34,7 @@
/* Common driver for NAND chips implementing the ONFI 2.2 specification */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.10 2011/04/26 17:31:57 ahoka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.11 2011/05/01 13:20:28 rmind Exp $");
#include "locators.h"
@@ -343,7 +343,7 @@
default:
return 1;
}
-
+
return 0;
}
@@ -375,9 +375,9 @@
if (onfi_signature[0] != 'O' || onfi_signature[1] != 'N' ||
onfi_signature[2] != 'F' || onfi_signature[3] != 'I') {
chip->nc_isonfi = false;
-
+
aprint_normal(": Legacy NAND Flash\n");
-
+
nand_read_id(self, &chip->nc_manf_id, &chip->nc_dev_id);
if (nand_fill_chip_structure_legacy(self, chip)) {
@@ -391,11 +391,10 @@
aprint_normal(": ONFI NAND Flash\n");
nand_read_id(self, &chip->nc_manf_id, &chip->nc_dev_id);
-
+
if (nand_fill_chip_structure(self, chip)) {
aprint_error_dev(self,
"can't read device parameters\n");
-
return 1;
}
}
@@ -488,10 +487,10 @@
nand_select(self, true);
nand_command(self, ONFI_READ_ID);
nand_address(self, 0x00);
-
+
nand_read_byte(self, manf);
nand_read_byte(self, dev);
-
+
nand_select(self, false);
}
@@ -1300,9 +1299,7 @@
addr += chip->nc_page_size;
}
-
KASSERT(*retlen == len);
-
out:
mutex_exit(&sc->sc_device_lock);
@@ -1341,7 +1338,6 @@
if (len < chip->nc_page_size)
panic("TODO page size is larger than read size");
#endif
-
if (len % chip->nc_page_size != 0 ||
offset % chip->nc_page_size != 0) {
@@ -1369,7 +1365,6 @@
addr += chip->nc_page_size;
*retlen += chip->nc_page_size;
}
-
out:
mutex_exit(&sc->sc_device_lock);
@@ -1402,7 +1397,7 @@
mutex_exit(&sc->sc_device_lock);
*isbad = result;
-
+
return 0;
}
@@ -1473,7 +1468,6 @@
if (nand_isbad(self, addr)) {
aprint_error_dev(self, "bad block encountered\n");
ei->ei_state = FLASH_ERASE_FAILED;
-
error = EIO;
goto out;
}
@@ -1481,7 +1475,6 @@
error = nand_erase_block(self, addr);
if (error) {
ei->ei_state = FLASH_ERASE_FAILED;
-
goto out;
}
diff -r 0e0c456f3006 -r 656719f98c86 sys/dev/nand/nand_bbt.c
--- a/sys/dev/nand/nand_bbt.c Sun May 01 11:44:41 2011 +0000
+++ b/sys/dev/nand/nand_bbt.c Sun May 01 13:20:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nand_bbt.c,v 1.3 2011/04/26 13:38:13 ahoka Exp $ */
+/* $NetBSD: nand_bbt.c,v 1.4 2011/05/01 13:20:28 rmind Exp $ */
/*-
* Copyright (c) 2011 Department of Software Engineering,
@@ -31,7 +31,12 @@
* SUCH DAMAGE.
*/
-/* Support for Bad Block Tables (BBTs) */
+/*
+ * Implementation of Bad Block Tables (BBTs).
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: nand_bbt.c,v 1.4 2011/05/01 13:20:28 rmind Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -95,9 +100,9 @@
struct nand_softc *sc = device_private(self);
struct nand_chip *chip = &sc->sc_chip;
uint8_t *oob = chip->nc_oob_cache;
-
+
nand_read_oob(self, addr, oob);
-
+
if (oob[NAND_BBT_OFFSET] == 'B' &&
oob[NAND_BBT_OFFSET + 1] == 'b' &&
oob[NAND_BBT_OFFSET + 2] == 't') {
@@ -123,26 +128,26 @@
if (nand_isbad(self, addr)) {
return false;
}
-
+
if (nand_bbt_page_has_bbt(self, addr)) {
bbtp = bbt->nbbt_bitmap;
left = bbt->nbbt_size;
-
+
for (i = 0; i < bbt_pages; i++) {
nand_read_page(self, addr, buf);
-
+
if (i == bbt_pages - 1) {
KASSERT(left <= chip->nc_page_size);
memcpy(bbtp, buf, left);
} else {
memcpy(bbtp, buf, chip->nc_page_size);
}
-
+
bbtp += chip->nc_page_size;
left -= chip->nc_page_size;
addr += chip->nc_page_size;
}
-
+
return true;
} else {
return false;
diff -r 0e0c456f3006 -r 656719f98c86 sys/dev/nand/nand_io.c
--- a/sys/dev/nand/nand_io.c Sun May 01 11:44:41 2011 +0000
+++ b/sys/dev/nand/nand_io.c Sun May 01 13:20:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nand_io.c,v 1.4 2011/04/26 17:27:52 ahoka Exp $ */
+/* $NetBSD: nand_io.c,v 1.5 2011/05/01 13:20:28 rmind Exp $ */
/*-
* Copyright (c) 2011 Department of Software Engineering,
@@ -31,10 +31,14 @@
* SUCH DAMAGE.
*/
-/* Inspired by the similar code in the NetBSD SPI driver, but I
+/*
+ * Inspired by the similar code in the NetBSD SPI driver, but I
* decided to do a rewrite from scratch to be suitable for NAND.
*/
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: nand_io.c,v 1.5 2011/05/01 13:20:28 rmind Exp $");
+
#include <sys/param.h>
#include <sys/buf.h>
#include <sys/bufq.h>
@@ -108,11 +112,11 @@
mutex_init(&sc->sc_io_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&wc->nwc_lock, MUTEX_DEFAULT, IPL_NONE);
cv_init(&sc->sc_io_cv, "nandcv");
-
+
error = bufq_alloc(&wc->nwc_bufq, "fcfs", BUFQ_SORT_RAWBLOCK);
if (error)
goto err_bufq;
-
+
sc->sc_io_running = true;
wc->nwc_write_pending = false;
@@ -122,11 +126,11 @@
if (!error)
return 0;
-
+
bufq_free(wc->nwc_bufq);
err_bufq:
cv_destroy(&sc->sc_io_cv);
-
+
mutex_destroy(&sc->sc_io_lock);
mutex_destroy(&wc->nwc_lock);
@@ -182,19 +186,18 @@
if (BUF_ISREAD(bp)) {
DPRINTF(("we have a read job\n"));
-
+
mutex_enter(&wc->nwc_lock);
if (wc->nwc_write_pending)
nand_io_cache_sync(self);
mutex_exit(&wc->nwc_lock);
-
+
nand_io_read(self, bp);
} else {
DPRINTF(("we have a write job\n"));
nand_io_write(self, bp);
}
-
return 0;
}
@@ -209,12 +212,12 @@
int error;
KASSERT(chip->nc_block_size != 0);
-
+
base = block * chip->nc_block_size;
offset = bp->b_rawblkno * DEV_BSIZE - base;
-
+
DPRINTF(("io cache write, offset: %jd\n", (intmax_t )offset));
-
+
if (!wc->nwc_write_pending) {
wc->nwc_block = block;
/*
@@ -289,7 +292,7 @@
out:
while ((bp = bufq_get(wc->nwc_bufq)) != NULL)
nand_io_done(self, bp, error);
-
+
wc->nwc_block = -1;
wc->nwc_write_pending = false;
}
@@ -309,12 +312,11 @@
mutex_exit(&sc->sc_io_lock);
mutex_enter(&wc->nwc_lock);
-
if (!wc->nwc_write_pending) {
mutex_exit(&wc->nwc_lock);
continue;
}
-
+
/* see if the cache is older than 3 seconds (safety limit),
* or if we havent touched the cache since more than 1 ms
*/
@@ -328,10 +330,9 @@
}
mutex_exit(&wc->nwc_lock);
Home |
Main Index |
Thread Index |
Old Index