]> err.no Git - linux-2.6/blobdiff - drivers/mtd/nand/au1550nd.c
Merge branches 'release', 'acpi_pm_device_sleep_state' and 'battery' into release
[linux-2.6] / drivers / mtd / nand / au1550nd.c
index 275453ea7a711b33b49d4deb39c69bc739278cf6..09e421a968934828a95100aebb4a6df8c6e9de54 100644 (file)
 #include <linux/version.h>
 #include <asm/io.h>
 
-/* fixme: this is ugly */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
 #include <asm/mach-au1x00/au1xxx.h>
-#else
-#include <asm/au1000.h>
-#ifdef CONFIG_MIPS_PB1550
-#include <asm/pb1550.h>
-#endif
-#ifdef CONFIG_MIPS_DB1550
-#include <asm/db1x00.h>
-#endif
-#endif
 
 /*
  * MTD structure for NAND controller
@@ -40,6 +29,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 +118,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 +354,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 +369,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 +390,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 +572,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;