]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[MTD] NAND remove write_byte/word function from nand_chip
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>
Tue, 23 May 2006 21:28:48 +0000 (23:28 +0200)
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>
Tue, 23 May 2006 21:28:48 +0000 (23:28 +0200)
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>
drivers/mtd/nand/ams-delta.c
drivers/mtd/nand/au1550nd.c
drivers/mtd/nand/cs553x_nand.c
drivers/mtd/nand/diskonchip.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nandsim.c
include/linux/mtd/nand.h

index c0e96860686e4b74ef8d403d8ef78e833baa3051..d7897dc6b3c8b10e8b8d1557a4d3f1171ddbfbb0 100644 (file)
@@ -179,7 +179,6 @@ static int __init ams_delta_init(void)
        this->IO_ADDR_R = (OMAP_MPUIO_BASE + OMAP_MPUIO_INPUT_LATCH);
        this->IO_ADDR_W = (OMAP_MPUIO_BASE + OMAP_MPUIO_OUTPUT);
        this->read_byte = ams_delta_read_byte;
-       this->write_byte = ams_delta_write_byte;
        this->write_buf = ams_delta_write_buf;
        this->read_buf = ams_delta_read_buf;
        this->verify_buf = ams_delta_verify_buf;
index 275453ea7a711b33b49d4deb39c69bc739278cf6..31228334da12425dbfe18f2cc3155894aaaf34a5 100644 (file)
@@ -40,6 +40,7 @@
 static struct mtd_info *au1550_mtd = NULL;
 static void __iomem *p_nand;
 static int nand_width = 1;     /* default x8 */
+static void (*au1550_write_byte)(struct mtd_info *, u_char);
 
 /*
  * Define partitions for flash device
@@ -128,21 +129,6 @@ static u16 au_read_word(struct mtd_info *mtd)
        return ret;
 }
 
-/**
- * au_write_word -  write one word to the chip
- * @mtd:       MTD device structure
- * @word:      data word to write
- *
- *  write function for 16bit buswith without
- * endianess conversion
- */
-static void au_write_word(struct mtd_info *mtd, u16 word)
-{
-       struct nand_chip *this = mtd->priv;
-       writew(word, this->IO_ADDR_W);
-       au_sync();
-}
-
 /**
  * au_write_buf -  write buffer to chip
  * @mtd:       MTD device structure
@@ -379,9 +365,9 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
                        column -= 256;
                        readcmd = NAND_CMD_READ1;
                }
-               this->write_byte(mtd, readcmd);
+               au1550_write_byte(mtd, readcmd);
        }
-       this->write_byte(mtd, command);
+       au1550_write_byte(mtd, command);
 
        /* Set ALE and clear CLE to start address cycle */
        au1550_hwcontrol(mtd, NAND_CTL_CLRCLE);
@@ -394,10 +380,10 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
                        /* Adjust columns for 16 bit buswidth */
                        if (this->options & NAND_BUSWIDTH_16)
                                column >>= 1;
-                       this->write_byte(mtd, column);
+                       au1550_write_byte(mtd, column);
                }
                if (page_addr != -1) {
-                       this->write_byte(mtd, (u8)(page_addr & 0xff));
+                       au1550_write_byte(mtd, (u8)(page_addr & 0xff));
 
                        if (command == NAND_CMD_READ0 ||
                            command == NAND_CMD_READ1 ||
@@ -415,11 +401,11 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
                                au1550_hwcontrol(mtd, NAND_CTL_SETNCE);
                        }
 
-                       this->write_byte(mtd, (u8)(page_addr >> 8));
+                       au1550_write_byte(mtd, (u8)(page_addr >> 8));
 
                        /* One more address cycle for devices > 32MiB */
                        if (this->chipsize > (32 << 20))
-                               this->write_byte(mtd, (u8)((page_addr >> 16) & 0x0f));
+                               au1550_write_byte(mtd, (u8)((page_addr >> 16) & 0x0f));
                }
                /* Latch in address */
                au1550_hwcontrol(mtd, NAND_CTL_CLRALE);
@@ -597,8 +583,7 @@ static int __init au1xxx_nand_init(void)
                this->options |= NAND_BUSWIDTH_16;
 
        this->read_byte = (!nand_width) ? au_read_byte16 : au_read_byte;
