aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/Kconfig1
-rw-r--r--drivers/mtd/devices/Makefile1
-rw-r--r--drivers/mtd/devices/block2mtd.c6
-rw-r--r--drivers/mtd/devices/doc2000.c2
-rw-r--r--drivers/mtd/devices/doc2001.c2
-rw-r--r--drivers/mtd/devices/doc2001plus.c2
-rw-r--r--drivers/mtd/devices/docecc.c2
-rw-r--r--drivers/mtd/devices/docprobe.c5
-rw-r--r--drivers/mtd/devices/lart.c2
-rw-r--r--drivers/mtd/devices/m25p80.c22
-rw-r--r--drivers/mtd/devices/ms02-nv.c2
-rw-r--r--drivers/mtd/devices/ms02-nv.h2
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c135
-rw-r--r--drivers/mtd/devices/mtdram.c1
-rw-r--r--drivers/mtd/devices/phram.c2
-rw-r--r--drivers/mtd/devices/pmc551.c2
-rw-r--r--drivers/mtd/devices/slram.c2
17 files changed, 143 insertions, 48 deletions
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 35ed1103dbb2..9c613f06623c 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -1,5 +1,4 @@
1# drivers/mtd/maps/Kconfig 1# drivers/mtd/maps/Kconfig
2# $Id: Kconfig,v 1.18 2005/11/07 11:14:24 gleixner Exp $
3 2
4menu "Self-contained MTD device drivers" 3menu "Self-contained MTD device drivers"
5 depends on MTD!=n 4 depends on MTD!=n
diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile
index 0f788d5c4bf8..0993d5cf3923 100644
--- a/drivers/mtd/devices/Makefile
+++ b/drivers/mtd/devices/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# linux/drivers/devices/Makefile 2# linux/drivers/devices/Makefile
3# 3#
4# $Id: Makefile.common,v 1.7 2004/12/22 17:51:15 joern Exp $
5 4
6obj-$(CONFIG_MTD_DOC2000) += doc2000.o 5obj-$(CONFIG_MTD_DOC2000) += doc2000.o
7obj-$(CONFIG_MTD_DOC2001) += doc2001.o 6obj-$(CONFIG_MTD_DOC2001) += doc2001.o
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index 7b72a1b36115..91fbba767635 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: block2mtd.c,v 1.30 2005/11/29 14:48:32 gleixner Exp $
3 *
4 * block2mtd.c - create an mtd from a block device 2 * block2mtd.c - create an mtd from a block device
5 * 3 *
6 * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> 4 * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk>
@@ -20,9 +18,6 @@
20#include <linux/mutex.h> 18#include <linux/mutex.h>
21#include <linux/mount.h> 19#include <linux/mount.h>
22 20
23#define VERSION "$Revision: 1.30 $"
24
25
26#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) 21#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
27#define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args) 22#define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
28 23
@@ -453,7 +448,6 @@ MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
453static int __init block2mtd_init(void) 448static int __init block2mtd_init(void)
454{ 449{
455 int ret = 0; 450 int ret = 0;
456 INFO("version " VERSION);
457 451
458#ifndef MODULE 452#ifndef MODULE
459 if (strlen(block2mtd_paramline)) 453 if (strlen(block2mtd_paramline))
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
index 846989f292e3..50de839c77a9 100644
--- a/drivers/mtd/devices/doc2000.c
+++ b/drivers/mtd/devices/doc2000.c
@@ -3,8 +3,6 @@
3 * Linux driver for Disk-On-Chip 2000 and Millennium 3 * Linux driver for Disk-On-Chip 2000 and Millennium
4 * (c) 1999 Machine Vision Holdings, Inc. 4 * (c) 1999 Machine Vision Holdings, Inc.
5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
6 *
7 * $Id: doc2000.c,v 1.67 2005/11/07 11:14:24 gleixner Exp $
8 */ 6 */
9 7
10#include <linux/kernel.h> 8#include <linux/kernel.h>
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c
index 6413efc045e0..e32c568c1145 100644
--- a/drivers/mtd/devices/doc2001.c
+++ b/drivers/mtd/devices/doc2001.c
@@ -3,8 +3,6 @@
3 * Linux driver for Disk-On-Chip Millennium 3 * Linux driver for Disk-On-Chip Millennium
4 * (c) 1999 Machine Vision Holdings, Inc. 4 * (c) 1999 Machine Vision Holdings, Inc.
5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
6 *
7 * $Id: doc2001.c,v 1.49 2005/11/07 11:14:24 gleixner Exp $
8 */ 6 */
9 7
10#include <linux/kernel.h> 8#include <linux/kernel.h>
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c
index 83be3461658f..d853f891b586 100644
--- a/drivers/mtd/devices/doc2001plus.c
+++ b/drivers/mtd/devices/doc2001plus.c
@@ -6,8 +6,6 @@
6 * (c) 1999 Machine Vision Holdings, Inc. 6 * (c) 1999 Machine Vision Holdings, Inc.
7 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 7 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
8 * 8 *
9 * $Id: doc2001plus.c,v 1.14 2005/11/07 11:14:24 gleixner Exp $
10 *
11 * Released under GPL 9 * Released under GPL
12 */ 10 */
13 11
diff --git a/drivers/mtd/devices/docecc.c b/drivers/mtd/devices/docecc.c
index fd8a8daba3a8..874e51b110a2 100644
--- a/drivers/mtd/devices/docecc.c
+++ b/drivers/mtd/devices/docecc.c
@@ -7,8 +7,6 @@
7 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 7 * Author: Fabrice Bellard (fabrice.bellard@netgem.com)
8 * Copyright (C) 2000 Netgem S.A. 8 * Copyright (C) 2000 Netgem S.A.
9 * 9 *
10 * $Id: docecc.c,v 1.7 2005/11/07 11:14:25 gleixner Exp $
11 *
12 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c
index d8cc94ec4e50..6e62922942b1 100644
--- a/drivers/mtd/devices/docprobe.c
+++ b/drivers/mtd/devices/docprobe.c
@@ -4,9 +4,6 @@
4/* (C) 1999 Machine Vision Holdings, Inc. */ 4/* (C) 1999 Machine Vision Holdings, Inc. */
5/* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ 5/* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */
6 6
7/* $Id: docprobe.c,v 1.46 2005/11/07 11:14:25 gleixner Exp $ */
8
9
10 7
11/* DOC_PASSIVE_PROBE: 8/* DOC_PASSIVE_PROBE:
12 In order to ensure that the BIOS checksum is correct at boot time, and 9 In order to ensure that the BIOS checksum is correct at boot time, and
@@ -79,8 +76,6 @@ static unsigned long __initdata doc_locations[] = {
79 0xe0000, 0xe2000, 0xe4000, 0xe6000, 76 0xe0000, 0xe2000, 0xe4000, 0xe6000,
80 0xe8000, 0xea000, 0xec000, 0xee000, 77 0xe8000, 0xea000, 0xec000, 0xee000,
81#endif /* CONFIG_MTD_DOCPROBE_HIGH */ 78#endif /* CONFIG_MTD_DOCPROBE_HIGH */
82#elif defined(__PPC__)
83 0xe4000000,
84#else 79#else
85#warning Unknown architecture for DiskOnChip. No default probe locations defined 80#warning Unknown architecture for DiskOnChip. No default probe locations defined
86#endif 81#endif
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c
index 1d324e5c412d..f4bda4cee495 100644
--- a/drivers/mtd/devices/lart.c
+++ b/drivers/mtd/devices/lart.c
@@ -2,8 +2,6 @@
2/* 2/*
3 * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART. 3 * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART.
4 * 4 *
5 * $Id: lart.c,v 1.9 2005/11/07 11:14:25 gleixner Exp $
6 *
7 * Author: Abraham vd Merwe <abraham@2d3d.co.za> 5 * Author: Abraham vd Merwe <abraham@2d3d.co.za>
8 * 6 *
9 * Copyright (c) 2001, 2d3D, Inc. 7 * Copyright (c) 2001, 2d3D, Inc.
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index b402269301f6..b35c3333e210 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -33,6 +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_WRSR 0x01 /* Write status register 1 byte */
36#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ 37#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */
37#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ 38#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */
38#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ 39#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */
@@ -112,6 +113,17 @@ static int read_sr(struct m25p *flash)
112 return val; 113 return val;
113} 114}
114 115
116/*
117 * Write status register 1 byte
118 * Returns negative if error occurred.
119 */
120static int write_sr(struct m25p *flash, u8 val)
121{
122 flash->command[0] = OPCODE_WRSR;
123 flash->command[1] = val;
124
125 return spi_write(flash->spi, flash->command, 2);
126}
115 127
116/* 128/*
117 * Set write enable latch with Write Enable command. 129 * Set write enable latch with Write Enable command.
@@ -589,6 +601,16 @@ static int __devinit m25p_probe(struct spi_device *spi)
589 mutex_init(&flash->lock); 601 mutex_init(&flash->lock);
590 dev_set_drvdata(&spi->dev, flash); 602 dev_set_drvdata(&spi->dev, flash);
591 603
604 /*
605 * Atmel serial flash tend to power up
606 * with the software protection bits set
607 */
608
609 if (info->jedec_id >> 16 == 0x1f) {
610 write_enable(flash);
611 write_sr(flash, 0);
612 }
613
592 if (data && data->name) 614 if (data && data->name)
593 flash->mtd.name = data->name; 615 flash->mtd.name = data->name;
594 else 616 else
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c
index 9cff119a2024..6a9a24a80a6d 100644
--- a/drivers/mtd/devices/ms02-nv.c
+++ b/drivers/mtd/devices/ms02-nv.c
@@ -5,8 +5,6 @@
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 *
9 * $Id: ms02-nv.c,v 1.11 2005/11/14 13:41:47 macro Exp $
10 */ 8 */
11 9
12#include <linux/init.h> 10#include <linux/init.h>
diff --git a/drivers/mtd/devices/ms02-nv.h b/drivers/mtd/devices/ms02-nv.h
index 8a6eef7cfee3..04deafd3a771 100644
--- a/drivers/mtd/devices/ms02-nv.h
+++ b/drivers/mtd/devices/ms02-nv.h
@@ -9,8 +9,6 @@
9 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 *
13 * $Id: ms02-nv.h,v 1.3 2003/08/19 09:25:36 dwmw2 Exp $
14 */ 12 */
15 13
16#include <linux/ioport.h> 14#include <linux/ioport.h>
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index b35e4813a3a5..54e36bfc2c3b 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -82,7 +82,7 @@
82 82
83 83
84struct dataflash { 84struct dataflash {
85 u8 command[4]; 85 uint8_t command[4];
86 char name[24]; 86 char name[24];
87 87
88 unsigned partitioned:1; 88 unsigned partitioned:1;
@@ -150,7 +150,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
150 struct spi_transfer x = { .tx_dma = 0, }; 150 struct spi_transfer x = { .tx_dma = 0, };
151 struct spi_message msg; 151 struct spi_message msg;
152 unsigned blocksize = priv->page_size << 3; 152 unsigned blocksize = priv->page_size << 3;
153 u8 *command; 153 uint8_t *command;
154 154
155 DEBUG(MTD_DEBUG_LEVEL2, "%s: erase addr=0x%x len 0x%x\n", 155 DEBUG(MTD_DEBUG_LEVEL2, "%s: erase addr=0x%x len 0x%x\n",
156 spi->dev.bus_id, 156 spi->dev.bus_id,
@@ -182,8 +182,8 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
182 pageaddr = pageaddr << priv->page_offset; 182 pageaddr = pageaddr << priv->page_offset;
183 183
184 command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE; 184 command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE;
185 command[1] = (u8)(pageaddr >> 16); 185 command[1] = (uint8_t)(pageaddr >> 16);
186 command[2] = (u8)(pageaddr >> 8); 186 command[2] = (uint8_t)(pageaddr >> 8);
187 command[3] = 0; 187 command[3] = 0;
188 188
189 DEBUG(MTD_DEBUG_LEVEL3, "ERASE %s: (%x) %x %x %x [%i]\n", 189 DEBUG(MTD_DEBUG_LEVEL3, "ERASE %s: (%x) %x %x %x [%i]\n",
@@ -234,7 +234,7 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len,
234 struct spi_transfer x[2] = { { .tx_dma = 0, }, }; 234 struct spi_transfer x[2] = { { .tx_dma = 0, }, };
235 struct spi_message msg; 235 struct spi_message msg;
236 unsigned int addr; 236 unsigned int addr;
237 u8 *command; 237 uint8_t *command;
238 int status; 238 int status;
239 239
240 DEBUG(MTD_DEBUG_LEVEL2, "%s: read 0x%x..0x%x\n", 240 DEBUG(MTD_DEBUG_LEVEL2, "%s: read 0x%x..0x%x\n",
@@ -274,9 +274,9 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len,
274 * fewer "don't care" bytes. Both buffers stay unchanged. 274 * fewer "don't care" bytes. Both buffers stay unchanged.
275 */ 275 */
276 command[0] = OP_READ_CONTINUOUS; 276 command[0] = OP_READ_CONTINUOUS;
277 command[1] = (u8)(addr >> 16); 277 command[1] = (uint8_t)(addr >> 16);
278 command[2] = (u8)(addr >> 8); 278 command[2] = (uint8_t)(addr >> 8);
279 command[3] = (u8)(addr >> 0); 279 command[3] = (uint8_t)(addr >> 0);
280 /* plus 4 "don't care" bytes */ 280 /* plus 4 "don't care" bytes */
281 281
282 status = spi_sync(priv->spi, &msg); 282 status = spi_sync(priv->spi, &msg);
@@ -311,7 +311,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
311 size_t remaining = len; 311 size_t remaining = len;
312 u_char *writebuf = (u_char *) buf; 312 u_char *writebuf = (u_char *) buf;
313 int status = -EINVAL; 313 int status = -EINVAL;
314 u8 *command; 314 uint8_t *command;
315 315
316 DEBUG(MTD_DEBUG_LEVEL2, "%s: write 0x%x..0x%x\n", 316 DEBUG(MTD_DEBUG_LEVEL2, "%s: write 0x%x..0x%x\n",
317 spi->dev.bus_id, (unsigned)to, (unsigned)(to + len)); 317 spi->dev.bus_id, (unsigned)to, (unsigned)(to + len));
@@ -487,7 +487,9 @@ add_dataflash(struct spi_device *spi, char *name,
487 device->write = dataflash_write; 487 device->write = dataflash_write;
488 device->priv = priv; 488 device->priv = priv;
489 489
490 dev_info(&spi->dev, "%s (%d KBytes)\n", name, device->size/1024); 490 dev_info(&spi->dev, "%s (%d KBytes) pagesize %d bytes, "
491 "erasesize %d bytes\n", name, device->size/1024,
492 pagesize, pagesize * 8); /* 8 pages = 1 block */
491 dev_set_drvdata(&spi->dev, priv); 493 dev_set_drvdata(&spi->dev, priv);
492 494
493 if (mtd_has_partitions()) { 495 if (mtd_has_partitions()) {
@@ -521,7 +523,7 @@ add_dataflash(struct spi_device *spi, char *name,
521 * 523 *
522 * Device Density ID code #Pages PageSize Offset 524 * Device Density ID code #Pages PageSize Offset
523 * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9 525 * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9
524 * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1025 264 9 526 * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1024 264 9
525 * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9 527 * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9
526 * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9 528 * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9
527 * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10 529 * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10
@@ -529,9 +531,114 @@ add_dataflash(struct spi_device *spi, char *name,
529 * AT45DB0642 64Mbit (8M) xx111xxx (0x3c) 8192 1056 11 531 * AT45DB0642 64Mbit (8M) xx111xxx (0x3c) 8192 1056 11
530 * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11 532 * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11
531 */ 533 */
534
535struct flash_info {
536 char *name;
537
538 /* JEDEC id zero means "no ID" (most older chips); otherwise it has
539 * a high byte of zero plus three data bytes: the manufacturer id,
540 * then a two byte device id.
541 */
542 uint32_t jedec_id;
543
544 /* The size listed here is what works with OPCODE_SE, which isn't
545 * necessarily called a "sector" by the vendor.
546 */
547 unsigned nr_pages;
548 uint16_t pagesize;
549 uint16_t pageoffset;
550
551 uint16_t flags;
552#define SUP_POW2PS 0x02
553#define IS_POW2PS 0x01
554};
555
556static struct flash_info __devinitdata dataflash_data [] = {
557
558 { "at45db011d", 0x1f2200, 512, 264, 9, SUP_POW2PS},
559 { "at45db011d", 0x1f2200, 512, 256, 8, SUP_POW2PS | IS_POW2PS},
560
561 { "at45db021d", 0x1f2300, 1024, 264, 9, SUP_POW2PS},
562 { "at45db021d", 0x1f2300, 1024, 256, 8, SUP_POW2PS | IS_POW2PS},
563
564 { "at45db041d", 0x1f2400, 2048, 264, 9, SUP_POW2PS},
565 { "at45db041d", 0x1f2400, 2048, 256, 8, SUP_POW2PS | IS_POW2PS},
566
567 { "at45db081d", 0x1f2500, 4096, 264, 9, SUP_POW2PS},
568 { "at45db081d", 0x1f2500, 4096, 256, 8, SUP_POW2PS | IS_POW2PS},
569
570 { "at45db161d", 0x1f2600, 4096, 528, 10, SUP_POW2PS},
571 { "at45db161d", 0x1f2600, 4096, 512, 9, SUP_POW2PS | IS_POW2PS},
572
573 { "at45db321c", 0x1f2700, 8192, 528, 10, },
574
575 { "at45db321d", 0x1f2701, 8192, 528, 10, SUP_POW2PS},
576 { "at45db321d", 0x1f2701, 8192, 512, 9, SUP_POW2PS | IS_POW2PS},
577
578 { "at45db641d", 0x1f2800, 8192, 1056, 11, SUP_POW2PS},
579 { "at45db641d", 0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS},
580};
581
582static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
583{
584 int tmp;
585 uint8_t code = OP_READ_ID;
586 uint8_t id[3];
587 uint32_t jedec;
588 struct flash_info *info;
589 int status;
590
591
592 /* JEDEC also defines an optional "extended device information"
593 * string for after vendor-specific data, after the three bytes
594 * we use here. Supporting some chips might require using it.
595 */
596 tmp = spi_write_then_read(spi, &code, 1, id, 3);
597 if (tmp < 0) {
598 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
599 spi->dev.bus_id, tmp);
600 return NULL;
601 }
602 jedec = id[0];
603 jedec = jedec << 8;
604 jedec |= id[1];
605 jedec = jedec << 8;
606 jedec |= id[2];
607
608 for (tmp = 0, info = dataflash_data;
609 tmp < ARRAY_SIZE(dataflash_data);
610 tmp++, info++) {
611 if (info->jedec_id == jedec) {
612 if (info->flags & SUP_POW2PS) {
613 status = dataflash_status(spi);
614 if (status & 0x1)
615 /* return power of 2 pagesize */
616 return ++info;
617 else
618 return info;
619 }
620 }
621 }
622 return NULL;
623}
624
532static int __devinit dataflash_probe(struct spi_device *spi) 625static int __devinit dataflash_probe(struct spi_device *spi)
533{ 626{
534 int status; 627 int status;
628 struct flash_info *info;
629
630 /*
631 * Try to detect dataflash by JEDEC ID.
632 * If it succeeds we know we have either a C or D part.
633 * D will support power of 2 pagesize option.
634 */
635
636 info = jedec_probe(spi);
637
638 if (info != NULL)
639 return add_dataflash(spi, info->name, info->nr_pages,
640 info->pagesize, info->pageoffset);
641
535 642
536 status = dataflash_status(spi); 643 status = dataflash_status(spi);
537 if (status <= 0 || status == 0xff) { 644 if (status <= 0 || status == 0xff) {
@@ -551,16 +658,16 @@ static int __devinit dataflash_probe(struct spi_device *spi)
551 status = add_dataflash(spi, "AT45DB011B", 512, 264, 9); 658 status = add_dataflash(spi, "AT45DB011B", 512, 264, 9);
552 break; 659 break;
553 case 0x14: /* 0 1 0 1 x x */ 660 case 0x14: /* 0 1 0 1 x x */
554 status = add_dataflash(spi, "AT45DB021B", 1025, 264, 9); 661 status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9);
555 break; 662 break;
556 case 0x1c: /* 0 1 1 1 x x */ 663 case 0x1c: /* 0 1 1 1 x x */
557 status = add_dataflash(spi, "AT45DB041x", 2048, 264, 9); 664 status = add_dataflash(spi, "AT45DB041B", 2048, 264, 9);
558 break; 665 break;
559 case 0x24: /* 1 0 0 1 x x */ 666 case 0x24: /* 1 0 0 1 x x */
560 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9); 667 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9);
561 break; 668 break;
562 case 0x2c: /* 1 0 1 1 x x */ 669 case 0x2c: /* 1 0 1 1 x x */
563 status = add_dataflash(spi, "AT45DB161x", 4096, 528, 10); 670 status = add_dataflash(spi, "AT45DB161B", 4096, 528, 10);
564 break; 671 break;
565 case 0x34: /* 1 1 0 1 x x */ 672 case 0x34: /* 1 1 0 1 x x */
566 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10); 673 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10);
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index 0399be178620..3aaca88847d3 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * mtdram - a test mtd device 2 * mtdram - a test mtd device
3 * $Id: mtdram.c,v 1.37 2005/04/21 03:42:11 joern Exp $
4 * Author: Alexander Larsson <alex@cendio.se> 3 * Author: Alexander Larsson <alex@cendio.se>
5 * 4 *
6 * Copyright (c) 1999 Alexander Larsson <alex@cendio.se> 5 * Copyright (c) 1999 Alexander Larsson <alex@cendio.se>
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index c7987b1c5e01..088fbb7595b5 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -1,6 +1,4 @@
1/** 1/**
2 * $Id: phram.c,v 1.16 2005/11/07 11:14:25 gleixner Exp $
3 *
4 * Copyright (c) ???? Jochen Schäuble <psionic@psionic.de> 2 * Copyright (c) ???? Jochen Schäuble <psionic@psionic.de>
5 * Copyright (c) 2003-2004 Joern Engel <joern@wh.fh-wedel.de> 3 * Copyright (c) 2003-2004 Joern Engel <joern@wh.fh-wedel.de>
6 * 4 *
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index bc9981749064..d38bca64bb15 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: pmc551.c,v 1.32 2005/11/07 11:14:25 gleixner Exp $
3 *
4 * PMC551 PCI Mezzanine Ram Device 2 * PMC551 PCI Mezzanine Ram Device
5 * 3 *
6 * Author: 4 * Author:
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index cb86db746f28..a425d09f35a0 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -1,7 +1,5 @@
1/*====================================================================== 1/*======================================================================
2 2
3 $Id: slram.c,v 1.36 2005/11/07 11:14:25 gleixner Exp $
4
5 This driver provides a method to access memory not used by the kernel 3 This driver provides a method to access memory not used by the kernel
6 itself (i.e. if the kernel commandline mem=xxx is used). To actually 4 itself (i.e. if the kernel commandline mem=xxx is used). To actually
7 use slram at least mtdblock or mtdchar is required (for block or 5 use slram at least mtdblock or mtdchar is required (for block or