follow bus_space conventions in naming

This commit is contained in:
ahoka 2011-06-28 07:16:11 +00:00
parent 9f1cc1c376
commit 52682d394e
3 changed files with 102 additions and 102 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nand.c,v 1.11 2011/05/01 13:20:28 rmind Exp $ */
/* $NetBSD: nand.c,v 1.12 2011/06/28 07:16:11 ahoka 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.11 2011/05/01 13:20:28 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.12 2011/06/28 07:16:11 ahoka Exp $");
#include "locators.h"
@ -289,14 +289,14 @@ nand_init_interface(struct nand_interface *interface)
interface->select = &nand_default_select;
interface->command = NULL;
interface->address = NULL;
interface->read_buf_byte = NULL;
interface->read_buf_word = NULL;
interface->read_byte = NULL;
interface->read_word = NULL;
interface->write_buf_byte = NULL;
interface->write_buf_word = NULL;
interface->write_byte = NULL;
interface->write_word = NULL;
interface->read_buf_1 = NULL;
interface->read_buf_2 = NULL;
interface->read_1 = NULL;
interface->read_2 = NULL;
interface->write_buf_1 = NULL;
interface->write_buf_2 = NULL;
interface->write_1 = NULL;
interface->write_2 = NULL;
interface->busy = NULL;
/*-
@ -366,10 +366,10 @@ nand_scan_media(device_t self, struct nand_chip *chip)
nand_select(self, true);
nand_command(self, ONFI_READ_ID);
nand_address(self, 0x20);
nand_read_byte(self, &onfi_signature[0]);
nand_read_byte(self, &onfi_signature[1]);
nand_read_byte(self, &onfi_signature[2]);
nand_read_byte(self, &onfi_signature[3]);
nand_read_1(self, &onfi_signature[0]);
nand_read_1(self, &onfi_signature[1]);
nand_read_1(self, &onfi_signature[2]);
nand_read_1(self, &onfi_signature[3]);
nand_select(self, false);
if (onfi_signature[0] != 'O' || onfi_signature[1] != 'N' ||
@ -488,8 +488,8 @@ nand_read_id(device_t self, uint8_t *manf, uint8_t *dev)
nand_command(self, ONFI_READ_ID);
nand_address(self, 0x00);
nand_read_byte(self, manf);
nand_read_byte(self, dev);
nand_read_1(self, manf);
nand_read_1(self, dev);
nand_select(self, false);
}
@ -517,7 +517,7 @@ nand_read_parameter_page(device_t self, struct onfi_parameter_page *params)
bufp = (uint8_t *)params;
/* XXX why i am not using read_buf? */
for (i = 0; i < 256; i++) {
nand_read_byte(self, &bufp[i]);
nand_read_1(self, &bufp[i]);
}
nand_select(self, false);
@ -639,7 +639,7 @@ nand_get_status(device_t self)
nand_command(self, ONFI_READ_STATUS);
nand_busy(self);
nand_read_byte(self, &status);
nand_read_1(self, &status);
return status;
}
@ -682,14 +682,14 @@ nand_default_read_page(device_t self, size_t offset, uint8_t *data)
if (chip->nc_flags & NC_BUSWIDTH_16) {
for (b = 0, e = 0; b < chip->nc_page_size; b += bs, e += cs) {
nand_ecc_prepare(self, NAND_ECC_READ);
nand_read_buf_word(self, data + b, bs);
nand_read_buf_2(self, data + b, bs);
nand_ecc_compute(self, data + b,
chip->nc_ecc_cache + e);
}
} else {
for (b = 0, e = 0; b < chip->nc_page_size; b += bs, e += cs) {
nand_ecc_prepare(self, NAND_ECC_READ);
nand_read_buf_byte(self, data + b, bs);
nand_read_buf_1(self, data + b, bs);
nand_ecc_compute(self, data + b,
chip->nc_ecc_cache + e);
}
@ -775,20 +775,20 @@ nand_default_program_page(device_t self, size_t page, const uint8_t *data)
if (chip->nc_flags & NC_BUSWIDTH_16) {
for (b = 0, e = 0; b < chip->nc_page_size; b += bs, e += cs) {
nand_ecc_prepare(self, NAND_ECC_WRITE);
nand_write_buf_word(self, data + b, bs);
nand_write_buf_2(self, data + b, bs);
nand_ecc_compute(self, data + b, ecc + e);
}
/* write oob with ecc correction code */
nand_write_buf_word(self, chip->nc_oob_cache,
nand_write_buf_2(self, chip->nc_oob_cache,
chip->nc_spare_size);
} else {
for (b = 0, e = 0; b < chip->nc_page_size; b += bs, e += cs) {
nand_ecc_prepare(self, NAND_ECC_WRITE);
nand_write_buf_byte(self, data + b, bs);
nand_write_buf_1(self, data + b, bs);
nand_ecc_compute(self, data + b, ecc + e);
}
/* write oob with ecc correction code */
nand_write_buf_byte(self, chip->nc_oob_cache,
nand_write_buf_1(self, chip->nc_oob_cache,
chip->nc_spare_size);
}
@ -829,9 +829,9 @@ nand_read_oob(device_t self, size_t page, uint8_t *oob)
nand_prepare_read(self, page, chip->nc_page_size);
if (chip->nc_flags & NC_BUSWIDTH_16)
nand_read_buf_word(self, oob, chip->nc_spare_size);
nand_read_buf_2(self, oob, chip->nc_spare_size);
else
nand_read_buf_byte(self, oob, chip->nc_spare_size);
nand_read_buf_1(self, oob, chip->nc_spare_size);
/* for debugging drivers */
#if 0
@ -855,9 +855,9 @@ nand_write_oob(device_t self, size_t offset, const void *oob)
nand_busy(self);
if (chip->nc_flags & NC_BUSWIDTH_16)
nand_write_buf_word(self, oob, chip->nc_spare_size);
nand_write_buf_2(self, oob, chip->nc_spare_size);
else
nand_write_buf_byte(self, oob, chip->nc_spare_size);
nand_write_buf_1(self, oob, chip->nc_spare_size);
status = nand_get_status(self);
KASSERT(status & ONFI_STATUS_RDY);
@ -918,12 +918,12 @@ nand_isfactorybad(device_t self, flash_off_t offset)
if (chip->nc_flags & NC_BUSWIDTH_16) {
uint16_t word;
nand_read_word(self, &word);
nand_read_2(self, &word);
if (word == 0x0000)
return true;
} else {
uint8_t byte;
nand_read_byte(self, &byte);
nand_read_1(self, &byte);
if (byte == 0x00)
return true;
}
@ -949,7 +949,7 @@ nand_iswornoutbad(device_t self, flash_off_t offset)
nand_prepare_read(self, block,
chip->nc_page_size + (chip->nc_badmarker_offs & 0xfe));
nand_read_word(self, &word);
nand_read_2(self, &word);
mark = htole16(word);
if (chip->nc_badmarker_offs & 0x01)
mark >>= 8;
@ -961,7 +961,7 @@ nand_iswornoutbad(device_t self, flash_off_t offset)
nand_prepare_read(self, block,
chip->nc_page_size + chip->nc_badmarker_offs);
nand_read_byte(self, &byte);
nand_read_1(self, &byte);
if (byte != 0xff)
return true;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nand.h,v 1.9 2011/05/01 14:48:11 ahoka Exp $ */
/* $NetBSD: nand.h,v 1.10 2011/06/28 07:16:11 ahoka Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@ -167,14 +167,14 @@ struct nand_interface
void (*select) (device_t, bool); /* optional */
void (*command) (device_t, uint8_t);
void (*address) (device_t, uint8_t);
void (*read_buf_byte) (device_t, void *, size_t);
void (*read_buf_word) (device_t, void *, size_t);
void (*read_byte) (device_t, uint8_t *);
void (*read_word) (device_t, uint16_t *);
void (*write_buf_byte) (device_t, const void *, size_t);
void (*write_buf_word) (device_t, const void *, size_t);
void (*write_byte) (device_t, uint8_t);
void (*write_word) (device_t, uint16_t);
void (*read_buf_1) (device_t, void *, size_t);
void (*read_buf_2) (device_t, void *, size_t);
void (*read_1) (device_t, uint8_t *);
void (*read_2) (device_t, uint16_t *);
void (*write_buf_1) (device_t, const void *, size_t);
void (*write_buf_2) (device_t, const void *, size_t);
void (*write_1) (device_t, uint8_t);
void (*write_2) (device_t, uint16_t);
void (*busy) (device_t);
/* "smart" controllers may override read/program functions */
@ -251,91 +251,91 @@ nand_command(device_t self, uint8_t command)
}
static inline void
nand_read_byte(device_t self, uint8_t *data)
nand_read_1(device_t self, uint8_t *data)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->read_byte != NULL);
KASSERT(sc->nand_if->read_1 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->read_byte(sc->controller_dev, data);
sc->nand_if->read_1(sc->controller_dev, data);
}
static inline void
nand_write_byte(device_t self, uint8_t data)
nand_write_1(device_t self, uint8_t data)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->write_byte != NULL);
KASSERT(sc->nand_if->write_1 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->write_byte(sc->controller_dev, data);
sc->nand_if->write_1(sc->controller_dev, data);
}
static inline void
nand_read_word(device_t self, uint16_t *data)
nand_read_2(device_t self, uint16_t *data)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->read_word != NULL);
KASSERT(sc->nand_if->read_2 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->read_word(sc->controller_dev, data);
sc->nand_if->read_2(sc->controller_dev, data);
}
static inline void
nand_write_word(device_t self, uint16_t data)
nand_write_2(device_t self, uint16_t data)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->write_word != NULL);
KASSERT(sc->nand_if->write_2 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->write_word(sc->controller_dev, data);
sc->nand_if->write_2(sc->controller_dev, data);
}
static inline void
nand_read_buf_byte(device_t self, void *buf, size_t size)
nand_read_buf_1(device_t self, void *buf, size_t size)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->read_buf_byte != NULL);
KASSERT(sc->nand_if->read_buf_1 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->read_buf_byte(sc->controller_dev, buf, size);
sc->nand_if->read_buf_1(sc->controller_dev, buf, size);
}
static inline void
nand_read_buf_word(device_t self, void *buf, size_t size)
nand_read_buf_2(device_t self, void *buf, size_t size)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->read_buf_word != NULL);
KASSERT(sc->nand_if->read_buf_2 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->read_buf_word(sc->controller_dev, buf, size);
sc->nand_if->read_buf_2(sc->controller_dev, buf, size);
}
static inline void
nand_write_buf_byte(device_t self, const void *buf, size_t size)
nand_write_buf_1(device_t self, const void *buf, size_t size)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->write_buf_byte != NULL);
KASSERT(sc->nand_if->write_buf_1 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->write_buf_byte(sc->controller_dev, buf, size);
sc->nand_if->write_buf_1(sc->controller_dev, buf, size);
}
static inline void
nand_write_buf_word(device_t self, const void *buf, size_t size)
nand_write_buf_2(device_t self, const void *buf, size_t size)
{
struct nand_softc *sc = device_private(self);
KASSERT(sc->nand_if->write_buf_word != NULL);
KASSERT(sc->nand_if->write_buf_2 != NULL);
KASSERT(sc->controller_dev != NULL);
sc->nand_if->write_buf_word(sc->controller_dev, buf, size);
sc->nand_if->write_buf_2(sc->controller_dev, buf, size);
}
static inline int
@ -492,11 +492,11 @@ static inline void nand_busy(device_t);
static inline void nand_select(device_t, bool);
static inline void nand_command(device_t, uint8_t);
static inline void nand_address(device_t, uint32_t);
static inline void nand_read_buf_byte(device_t, void *, size_t);
static inline void nand_read_buf_word(device_t, void *, size_t);
static inline void nand_read_byte(device_t, uint8_t *);
static inline void nand_write_buf_byte(device_t, const void *, size_t);
static inline void nand_write_buf_word(device_t, const void *, size_t);
static inline void nand_read_buf_1(device_t, void *, size_t);
static inline void nand_read_buf_2(device_t, void *, size_t);
static inline void nand_read_1(device_t, uint8_t *);
static inline void nand_write_buf_1(device_t, const void *, size_t);
static inline void nand_write_buf_2(device_t, const void *, size_t);
//static inline bool nand_block_isbad(device_t, off_t);
//static inline void nand_block_markbad(device_t, off_t);
//static inline bool nand_isbusy(device_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nand_micron.c,v 1.4 2011/05/01 13:20:28 rmind Exp $ */
/* $NetBSD: nand_micron.c,v 1.5 2011/06/28 07:16:11 ahoka Exp $ */
/*-
* Copyright (c) 2011 Department of Software Engineering,
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nand_micron.c,v 1.4 2011/05/01 13:20:28 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: nand_micron.c,v 1.5 2011/06/28 07:16:11 ahoka Exp $");
#include "nand.h"
#include "onfi.h"
@ -107,10 +107,10 @@ nand_read_parameters_micron(device_t self, struct nand_chip *chip)
nand_select(self, true);
nand_command(self, ONFI_READ_ID);
nand_address(self, 0x00);
nand_read_byte(self, &mfgrid);
nand_read_byte(self, &devid);
nand_read_byte(self, &dontcare);
nand_read_byte(self, &params);
nand_read_1(self, &mfgrid);
nand_read_1(self, &devid);
nand_read_1(self, &dontcare);
nand_read_1(self, &params);
nand_select(self, false);
KASSERT(chip->nc_manf_id == mfgrid);