aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-23 17:28:48 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-23 17:28:48 -0400
commitcad74f2c380411ae7bee997f3ba18834cfe313a2 (patch)
treeaec691447dc3ab76688fe9dbe3cc2ae04ad1cbee /drivers
parent7abd3ef9875eb2afcdcd4f450680298a2983a55e (diff)
[MTD] NAND remove write_byte/word function from nand_chip
The previous change of the command / hardware control allows to remove the write_byte/word functions completely, as their only user were nand_command and nand_command_lp. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/ams-delta.c1
-rw-r--r--drivers/mtd/nand/au1550nd.c31
-rw-r--r--drivers/mtd/nand/cs553x_nand.c1
-rw-r--r--drivers/mtd/nand/diskonchip.c11
-rw-r--r--drivers/mtd/nand/nand_base.c45
-rw-r--r--drivers/mtd/nand/nandsim.c13
6 files changed, 14 insertions, 88 deletions
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index c0e96860686e..d7897dc6b3c8 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -179,7 +179,6 @@ static int __init ams_delta_init(void)
179 this->IO_ADDR_R = (OMAP_MPUIO_BASE + OMAP_MPUIO_INPUT_LATCH); 179 this->IO_ADDR_R = (OMAP_MPUIO_BASE + OMAP_MPUIO_INPUT_LATCH);
180 this->IO_ADDR_W = (OMAP_MPUIO_BASE + OMAP_MPUIO_OUTPUT); 180 this->IO_ADDR_W = (OMAP_MPUIO_BASE + OMAP_MPUIO_OUTPUT);
181 this->read_byte = ams_delta_read_byte; 181 this->read_byte = ams_delta_read_byte;
182 this->write_byte = ams_delta_write_byte;
183 this->write_buf = ams_delta_write_buf; 182 this->write_buf = ams_delta_write_buf;
184 this->read_buf = ams_delta_read_buf; 183 this->read_buf = ams_delta_read_buf;
185 this->verify_buf = ams_delta_verify_buf; 184 this->verify_buf = ams_delta_verify_buf;
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 275453ea7a71..31228334da12 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -40,6 +40,7 @@
40static struct mtd_info *au1550_mtd = NULL; 40static struct mtd_info *au1550_mtd = NULL;
41static void __iomem *p_nand; 41static void __iomem *p_nand;
42static int nand_width = 1; /* default x8 */ 42static int nand_width = 1; /* default x8 */
43static void (*au1550_write_byte)(struct mtd_info *, u_char);
43 44
44/* 45/*
45 * Define partitions for flash device 46 * Define partitions for flash device
@@ -129,21 +130,6 @@ static u16 au_read_word(struct mtd_info *mtd)
129} 130}
130 131
131/** 132/**
132 * au_write_word - write one word to the chip
133 * @mtd: MTD device structure
134 * @word: data word to write
135 *
136 * write function for 16bit buswith without
137 * endianess conversion
138 */
139static void au_write_word(struct mtd_info *mtd, u16 word)
140{
141 struct nand_chip *this = mtd->priv;
142 writew(word, this->IO_ADDR_W);
143 au_sync();
144}
145
146/**
147 * au_write_buf - write buffer to chip 133 * au_write_buf - write buffer to chip
148 * @mtd: MTD device structure 134 * @mtd: MTD device structure
149 * @buf: data buffer 135 * @buf: data buffer
@@ -379,9 +365,9 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
379 column -= 256; 365 column -= 256;
380 readcmd = NAND_CMD_READ1; 366 readcmd = NAND_CMD_READ1;
381 } 367 }
382 this->write_byte(mtd, readcmd); 368 au1550_write_byte(mtd, readcmd);
383 } 369 }
384 this->write_byte(mtd, command); 370 au1550_write_byte(mtd, command);
385 371
386 /* Set ALE and clear CLE to start address cycle */ 372 /* Set ALE and clear CLE to start address cycle */
387 au1550_hwcontrol(mtd, NAND_CTL_CLRCLE); 373 au1550_hwcontrol(mtd, NAND_CTL_CLRCLE);
@@ -394,10 +380,10 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
394 /* Adjust columns for 16 bit buswidth */ 380 /* Adjust columns for 16 bit buswidth */
395 if (this->options & NAND_BUSWIDTH_16) 381 if (this->options & NAND_BUSWIDTH_16)
396 column >>= 1; 382 column >>= 1;
397 this->write_byte(mtd, column); 383 au1550_write_byte(mtd, column);
398 } 384 }
399 if (page_addr != -1) { 385 if (page_addr != -1) {
400 this->write_byte(mtd, (u8)(page_addr & 0xff)); 386 au1550_write_byte(mtd, (u8)(page_addr & 0xff));
401 387
402 if (command == NAND_CMD_READ0 || 388 if (command == NAND_CMD_READ0 ||
403 command == NAND_CMD_READ1 || 389 command == NAND_CMD_READ1 ||
@@ -415,11 +401,11 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
415 au1550_hwcontrol(mtd, NAND_CTL_SETNCE); 401 au1550_hwcontrol(mtd, NAND_CTL_SETNCE);
416 } 402 }
417 403
418 this->write_byte(mtd, (u8)(page_addr >> 8)); 404 au1550_write_byte(mtd, (u8)(page_addr >> 8));
419 405
420 /* One more address cycle for devices > 32MiB */ 406 /* One more address cycle for devices > 32MiB */
421 if (this->chipsize > (32 << 20)) 407 if (this->chipsize > (32 << 20))
422 this->write_byte(mtd, (u8)((page_addr >> 16) & 0x0f)); 408 au1550_write_byte(mtd, (u8)((page_addr >> 16) & 0x0f));
423 } 409 }
424 /* Latch in address */ 410 /* Latch in address */
425 au1550_hwcontrol(mtd, NAND_CTL_CLRALE); 411 au1550_hwcontrol(mtd, NAND_CTL_CLRALE);
@@ -597,8 +583,7 @@ static int __init au1xxx_nand_init(void)
597 this->options |= NAND_BUSWIDTH_16; 583 this->options |= NAND_BUSWIDTH_16;
598 584
599 this->read_byte = (!nand_width) ? au_read_byte16 : au_read_byte; 585 this->read_byte = (!nand_width) ? au_read_byte16 : au_read_byte;
600 this->write_byte = (!nand_width) ? au_write_byte16 : au_write_byte; 586 au1550_write_byte = (!nand_width) ? au_write_byte16 : au_write_byte;
601 this->write_word = au_write_word;
602 this->read_word = au_read_word; 587 this->read_word = au_read_word;
603 this->write_buf = (!nand_width) ? au_write_buf16 : au_write_buf; 588 this->write_buf = (!nand_width) ? au_write_buf16 : au_write_buf;
604 this->read_buf = (!nand_width) ? au_read_buf16 : au_read_buf; 589 this->read_buf = (!nand_width) ? au_read_buf16 : au_read_buf;
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index cd3d7eb132f9..1e0348ae325f 100644
--- a/drivers/mtd/nand/cs553x_nand.c
+++ b/drivers/mtd/nand/cs553x_nand.c
@@ -220,7 +220,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
220 this->cmd_ctrl = cs553x_hwcontrol; 220 this->cmd_ctrl = cs553x_hwcontrol;
221 this->dev_ready = cs553x_device_ready; 221 this->dev_ready = cs553x_device_ready;
222 this->read_byte = cs553x_read_byte; 222 this->read_byte = cs553x_read_byte;
223 this->write_byte = cs553x_write_byte;
224 this->read_buf = cs553x_read_buf; 223 this->read_buf = cs553x_read_buf;
225 this->write_buf = cs553x_write_buf; 224 this->write_buf = cs553x_write_buf;
226 225
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index e4bb6b429f87..2ec9080e2b14 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -717,8 +717,12 @@ static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd,
717 /* 11.4.3 -- 4 NOPs after CSDNControl write */ 717 /* 11.4.3 -- 4 NOPs after CSDNControl write */
718 DoC_Delay(doc, 4); 718 DoC_Delay(doc, 4);
719 } 719 }
720 if (cmd != NAND_CMD_NONE) 720 if (cmd != NAND_CMD_NONE) {
721 this->write_byte(mtd, cmd); 721 if (DoC_is_2000(doc))
722 doc2000_write_byte(mtd, cmd);
723 else
724 doc2001_write_byte(mtd, cmd);
725 }
722} 726}
723 727
724static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int column, int page_addr) 728static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int column, int page_addr)
@@ -1435,7 +1439,6 @@ static inline int __init doc2000_init(struct mtd_info *mtd)
1435 struct nand_chip *this = mtd->priv; 1439 struct nand_chip *this = mtd->priv;
1436 struct doc_priv *doc = this->priv; 1440 struct doc_priv *doc = this->priv;
1437 1441
1438 this->write_byte = doc2000_write_byte;
1439 this->read_byte = doc2000_read_byte; 1442 this->read_byte = doc2000_read_byte;
1440 this->write_buf = doc2000_writebuf; 1443 this->write_buf = doc2000_writebuf;
1441 this->read_buf = doc2000_readbuf; 1444 this->read_buf = doc2000_readbuf;
@@ -1453,7 +1456,6 @@ static inline int __init doc2001_init(struct mtd_info *mtd)
1453 struct nand_chip *this = mtd->priv; 1456 struct nand_chip *this = mtd->priv;
1454 struct doc_priv *doc = this->priv; 1457 struct doc_priv *doc = this->priv;
1455 1458
1456 this->write_byte = doc2001_write_byte;
1457 this->read_byte = doc2001_read_byte; 1459 this->read_byte = doc2001_read_byte;
1458 this->write_buf = doc2001_writebuf; 1460 this->write_buf = doc2001_writebuf;
1459 this->read_buf = doc2001_readbuf; 1461 this->read_buf = doc2001_readbuf;
@@ -1485,7 +1487,6 @@ static inline int __init doc2001plus_init(struct mtd_info *mtd)
1485 struct nand_chip *this = mtd->priv; 1487 struct nand_chip *this = mtd->priv;
1486 struct doc_priv *doc = this->priv; 1488 struct doc_priv *doc = this->priv;
1487 1489
1488 this->write_byte = NULL;
1489 this->read_byte = doc2001plus_read_byte; 1490 this->read_byte = doc2001plus_read_byte;
1490 this->write_buf = doc2001plus_writebuf; 1491 this->write_buf = doc2001plus_writebuf;
1491 this->read_buf = doc2001plus_readbuf; 1492 this->read_buf = doc2001plus_readbuf;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index f6997fb77b91..4f387c8388d7 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -198,19 +198,6 @@ static uint8_t nand_read_byte(struct mtd_info *mtd)
198} 198}
199 199
200/** 200/**
201 * nand_write_byte - [DEFAULT] write one byte to the chip
202 * @mtd: MTD device structure
203 * @byte: pointer to data byte to write
204 *
205 * Default write function for 8it buswith
206 */
207static void nand_write_byte(struct mtd_info *mtd, uint8_t byte)
208{
209 struct nand_chip *this = mtd->priv;
210 writeb(byte, this->IO_ADDR_W);
211}
212
213/**
214 * nand_read_byte16 - [DEFAULT] read one byte endianess aware from the chip 201 * nand_read_byte16 - [DEFAULT] read one byte endianess aware from the chip
215 * @mtd: MTD device structure 202 * @mtd: MTD device structure
216 * 203 *
@@ -224,20 +211,6 @@ static uint8_t nand_read_byte16(struct mtd_info *mtd)
224} 211}
225 212
226/** 213/**
227 * nand_write_byte16 - [DEFAULT] write one byte endianess aware to the chip
228 * @mtd: MTD device structure
229 * @byte: pointer to data byte to write
230 *
231 * Default write function for 16bit buswith with
232 * endianess conversion
233 */
234static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte)
235{
236 struct nand_chip *this = mtd->priv;
237 writew(le16_to_cpu((u16) byte), this->IO_ADDR_W);
238}
239
240/**
241 * nand_read_word - [DEFAULT] read one word from the chip 214 * nand_read_word - [DEFAULT] read one word from the chip
242 * @mtd: MTD device structure 215 * @mtd: MTD device structure
243 * 216 *
@@ -251,20 +224,6 @@ static u16 nand_read_word(struct mtd_info *mtd)
251} 224}
252 225
253/** 226/**
254 * nand_write_word - [DEFAULT] write one word to the chip
255 * @mtd: MTD device structure
256 * @word: data word to write
257 *
258 * Default write function for 16bit buswith without
259 * endianess conversion
260 */
261static void nand_write_word(struct mtd_info *mtd, u16 word)
262{
263 struct nand_chip *this = mtd->priv;
264 writew(word, this->IO_ADDR_W);
265}
266
267/**
268 * nand_select_chip - [DEFAULT] control CE line 227 * nand_select_chip - [DEFAULT] control CE line
269 * @mtd: MTD device structure 228 * @mtd: MTD device structure
270 * @chip: chipnumber to select, -1 for deselect 229 * @chip: chipnumber to select, -1 for deselect
@@ -2200,12 +2159,8 @@ static void nand_set_defaults(struct nand_chip *this, int busw)
2200 2159
2201 if (!this->select_chip) 2160 if (!this->select_chip)
2202 this->select_chip = nand_select_chip; 2161 this->select_chip = nand_select_chip;
2203 if (!this->write_byte)
2204 this->write_byte = busw ? nand_write_byte16 : nand_write_byte;
2205 if (!this->read_byte) 2162 if (!this->read_byte)
2206 this->read_byte = busw ? nand_read_byte16 : nand_read_byte; 2163 this->read_byte = busw ? nand_read_byte16 : nand_read_byte;
2207 if (!this->write_word)
2208 this->write_word = nand_write_word;
2209 if (!this->read_word) 2164 if (!this->read_word)
2210 this->read_word = nand_read_word; 2165 this->read_word = nand_read_word;
2211 if (!this->block_bad) 2166 if (!this->block_bad)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index ecf727b32dec..ebd64abc8be8 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -1327,17 +1327,6 @@ ns_nand_read_word(struct mtd_info *mtd)
1327} 1327}
1328 1328
1329static void 1329static void
1330ns_nand_write_word(struct mtd_info *mtd, uint16_t word)
1331{
1332 struct nand_chip *chip = (struct nand_chip *)mtd->priv;
1333
1334 NS_DBG("write_word\n");
1335
1336 chip->write_byte(mtd, word & 0xFF);
1337 chip->write_byte(mtd, word >> 8);
1338}
1339
1340static void
1341ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) 1330ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
1342{ 1331{
1343 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv; 1332 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
@@ -1467,11 +1456,9 @@ static int __init ns_init_module(void)
1467 chip->cmd_ctrl = ns_hwcontrol; 1456 chip->cmd_ctrl = ns_hwcontrol;
1468 chip->read_byte = ns_nand_read_byte; 1457 chip->read_byte = ns_nand_read_byte;
1469 chip->dev_ready = ns_device_ready; 1458 chip->dev_ready = ns_device_ready;
1470 chip->write_byte = ns_nand_write_byte;
1471 chip->write_buf = ns_nand_write_buf; 1459 chip->write_buf = ns_nand_write_buf;
1472 chip->read_buf = ns_nand_read_buf; 1460 chip->read_buf = ns_nand_read_buf;
1473 chip->verify_buf = ns_nand_verify_buf; 1461 chip->verify_buf = ns_nand_verify_buf;
1474 chip->write_word = ns_nand_write_word;
1475 chip->read_word = ns_nand_read_word; 1462 chip->read_word = ns_nand_read_word;
1476 chip->ecc.mode = NAND_ECC_SOFT; 1463 chip->ecc.mode = NAND_ECC_SOFT;
1477 chip->options |= NAND_SKIP_BBTSCAN; 1464 chip->options |= NAND_SKIP_BBTSCAN;