aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/m25p80.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 23:30:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 23:30:56 -0400
commit9ee08c2df47c10ba624ff05a6c0f2500748bcb69 (patch)
tree0a2788abb3b5547b83965e0b3132eec8b196bd81 /drivers/mtd/devices/m25p80.c
parenteaf0ba5ef69538b6913525294a3a0fcb0e0992e0 (diff)
parent3d45955962496879dead8d4dd70bb9a23b07154b (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (57 commits) [MTD] [NAND] subpage read feature as a way to increase performance. CPUFREQ: S3C24XX NAND driver frequency scaling support. [MTD][NAND] au1550nd: remove unused variable [MTD] jedec_probe: Fix SST 16-bit chip detection [MTD][MTDPART] Fix a division by zero bug [MTD][MTDPART] Cleanup and document the erase region handling [MTD][MTDPART] Handle most checkpatch findings [MTD][MTDPART] Seperate main loop from per-partition code in add_mtd_partition [MTD] physmap: resume already suspended chips on failure to suspend [MTD] physmap: Fix suspend/resume/shutdown bugs. [MTD] [NOR] Fix -ETIMEO errors in CFI driver [MTD] [NAND] fsl_elbc_nand: fix section mismatch with CONFIG_MTD_OF_PARTS=y [JFFS2] Use .unlocked_ioctl [MTD] Fix const assignment in the MTD command line partitioning driver [MTD] [NOR] gen_probe: No debug message when debugging is disabled [MTD] [NAND] remove __PPC__ hardcoded address from DiskOnChip drivers [MTD] [MAPS] Remove the bast-flash driver. [MTD] [NAND] fsl_elbc_nand: ecclayout cleanups [MTD] [NAND] fsl_elbc_nand: implement support for flash-based BBT [MTD] [NAND] fsl_elbc_nand: fix OOB workability for large page NAND chips ...
Diffstat (limited to 'drivers/mtd/devices/m25p80.c')
-rw-r--r--drivers/mtd/devices/m25p80.c22
1 files changed, 22 insertions, 0 deletions
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