-       this->write_byte = (!nand_width) ? au_write_byte16 : au_write_byte;
-       this->write_word = au_write_word;
+       au1550_write_byte = (!nand_width) ? au_write_byte16 : au_write_byte;
        this->read_word = au_read_word;
        this->write_buf = (!nand_width) ? au_write_buf16 : au_write_buf;
        this->read_buf = (!nand_width) ? au_read_buf16 : au_read_buf;
index cd3d7eb132f9c56ba5b53a971b5b3ad22aa8c9ec..1e0348ae325f5522908356014fdb5903167e8100 100644 (file)
@@ -220,7 +220,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
        this->cmd_ctrl = cs553x_hwcontrol;
        this->dev_ready = cs553x_device_ready;
        this->read_byte = cs553x_read_byte;
-       this->write_byte = cs553x_write_byte;
        this->read_buf = cs553x_read_buf;
        this->write_buf = cs553x_write_buf;
 
index e4bb6b429f873d0044a53410ba52990846b637ae..2ec9080e2b14a52169ac55267edefbba4e95a921 100644 (file)
@@ -717,8 +717,12 @@ static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd,
                /* 11.4.3 -- 4 NOPs after CSDNControl write */
                DoC_Delay(doc, 4);
        }
-       if (cmd != NAND_CMD_NONE)
-               this->write_byte(mtd, cmd);
+       if (cmd != NAND_CMD_NONE) {
+               if (DoC_is_2000(doc))
+                       doc2000_write_byte(mtd, cmd);
+               else
+                       doc2001_write_byte(mtd, cmd);
+       }
 }
 
 static 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)
        struct nand_chip *this = mtd->priv;
        struct doc_priv *doc = this->priv;
 
-       this->write_byte = doc2000_write_byte;
        this->read_byte = doc2000_read_byte;
        this->write_buf = doc2000_writebuf;
        this->read_buf = doc2000_readbuf;
@@ -1453,7 +1456,6 @@ static inline int __init doc2001_init(struct mtd_info *mtd)
        struct nand_chip *this = mtd->priv;
        struct doc_priv *doc = this->priv;
 
-       this->write_byte = doc2001_write_byte;
        this->read_byte = doc2001_read_byte;
        this->write_buf = doc2001_writebuf;
        this->read_buf = doc2001_readbuf;
@@ -1485,7 +1487,6 @@ static inline int __init doc2001plus_init(struct mtd_info *mtd)
        struct nand_chip *this = mtd->priv;
        struct doc_priv *doc = this->priv;
 
-       this->write_byte = NULL;
        this->read_byte = doc2001plus_read_byte;
        this->write_buf = doc2001plus_writebuf;
        this->read_buf = doc2001plus_readbuf;
index f6997fb77b910569881b8b677607834b9a308ba3..4f387c8388d701f7f2290983432f3c0a07278979 100644 (file)
@@ -197,19 +197,6 @@ static uint8_t nand_read_byte(struct mtd_info *mtd)
        return readb(this->IO_ADDR_R);
 }
 
