aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:25:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:25:48 -0400
commit7e97b28309edc5669ced2bb1371704e8f8d084e3 (patch)
tree9605694b00b4233a730ad86ea6d395cf59efc905 /drivers/mtd/devices
parent5421d059068341b3f21df1a21c2ba9175e55ebef (diff)
parent3887ed5231fb6f339f36c3a0297c996cd1a1dad9 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (82 commits) [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash [MTD] m25p80: add FAST_READ access support to M25Pxx [MTD] [NAND] bf5xx_nand: Avoid crash if bfin_mac is installed. [MTD] [NAND] at91_nand: control NCE signal [MTD] [NAND] AT91 hardware ECC compile fix for at91sam9263 / at91sam9260 [MTD] [NAND] Hardware ECC controller on at91sam9263 / at91sam9260 [JFFS2] Introduce dbg_readinode2 log level, use it to shut read_dnode() up [JFFS2] Fix jffs2_reserve_space() when all blocks are pending erasure. [JFFS2] Add erase_checking_list to hold blocks being marked. UBI: add a message [JFFS2] Return values of jffs2_block_check_erase error paths [MTD] Clean up AR7 partition map support [MTD] [NOR] Fix Intel CFI driver for collie flash [JFFS2] Finally remove redundant ref->__totlen field. [JFFS2] Honour TEST_TOTLEN macro in debugging code. ref->__totlen is going! [JFFS2] Add paranoia debugging for superblock counts [JFFS2] Fix free space leak with in-band cleanmarkers [JFFS2] Self-sufficient #includes in jffs2_fs_i.h: include <linux/mutex.h> [MTD] [NAND] Verify probe by retrying to checking the results match [MTD] [NAND] S3C2410 Allow ECC disable to be specified by the board ...
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/Kconfig7
-rw-r--r--drivers/mtd/devices/block2mtd.c10
-rw-r--r--drivers/mtd/devices/lart.c16
-rw-r--r--drivers/mtd/devices/m25p80.c40
-rw-r--r--drivers/mtd/devices/mtdram.c1
-rw-r--r--drivers/mtd/devices/phram.c2
6 files changed, 48 insertions, 28 deletions
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 811d56fd890f..35ed1103dbb2 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -77,6 +77,13 @@ config MTD_M25P80
77 if you want to specify device partitioning or to use a device which 77 if you want to specify device partitioning or to use a device which
78 doesn't support the JEDEC ID instruction. 78 doesn't support the JEDEC ID instruction.
79 79
80config M25PXX_USE_FAST_READ
81 bool "Use FAST_READ OPCode allowing SPI CLK <= 50MHz"
82 depends on MTD_M25P80
83 default y
84 help
85 This option enables FAST_READ access supported by ST M25Pxx.
86
80config MTD_SLRAM 87config MTD_SLRAM
81 tristate "Uncached system RAM" 88 tristate "Uncached system RAM"
82 help 89 help
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index ad1880c67518..519d942e7940 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -305,7 +305,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
305 } 305 }
306 list_add(&dev->list, &blkmtd_device_list); 306 list_add(&dev->list, &blkmtd_device_list);
307 INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index, 307 INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index,
308 dev->mtd.name + strlen("blkmtd: "), 308 dev->mtd.name + strlen("block2mtd: "),
309 dev->mtd.erasesize >> 10, dev->mtd.erasesize); 309 dev->mtd.erasesize >> 10, dev->mtd.erasesize);
310 return dev; 310 return dev;
311 311
@@ -366,9 +366,9 @@ static inline void kill_final_newline(char *str)
366} 366}
367 367
368 368
369#define parse_err(fmt, args...) do { \ 369#define parse_err(fmt, args...) do { \
370 ERROR("block2mtd: " fmt "\n", ## args); \ 370 ERROR(fmt, ## args); \
371 return 0; \ 371 return 0; \
372} while (0) 372} while (0)
373 373
374#ifndef MODULE 374#ifndef MODULE
@@ -473,7 +473,7 @@ static void __devexit block2mtd_exit(void)
473 block2mtd_sync(&dev->mtd); 473 block2mtd_sync(&dev->mtd);
474 del_mtd_device(&dev->mtd); 474 del_mtd_device(&dev->mtd);
475 INFO("mtd%d: [%s] removed", dev->mtd.index, 475 INFO("mtd%d: [%s] removed", dev->mtd.index,
476 dev->mtd.name + strlen("blkmtd: ")); 476 dev->mtd.name + strlen("block2mtd: "));
477 list_del(&dev->list); 477 list_del(&dev->list);
478 block2mtd_free_device(dev); 478 block2mtd_free_device(dev);
479 } 479 }
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c
index 99fd210feaec..1d324e5c412d 100644
--- a/drivers/mtd/devices/lart.c
+++ b/drivers/mtd/devices/lart.c
@@ -275,7 +275,7 @@ static __u8 read8 (__u32 offset)
275{ 275{
276 volatile __u8 *data = (__u8 *) (FLASH_OFFSET + offset); 276 volatile __u8 *data = (__u8 *) (FLASH_OFFSET + offset);
277#ifdef LART_DEBUG 277#ifdef LART_DEBUG
278 printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.2x\n",__FUNCTION__,offset,*data); 278 printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.2x\n", __func__, offset, *data);
279#endif 279#endif
280 return (*data); 280 return (*data);
281} 281}
@@ -284,7 +284,7 @@ static __u32 read32 (__u32 offset)
284{ 284{
285 volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset); 285 volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset);
286#ifdef LART_DEBUG 286#ifdef LART_DEBUG
287 printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.8x\n",__FUNCTION__,offset,*data); 287 printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.8x\n", __func__, offset, *data);
288#endif 288#endif
289 return (*data); 289 return (*data);
290} 290}
@@ -294,7 +294,7 @@ static void write32 (__u32 x,__u32 offset)
294 volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset); 294 volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset);
295 *data = x; 295 *data = x;
296#ifdef LART_DEBUG 296#ifdef LART_DEBUG
297 printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n",__FUNCTION__,offset,*data); 297 printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n", __func__, offset, *data);
298#endif 298#endif
299} 299}
300 300
@@ -337,7 +337,7 @@ static inline int erase_block (__u32 offset)
337 __u32 status; 337 __u32 status;
338 338
339#ifdef LART_DEBUG 339#ifdef LART_DEBUG
340 printk (KERN_DEBUG "%s(): 0x%.8x\n",__FUNCTION__,offset); 340 printk (KERN_DEBUG "%s(): 0x%.8x\n", __func__, offset);
341#endif 341#endif
342 342
343 /* erase and confirm */ 343 /* erase and confirm */
@@ -371,7 +371,7 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
371 int i,first; 371 int i,first;
372 372
373#ifdef LART_DEBUG 373#ifdef LART_DEBUG
374 printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n",__FUNCTION__,instr->addr,instr->len); 374 printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n", __func__, instr->addr, instr->len);
375#endif 375#endif
376 376
377 /* sanity checks */ 377 /* sanity checks */
@@ -442,7 +442,7 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
442static int flash_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf) 442static int flash_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf)
443{ 443{
444#ifdef LART_DEBUG 444#ifdef LART_DEBUG
445 printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n",__FUNCTION__,(__u32) from,len); 445 printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n", __func__, (__u32)from, len);
446#endif 446#endif
447 447
448 /* sanity checks */ 448 /* sanity checks */
@@ -488,7 +488,7 @@ static inline int write_dword (__u32 offset,__u32 x)
488 __u32 status; 488 __u32 status;
489 489
490#ifdef LART_DEBUG 490#ifdef LART_DEBUG
491 printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n",__FUNCTION__,offset,x); 491 printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n", __func__, offset, x);
492#endif 492#endif
493 493
494 /* setup writing */ 494 /* setup writing */
@@ -524,7 +524,7 @@ static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen
524 int i,n; 524 int i,n;
525 525
526#ifdef LART_DEBUG 526#ifdef LART_DEBUG
527 printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n",__FUNCTION__,(__u32) to,len); 527 printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len);
528#endif 528#endif
529 529
530 *retlen = 0; 530 *retlen = 0;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 98df5bcc02f3..25efd331ef28 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -33,7 +33,7 @@
33/* Flash opcodes. */ 33/* Flash opcodes. */
34#define OPCODE_WREN 0x06 /* Write enable */ 34#define OPCODE_WREN 0x06 /* Write enable */
35#define OPCODE_RDSR 0x05 /* Read status register */ 35#define OPCODE_RDSR 0x05 /* Read status register */
36#define OPCODE_READ 0x03 /* Read data bytes (low frequency) */ 36#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */
37#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ 37#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */
38#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ 38#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */
39#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */ 39#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
@@ -52,7 +52,15 @@
52 52
53/* Define max times to check status register before we give up. */ 53/* Define max times to check status register before we give up. */
54#define MAX_READY_WAIT_COUNT 100000 54#define MAX_READY_WAIT_COUNT 100000
55#define CMD_SIZE 4
55 56
57#ifdef CONFIG_M25PXX_USE_FAST_READ
58#define OPCODE_READ OPCODE_FAST_READ
59#define FAST_READ_DUMMY_BYTE 1
60#else
61#define OPCODE_READ OPCODE_NORM_READ
62#define FAST_READ_DUMMY_BYTE 0
63#endif
56 64
57#ifdef CONFIG_MTD_PARTITIONS 65#ifdef CONFIG_MTD_PARTITIONS
58#define mtd_has_partitions() (1) 66#define mtd_has_partitions() (1)
@@ -68,7 +76,7 @@ struct m25p {
68 struct mtd_info mtd; 76 struct mtd_info mtd;
69 unsigned partitioned:1; 77 unsigned partitioned:1;
70 u8 erase_opcode; 78 u8 erase_opcode;
71 u8 command[4]; 79 u8 command[CMD_SIZE + FAST_READ_DUMMY_BYTE];
72}; 80};
73 81
74static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd) 82static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
@@ -151,7 +159,7 @@ static int wait_till_ready(struct m25p *flash)
151static int erase_sector(struct m25p *flash, u32 offset) 159static int erase_sector(struct m25p *flash, u32 offset)
152{ 160{
153 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB at 0x%08x\n", 161 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB at 0x%08x\n",
154 flash->spi->dev.bus_id, __FUNCTION__, 162 flash->spi->dev.bus_id, __func__,
155 flash->mtd.erasesize / 1024, offset); 163 flash->mtd.erasesize / 1024, offset);
156 164
157 /* Wait until finished previous write command. */ 165 /* Wait until finished previous write command. */
@@ -167,7 +175,7 @@ static int erase_sector(struct m25p *flash, u32 offset)
167 flash->command[2] = offset >> 8; 175 flash->command[2] = offset >> 8;
168 flash->command[3] = offset; 176 flash->command[3] = offset;
169 177
170 spi_write(flash->spi, flash->command, sizeof(flash->command)); 178 spi_write(flash->spi, flash->command, CMD_SIZE);
171 179
172 return 0; 180 return 0;
173} 181}
@@ -188,7 +196,7 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
188 u32 addr,len; 196 u32 addr,len;
189 197
190 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %d\n", 198 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %d\n",
191 flash->spi->dev.bus_id, __FUNCTION__, "at", 199 flash->spi->dev.bus_id, __func__, "at",
192 (u32)instr->addr, instr->len); 200 (u32)instr->addr, instr->len);
193 201
194 /* sanity checks */ 202 /* sanity checks */
@@ -240,7 +248,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
240 struct spi_message m; 248 struct spi_message m;
241 249
242 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n", 250 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
243 flash->spi->dev.bus_id, __FUNCTION__, "from", 251 flash->spi->dev.bus_id, __func__, "from",
244 (u32)from, len); 252 (u32)from, len);
245 253
246 /* sanity checks */ 254 /* sanity checks */
@@ -253,8 +261,12 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
253 spi_message_init(&m); 261 spi_message_init(&m);
254 memset(t, 0, (sizeof t)); 262 memset(t, 0, (sizeof t));
255 263
264 /* NOTE:
265 * OPCODE_FAST_READ (if available) is faster.
266 * Should add 1 byte DUMMY_BYTE.
267 */
256 t[0].tx_buf = flash->command; 268 t[0].tx_buf = flash->command;
257 t[0].len = sizeof(flash->command); 269 t[0].len = CMD_SIZE + FAST_READ_DUMMY_BYTE;
258 spi_message_add_tail(&t[0], &m); 270 spi_message_add_tail(&t[0], &m);
259 271
260 t[1].rx_buf = buf; 272 t[1].rx_buf = buf;
@@ -287,7 +299,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
287 299
288 spi_sync(flash->spi, &m); 300 spi_sync(flash->spi, &m);
289 301
290 *retlen = m.actual_length - sizeof(flash->command); 302 *retlen = m.actual_length - CMD_SIZE - FAST_READ_DUMMY_BYTE;
291 303
292 mutex_unlock(&flash->lock); 304 mutex_unlock(&flash->lock);
293 305
@@ -308,7 +320,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
308 struct spi_message m; 320 struct spi_message m;
309 321
310 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n", 322 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
311 flash->spi->dev.bus_id, __FUNCTION__, "to", 323 flash->spi->dev.bus_id, __func__, "to",
312 (u32)to, len); 324 (u32)to, len);
313 325
314 if (retlen) 326 if (retlen)
@@ -325,7 +337,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
325 memset(t, 0, (sizeof t)); 337 memset(t, 0, (sizeof t));
326 338
327 t[0].tx_buf = flash->command; 339 t[0].tx_buf = flash->command;
328 t[0].len = sizeof(flash->command); 340 t[0].len = CMD_SIZE;
329 spi_message_add_tail(&t[0], &m); 341 spi_message_add_tail(&t[0], &m);
330 342
331 t[1].tx_buf = buf; 343 t[1].tx_buf = buf;
@@ -354,7 +366,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
354 366
355 spi_sync(flash->spi, &m); 367 spi_sync(flash->spi, &m);
356 368
357 *retlen = m.actual_length - sizeof(flash->command); 369 *retlen = m.actual_length - CMD_SIZE;
358 } else { 370 } else {
359 u32 i; 371 u32 i;
360 372
@@ -364,7 +376,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
364 t[1].len = page_size; 376 t[1].len = page_size;
365 spi_sync(flash->spi, &m); 377 spi_sync(flash->spi, &m);
366 378
367 *retlen = m.actual_length - sizeof(flash->command); 379 *retlen = m.actual_length - CMD_SIZE;
368 380
369 /* write everything in PAGESIZE chunks */ 381 /* write everything in PAGESIZE chunks */
370 for (i = page_size; i < len; i += page_size) { 382 for (i = page_size; i < len; i += page_size) {
@@ -387,8 +399,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
387 spi_sync(flash->spi, &m); 399 spi_sync(flash->spi, &m);
388 400
389 if (retlen) 401 if (retlen)
390 *retlen += m.actual_length 402 *retlen += m.actual_length - CMD_SIZE;
391 - sizeof(flash->command);
392 } 403 }
393 } 404 }
394 405
@@ -435,6 +446,7 @@ static struct flash_info __devinitdata m25p_data [] = {
435 { "at25fs040", 0x1f6604, 64 * 1024, 8, SECT_4K, }, 446 { "at25fs040", 0x1f6604, 64 * 1024, 8, SECT_4K, },
436 447
437 { "at25df041a", 0x1f4401, 64 * 1024, 8, SECT_4K, }, 448 { "at25df041a", 0x1f4401, 64 * 1024, 8, SECT_4K, },
449 { "at25df641", 0x1f4800, 64 * 1024, 128, SECT_4K, },
438 450
439 { "at26f004", 0x1f0400, 64 * 1024, 8, SECT_4K, }, 451 { "at26f004", 0x1f0400, 64 * 1024, 8, SECT_4K, },
440 { "at26df081a", 0x1f4501, 64 * 1024, 16, SECT_4K, }, 452 { "at26df081a", 0x1f4501, 64 * 1024, 16, SECT_4K, },
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index e427c82d5f4c..bf485ff49457 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/mtd/compatmac.h> 18#include <linux/mtd/compatmac.h>
19#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
20#include <linux/mtd/mtdram.h>
20 21
21static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE; 22static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE;
22static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE; 23static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE;
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 180298b92a7a..5f960182da95 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -282,7 +282,7 @@ static int phram_setup(const char *val, struct kernel_param *kp)
282} 282}
283 283
284module_param_call(phram, phram_setup, NULL, NULL, 000); 284module_param_call(phram, phram_setup, NULL, NULL, 000);
285MODULE_PARM_DESC(phram,"Memory region to map. \"map=<name>,<start>,<length>\""); 285MODULE_PARM_DESC(phram, "Memory region to map. \"phram=<name>,<start>,<length>\"");
286 286
287 287
288static int __init init_phram(void) 288static int __init init_phram(void)