aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-17 14:15:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-17 14:15:30 -0500
commitab2020f2f11fc7fb81e6c71298b0830d85412011 (patch)
treec9a6342063461dcf31278d65585bca73bdda4a84 /drivers/mtd/devices
parent235646a486d10891bd86af28d8eac75d9f22bd2d (diff)
parent154bf89f5e3e3dc59666926f27ca4a0866f39157 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (59 commits) mtd: mtdpart: disallow reading OOB past the end of the partition mtd: pxa3xx_nand: NULL dereference in pxa3xx_nand_probe UBI: use mtd->writebufsize to set minimal I/O unit size mtd: initialize writebufsize in the MTD object of a partition mtd: onenand: add mtd->writebufsize initialization mtd: nand: add mtd->writebufsize initialization mtd: cfi: add writebufsize initialization mtd: add writebufsize field to mtd_info struct mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use mtd: OneNAND: add enable / disable methods to onenand_chip mtd: m25p80: Fix JEDEC ID for AT26DF321 mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max) mtd: cfi_cmdset_0002: add support for Samsung K8D3x16UxC NOR chips mtd: cfi_cmdset_0002: add support for Samsung K8D6x16UxM NOR chips mtd: nand: ams-delta: drop omap_read/write, use ioremap mtd: m25p80: add debugging trace in sst_write mtd: nand: ams-delta: select for built-in by default mtd: OneNAND: lighten scary initial bad block messages mtd: OneNAND: OMAP2/3: add support for command line partitioning mtd: nand: rearrange ONFI revision checking, add ONFI 2.3 ... Fix up trivial conflict in drivers/mtd/Kconfig as per DavidW.
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/m25p80.c39
-rw-r--r--drivers/mtd/devices/sst25l.c4
2 files changed, 37 insertions, 6 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index bf5a002209bd..e4eba6cc1b2e 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -51,6 +51,10 @@
51#define OPCODE_WRDI 0x04 /* Write disable */ 51#define OPCODE_WRDI 0x04 /* Write disable */
52#define OPCODE_AAI_WP 0xad /* Auto address increment word program */ 52#define OPCODE_AAI_WP 0xad /* Auto address increment word program */
53 53
54/* Used for Macronix flashes only. */
55#define OPCODE_EN4B 0xb7 /* Enter 4-byte mode */
56#define OPCODE_EX4B 0xe9 /* Exit 4-byte mode */
57
54/* Status Register bits. */ 58/* Status Register bits. */
55#define SR_WIP 1 /* Write in progress */ 59#define SR_WIP 1 /* Write in progress */
56#define SR_WEL 2 /* Write enable latch */ 60#define SR_WEL 2 /* Write enable latch */
@@ -62,7 +66,7 @@
62 66
63/* Define max times to check status register before we give up. */ 67/* Define max times to check status register before we give up. */
64#define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */ 68#define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */
65#define MAX_CMD_SIZE 4 69#define MAX_CMD_SIZE 5
66 70
67#ifdef CONFIG_M25PXX_USE_FAST_READ 71#ifdef CONFIG_M25PXX_USE_FAST_READ
68#define OPCODE_READ OPCODE_FAST_READ 72#define OPCODE_READ OPCODE_FAST_READ
@@ -152,6 +156,16 @@ static inline int write_disable(struct m25p *flash)
152} 156}
153 157
154/* 158/*
159 * Enable/disable 4-byte addressing mode.
160 */
161static inline int set_4byte(struct m25p *flash, int enable)
162{
163 u8 code = enable ? OPCODE_EN4B : OPCODE_EX4B;
164
165 return spi_write_then_read(flash->spi, &code, 1, NULL, 0);
166}
167
168/*
155 * Service routine to read status register until ready, or timeout occurs. 169 * Service routine to read status register until ready, or timeout occurs.
156 * Returns non-zero if error. 170 * Returns non-zero if error.
157 */ 171 */
@@ -207,6 +221,7 @@ static void m25p_addr2cmd(struct m25p *flash, unsigned int addr, u8 *cmd)
207 cmd[1] = addr >> (flash->addr_width * 8 - 8); 221 cmd[1] = addr >> (flash->addr_width * 8 - 8);
208 cmd[2] = addr >> (flash->addr_width * 8 - 16); 222 cmd[2] = addr >> (flash->addr_width * 8 - 16);
209 cmd[3] = addr >> (flash->addr_width * 8 - 24); 223 cmd[3] = addr >> (flash->addr_width * 8 - 24);
224 cmd[4] = addr >> (flash->addr_width * 8 - 32);
210} 225}
211 226
212static int m25p_cmdsz(struct m25p *flash) 227static int m25p_cmdsz(struct m25p *flash)
@@ -482,6 +497,10 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
482 size_t actual; 497 size_t actual;
483 int cmd_sz, ret; 498 int cmd_sz, ret;
484 499
500 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
501 dev_name(&flash->spi->dev), __func__, "to",
502 (u32)to, len);
503
485 *retlen = 0; 504 *retlen = 0;
486 505
487 /* sanity checks */ 506 /* sanity checks */
@@ -607,7 +626,6 @@ struct flash_info {
607 .sector_size = (_sector_size), \ 626 .sector_size = (_sector_size), \
608 .n_sectors = (_n_sectors), \ 627 .n_sectors = (_n_sectors), \
609 .page_size = 256, \ 628 .page_size = 256, \
610 .addr_width = 3, \
611 .flags = (_flags), \ 629 .flags = (_flags), \
612 }) 630 })
613 631
@@ -635,7 +653,7 @@ static const struct spi_device_id m25p_ids[] = {
635 { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) }, 653 { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
636 { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) }, 654 { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
637 { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) }, 655 { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
638 { "at26df321", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) }, 656 { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) },
639 657
640 /* EON -- en25pxx */ 658 /* EON -- en25pxx */
641 { "en25p32", INFO(0x1c2016, 0, 64 * 1024, 64, 0) }, 659 { "en25p32", INFO(0x1c2016, 0, 64 * 1024, 64, 0) },
@@ -653,6 +671,8 @@ static const struct spi_device_id m25p_ids[] = {
653 { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) }, 671 { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) },
654 { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, 672 { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
655 { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, 673 { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
674 { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
675 { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
656 676
657 /* Spansion -- single (large) sector size only, at least 677 /* Spansion -- single (large) sector size only, at least
658 * for the chips listed here (without boot sectors). 678 * for the chips listed here (without boot sectors).
@@ -764,6 +784,7 @@ static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
764 return &m25p_ids[tmp]; 784 return &m25p_ids[tmp];
765 } 785 }
766 } 786 }
787 dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
767 return ERR_PTR(-ENODEV); 788 return ERR_PTR(-ENODEV);
768} 789}
769 790
@@ -883,7 +904,17 @@ static int __devinit m25p_probe(struct spi_device *spi)
883 904
884 flash->mtd.dev.parent = &spi->dev; 905 flash->mtd.dev.parent = &spi->dev;
885 flash->page_size = info->page_size; 906 flash->page_size = info->page_size;
886 flash->addr_width = info->addr_width; 907
908 if (info->addr_width)
909 flash->addr_width = info->addr_width;
910 else {
911 /* enable 4-byte addressing if the device exceeds 16MiB */
912 if (flash->mtd.size > 0x1000000) {
913 flash->addr_width = 4;
914 set_4byte(flash, 1);
915 } else
916 flash->addr_width = 3;
917 }
887 918
888 dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name, 919 dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name,
889 (long long)flash->mtd.size >> 10); 920 (long long)flash->mtd.size >> 10);
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index 684247a8a5ed..c163e619abc9 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -335,7 +335,7 @@ out:
335 return ret; 335 return ret;
336} 336}
337 337
338static struct flash_info *__init sst25l_match_device(struct spi_device *spi) 338static struct flash_info *__devinit sst25l_match_device(struct spi_device *spi)
339{ 339{
340 struct flash_info *flash_info = NULL; 340 struct flash_info *flash_info = NULL;
341 struct spi_message m; 341 struct spi_message m;
@@ -375,7 +375,7 @@ static struct flash_info *__init sst25l_match_device(struct spi_device *spi)
375 return flash_info; 375 return flash_info;
376} 376}
377 377
378static int __init sst25l_probe(struct spi_device *spi) 378static int __devinit sst25l_probe(struct spi_device *spi)
379{ 379{
380 struct flash_info *flash_info; 380 struct flash_info *flash_info;
381 struct sst25l_flash *flash; 381 struct sst25l_flash *flash;