aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/au1550nd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/au1550nd.c')
-rw-r--r--drivers/mtd/nand/au1550nd.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 953daf379b9b..3cafcdf28aed 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2004 Embedded Edge, LLC 4 * Copyright (C) 2004 Embedded Edge, LLC
5 * 5 *
6 * $Id: au1550nd.c,v 1.12 2005/09/23 01:44:55 ppopov Exp $ 6 * $Id: au1550nd.c,v 1.13 2005/11/07 11:14:30 gleixner Exp $
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -25,10 +25,10 @@
25#else 25#else
26#include <asm/au1000.h> 26#include <asm/au1000.h>
27#ifdef CONFIG_MIPS_PB1550 27#ifdef CONFIG_MIPS_PB1550
28#include <asm/pb1550.h> 28#include <asm/pb1550.h>
29#endif 29#endif
30#ifdef CONFIG_MIPS_DB1550 30#ifdef CONFIG_MIPS_DB1550
31#include <asm/db1x00.h> 31#include <asm/db1x00.h>
32#endif 32#endif
33#endif 33#endif
34 34
@@ -43,12 +43,12 @@ static int nand_width = 1; /* default x8*/
43 * Define partitions for flash device 43 * Define partitions for flash device
44 */ 44 */
45const static struct mtd_partition partition_info[] = { 45const static struct mtd_partition partition_info[] = {
46 { 46 {
47 .name = "NAND FS 0", 47 .name = "NAND FS 0",
48 .offset = 0, 48 .offset = 0,
49 .size = 8*1024*1024 49 .size = 8*1024*1024
50 }, 50 },
51 { 51 {
52 .name = "NAND FS 1", 52 .name = "NAND FS 1",
53 .offset = MTDPART_OFS_APPEND, 53 .offset = MTDPART_OFS_APPEND,
54 .size = MTDPART_SIZ_FULL 54 .size = MTDPART_SIZ_FULL
@@ -89,7 +89,7 @@ static void au_write_byte(struct mtd_info *mtd, u_char byte)
89 * au_read_byte16 - read one byte endianess aware from the chip 89 * au_read_byte16 - read one byte endianess aware from the chip
90 * @mtd: MTD device structure 90 * @mtd: MTD device structure
91 * 91 *
92 * read function for 16bit buswith with 92 * read function for 16bit buswith with
93 * endianess conversion 93 * endianess conversion
94 */ 94 */
95static u_char au_read_byte16(struct mtd_info *mtd) 95static u_char au_read_byte16(struct mtd_info *mtd)
@@ -119,7 +119,7 @@ static void au_write_byte16(struct mtd_info *mtd, u_char byte)
119 * au_read_word - read one word from the chip 119 * au_read_word - read one word from the chip
120 * @mtd: MTD device structure 120 * @mtd: MTD device structure
121 * 121 *
122 * read function for 16bit buswith without 122 * read function for 16bit buswith without
123 * endianess conversion 123 * endianess conversion
124 */ 124 */
125static u16 au_read_word(struct mtd_info *mtd) 125static u16 au_read_word(struct mtd_info *mtd)
@@ -135,7 +135,7 @@ static u16 au_read_word(struct mtd_info *mtd)
135 * @mtd: MTD device structure 135 * @mtd: MTD device structure
136 * @word: data word to write 136 * @word: data word to write
137 * 137 *
138 * write function for 16bit buswith without 138 * write function for 16bit buswith without
139 * endianess conversion 139 * endianess conversion
140 */ 140 */
141static void au_write_word(struct mtd_info *mtd, u16 word) 141static void au_write_word(struct mtd_info *mtd, u16 word)
@@ -165,7 +165,7 @@ static void au_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
165} 165}
166 166
167/** 167/**
168 * au_read_buf - read chip data into buffer 168 * au_read_buf - read chip data into buffer
169 * @mtd: MTD device structure 169 * @mtd: MTD device structure
170 * @buf: buffer to store date 170 * @buf: buffer to store date
171 * @len: number of bytes to read 171 * @len: number of bytes to read
@@ -179,12 +179,12 @@ static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len)
179 179
180 for (i=0; i<len; i++) { 180 for (i=0; i<len; i++) {
181 buf[i] = readb(this->IO_ADDR_R); 181 buf[i] = readb(this->IO_ADDR_R);
182 au_sync(); 182 au_sync();
183 } 183 }
184} 184}
185 185
186/** 186/**
187 * au_verify_buf - Verify chip data against buffer 187 * au_verify_buf - Verify chip data against buffer
188 * @mtd: MTD device structure 188 * @mtd: MTD device structure
189 * @buf: buffer containing the data to compare 189 * @buf: buffer containing the data to compare
190 * @len: number of bytes to compare 190 * @len: number of bytes to compare
@@ -219,16 +219,16 @@ static void au_write_buf16(struct mtd_info *mtd, const u_char *buf, int len)
219 struct nand_chip *this = mtd->priv; 219 struct nand_chip *this = mtd->priv;
220 u16 *p = (u16 *) buf; 220 u16 *p = (u16 *) buf;
221 len >>= 1; 221 len >>= 1;
222 222
223 for (i=0; i<len; i++) { 223 for (i=0; i<len; i++) {
224 writew(p[i], this->IO_ADDR_W); 224 writew(p[i], this->IO_ADDR_W);
225 au_sync(); 225 au_sync();
226 } 226 }
227 227
228} 228}
229 229
230/** 230/**
231 * au_read_buf16 - read chip data into buffer 231 * au_read_buf16 - read chip data into buffer
232 * @mtd: MTD device structure 232 * @mtd: MTD device structure
233 * @buf: buffer to store date 233 * @buf: buffer to store date
234 * @len: number of bytes to read 234 * @len: number of bytes to read
@@ -249,7 +249,7 @@ static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
249} 249}
250 250
251/** 251/**
252 * au_verify_buf16 - Verify chip data against buffer 252 * au_verify_buf16 - Verify chip data against buffer
253 * @mtd: MTD device structure 253 * @mtd: MTD device structure
254 * @buf: buffer containing the data to compare 254 * @buf: buffer containing the data to compare
255 * @len: number of bytes to compare 255 * @len: number of bytes to compare
@@ -282,26 +282,26 @@ static void au1550_hwcontrol(struct mtd_info *mtd, int cmd)
282 case NAND_CTL_CLRCLE: this->IO_ADDR_W = p_nand + MEM_STNAND_DATA; break; 282 case NAND_CTL_CLRCLE: this->IO_ADDR_W = p_nand + MEM_STNAND_DATA; break;
283 283
284 case NAND_CTL_SETALE: this->IO_ADDR_W = p_nand + MEM_STNAND_ADDR; break; 284 case NAND_CTL_SETALE: this->IO_ADDR_W = p_nand + MEM_STNAND_ADDR; break;
285 case NAND_CTL_CLRALE: 285 case NAND_CTL_CLRALE:
286 this->IO_ADDR_W = p_nand + MEM_STNAND_DATA; 286 this->IO_ADDR_W = p_nand + MEM_STNAND_DATA;
287 /* FIXME: Nobody knows why this is neccecary, 287 /* FIXME: Nobody knows why this is neccecary,
288 * but it works only that way */ 288 * but it works only that way */
289 udelay(1); 289 udelay(1);
290 break; 290 break;
291 291
292 case NAND_CTL_SETNCE: 292 case NAND_CTL_SETNCE:
293 /* assert (force assert) chip enable */ 293 /* assert (force assert) chip enable */
294 au_writel((1<<(4+NAND_CS)) , MEM_STNDCTL); break; 294 au_writel((1<<(4+NAND_CS)) , MEM_STNDCTL); break;
295 break; 295 break;
296 296
297 case NAND_CTL_CLRNCE: 297 case NAND_CTL_CLRNCE:
298 /* deassert chip enable */ 298 /* deassert chip enable */
299 au_writel(0, MEM_STNDCTL); break; 299 au_writel(0, MEM_STNDCTL); break;
300 break; 300 break;
301 } 301 }
302 302
303 this->IO_ADDR_R = this->IO_ADDR_W; 303 this->IO_ADDR_R = this->IO_ADDR_W;
304 304
305 /* Drain the writebuffer */ 305 /* Drain the writebuffer */
306 au_sync(); 306 au_sync();
307} 307}
@@ -325,7 +325,7 @@ int __init au1xxx_nand_init (void)
325 u32 nand_phys; 325 u32 nand_phys;
326 326
327 /* Allocate memory for MTD device structure and private data */ 327 /* Allocate memory for MTD device structure and private data */
328 au1550_mtd = kmalloc (sizeof(struct mtd_info) + 328 au1550_mtd = kmalloc (sizeof(struct mtd_info) +
329 sizeof (struct nand_chip), GFP_KERNEL); 329 sizeof (struct nand_chip), GFP_KERNEL);
330 if (!au1550_mtd) { 330 if (!au1550_mtd) {
331 printk ("Unable to allocate NAND MTD dev structure.\n"); 331 printk ("Unable to allocate NAND MTD dev structure.\n");
@@ -345,7 +345,7 @@ int __init au1xxx_nand_init (void)
345 345
346 /* disable interrupts */ 346 /* disable interrupts */
347 au_writel(au_readl(MEM_STNDCTL) & ~(1<<8), MEM_STNDCTL); 347 au_writel(au_readl(MEM_STNDCTL) & ~(1<<8), MEM_STNDCTL);
348 348
349 /* disable NAND boot */ 349 /* disable NAND boot */
350 au_writel(au_readl(MEM_STNDCTL) & ~(1<<0), MEM_STNDCTL); 350 au_writel(au_readl(MEM_STNDCTL) & ~(1<<0), MEM_STNDCTL);
351 351
@@ -353,7 +353,7 @@ int __init au1xxx_nand_init (void)
353 /* set gpio206 high */ 353 /* set gpio206 high */
354 au_writel(au_readl(GPIO2_DIR) & ~(1<<6), GPIO2_DIR); 354 au_writel(au_readl(GPIO2_DIR) & ~(1<<6), GPIO2_DIR);
355 355
356 boot_swapboot = (au_readl(MEM_STSTAT) & (0x7<<1)) | 356 boot_swapboot = (au_readl(MEM_STSTAT) & (0x7<<1)) |
357 ((bcsr->status >> 6) & 0x1); 357 ((bcsr->status >> 6) & 0x1);
358 switch (boot_swapboot) { 358 switch (boot_swapboot) {
359 case 0: 359 case 0:
@@ -402,7 +402,7 @@ int __init au1xxx_nand_init (void)
402 au_writel(NAND_STADDR, MEM_STADDR3); 402 au_writel(NAND_STADDR, MEM_STADDR3);
403 } 403 }
404#endif 404#endif
405 405
406 /* Locate NAND chip-select in order to determine NAND phys address */ 406 /* Locate NAND chip-select in order to determine NAND phys address */
407 mem_staddr = 0x00000000; 407 mem_staddr = 0x00000000;
408 if (((au_readl(MEM_STCFG0) & 0x7) == 0x5) && (NAND_CS == 0)) 408 if (((au_readl(MEM_STCFG0) & 0x7) == 0x5) && (NAND_CS == 0))
@@ -438,7 +438,7 @@ int __init au1xxx_nand_init (void)
438 this->hwcontrol = au1550_hwcontrol; 438 this->hwcontrol = au1550_hwcontrol;
439 this->dev_ready = au1550_device_ready; 439 this->dev_ready = au1550_device_ready;
440 /* 30 us command delay time */ 440 /* 30 us command delay time */
441 this->chip_delay = 30; 441 this->chip_delay = 30;
442 this->eccmode = NAND_ECC_SOFT; 442 this->eccmode = NAND_ECC_SOFT;
443 443
444 this->options = NAND_NO_AUTOINCR; 444 this->options = NAND_NO_AUTOINCR;
@@ -467,7 +467,7 @@ int __init au1xxx_nand_init (void)
467 467
468 outio: 468 outio:
469 iounmap ((void *)p_nand); 469 iounmap ((void *)p_nand);
470 470
471 outmem: 471 outmem:
472 kfree (au1550_mtd); 472 kfree (au1550_mtd);
473 return retval; 473 return retval;