-/**
- * nand_write_byte - [DEFAULT] write one byte to the chip
- * @mtd:       MTD device structure
- * @byte:      pointer to data byte to write
- *
- * Default write function for 8it buswith
- */
-static void nand_write_byte(struct mtd_info *mtd, uint8_t byte)
-{
-       struct nand_chip *this = mtd->priv;
-       writeb(byte, this->IO_ADDR_W);
-}
-
 /**
  * nand_read_byte16 - [DEFAULT] read one byte endianess aware from the chip
  * @mtd:       MTD device structure
@@ -223,20 +210,6 @@ static uint8_t nand_read_byte16(struct mtd_info *mtd)
        return (uint8_t) cpu_to_le16(readw(this->IO_ADDR_R));
 }
 
-/**
- * nand_write_byte16 - [DEFAULT] write one byte endianess aware to the chip
- * @mtd:       MTD device structure
- * @byte:      pointer to data byte to write
- *
- * Default write function for 16bit buswith with
- * endianess conversion
- */
-static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte)
-{
-       struct nand_chip *this = mtd->priv;
-       writew(le16_to_cpu((u16) byte), this->IO_ADDR_W);
-}
-
 /**
  * nand_read_word - [DEFAULT] read one word from the chip
  * @mtd:       MTD device structure
@@ -250,20 +223,6 @@ static u16 nand_read_word(struct mtd_info *mtd)
        return readw(this->IO_ADDR_R);
 }
 
-/**
- * nand_write_word - [DEFAULT] write one word to the chip
- * @mtd:       MTD device structure
- * @word:      data word to write
- *
- * Default write function for 16bit buswith without
- * endianess conversion
- */
-static void nand_write_word(struct mtd_info *mtd, u16 word)
-{
-       struct nand_chip *this = mtd->priv;
-       writew(word, this->IO_ADDR_W);
-}
-
 /**
  * nand_select_chip - [DEFAULT] control CE line
  * @mtd:       MTD device structure
@@ -2200,12 +2159,8 @@ static void nand_set_defaults(struct nand_chip *this, int busw)
 
        if (!this->select_chip)
                this->select_chip = nand_select_chip;
-       if (!this->write_byte)
-               this->write_byte = busw ? nand_write_byte16 : nand_write_byte;
        if (!this->read_byte)
                this->read_byte = busw ? nand_read_byte16 : nand_read_byte;
-       if (!this->write_word)
-               this->write_word = nand_write_word;
        if (!this->read_word)
                this->read_word = nand_read_word;
        if (!this->block_bad)
index ecf727b32dec5f3ae6dadcccb124740fbfe3f4ca..ebd64abc8be809ead329761205798c3a48fb60da 100644 (file)
@@ -1326,17 +1326,6 @@ ns_nand_read_word(struct mtd_info *mtd)
        return chip->read_byte(mtd) | (chip->read_byte(mtd) << 8);
 }
 
-static void
-ns_nand_write_word(struct mtd_info *mtd, uint16_t word)
-{
-       struct nand_chip *chip = (struct nand_chip *)mtd->priv;
-
-       NS_DBG("write_word\n");
-
-       chip->write_byte(mtd, word & 0xFF);
-       chip->write_byte(mtd, word >> 8);
-}
-
 static void
 ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
@@ -1467,11 +1456,9 @@ static int __init ns_init_module(void)
        chip->cmd_ctrl   = ns_hwcontrol;
        chip->read_byte  = ns_nand_read_byte;
        chip->dev_ready  = ns_device_ready;
-       chip->write_byte = ns_nand_write_byte;
        chip->write_buf  = ns_nand_write_buf;
        chip->read_buf   = ns_nand_read_buf;
        chip->verify_buf = ns_nand_verify_buf;
-       chip->write_word = ns_nand_write_word;
        chip->read_word  = ns_nand_read_word;
        chip->ecc.mode   = NAND_ECC_SOFT;
        chip->options   |= NAND_SKIP_BBTSCAN;
index e9a935263151f28f4cfc3f178d0d04086fc8baf4..2c0fb63804614f37d2d4e5d8dbb71b393a9b5786 100644 (file)
@@ -253,9 +253,7 @@ struct nand_ecc_ctrl {
  * @IO_ADDR_R:         [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device
  * @IO_ADDR_W:         [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device
  * @read_byte:         [REPLACEABLE] read one byte from the chip
- * @write_byte:                [REPLACEABLE] write one byte to the chip
  * @read_word:         [REPLACEABLE] read one word from the chip
- * @write_word:                [REPLACEABLE] write one word to the chip
  * @write_buf:         [REPLACEABLE] write data from the buffer to the chip
  * @read_buf:          [REPLACEABLE] read data from the chip into the buffer
  * @verify_buf:                [REPLACEABLE] verify buffer contents against the chip data
@@ -307,10 +305,7 @@ struct nand_chip {
        void  __iomem   *IO_ADDR_W;
 
        uint8_t         (*read_byte)(struct mtd_info *mtd);
-       void            (*write_byte)(struct mtd_info *mtd, uint8_t byte);
        u16             (*read_word)(struct mtd_info *mtd);
-       void            (*write_word)(struct mtd_info *mtd, u16 word);
-
        void            (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
        void            (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
        int             (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);