mtd m25p80: fix bug - ATmel spi flash fails to be copied to
PATCH 1/1 mtd m25p80: fix bug - ATmel spi flash fails to be copied to
From: Michael Hennerich <[email protected]>
Atmel serial flash tends to power up with the protection status bits set.
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4089
--- drivers/mtd/devices/m25p80.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
drivers/mtd/devices/m25p80.c +24 -0
@@ -33,6 +33,7 @@/* Flash opcodes. */ #define OPCODE_WREN 0x06/* Write enable */ #define OPCODE_RDSR 0x05/* Read status register */ +#define OPCODE_WRSR 0x01/* Write status register 1 byte */ #define OPCODE_NORM_READ 0x03/* Read data bytes (low frequency) */ #define OPCODE_FAST_READ 0x0b/* Read data bytes (high frequency) */ #define OPCODE_PP 0x02/* Page program (up to 256 bytes) */
@@ -112,6 +113,19 @@ static int read_sr(struct m25p *flash)return val; } +/* +* Write status register 1 byte +* Returns negative if error occurred. +*/ +static int write_sr (struct m25p *flash,u8 val) +{ + flash->command[0 ] =OPCODE_WRSR ; + flash->command[1 ] = val; + +spi_write (flash->spi, flash->command,2 ); + +return spi_write (flash->spi, flash->command,2 ); +}/* * Set write enable latch with Write Enable command.
@@ -587,6 +601,16 @@ static int __devinit m25p_probe(struct spi_device *spi)mutex_init (&flash->lock);dev_set_drvdata (&spi->dev, flash); +/* +* Atmel serial flash tend to power up +* with the software protection bits set +*/ + +if (info->jedec_id >>16 ==0x1f ) { +write_enable (flash); +write_sr (flash,0 ); + } +if (data && data->name) flash->mtd.name = data->name;else
Signature · 1 line
1.5.5
drivers/mtd/devices/m25p80.c static int read_sr(struct m25p *flash) · line 127
Quoted 3 lines
drivers/mtd/devices/m25p80.c +3
-0+spi_write (flash->spi, flash->command,2 ); + +return spi_write (flash->spi, flash->command,2 );
I just noticed that write_sr contains a duplicated spi_write. Bryan sends out a new patch.
-Michael
Quoted 9 lines
-----Original Message-----
From: Bryan Wu [mailto:[email protected]] On Behalf Of Bryan Wu
Sent: Samstag, 17. Mai 2008 12:52
To: [email protected]; [email protected]; [email protected]
Cc: Michael Hennerich; Bryan Wu
Subject: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to
Quoted 3 lines
From: Michael Hennerich <[email protected]>
Atmel serial flash tends to power up with the protection status bits
set.
Review
Quoted 10 lines
http://blackfin.uclinux.org/gf/project/uclinux-
dist/tracker/?action=TrackerItemEdit&tracker_item_id=4089Signed-off-by Michael Hennerich <[email protected]>Signed-off-by Bryan Wu <[email protected]>---
drivers/mtd/devices/m25p80.c| 24 ++++++++++++++++++++++++1 files changed, 24 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/drivers/mtd/devices/m25p80.c
drivers/mtd/devices/m25p80.c line 35
Quoted 7 lines
index 25efd33..b10649b 100644
drivers/mtd/devices/m25p80.c +0
-0@@ -33,6 +33,7 @@/* Flash opcodes. */ #define OPCODE_WREN 0x06/* Write enable */ #define OPCODE_RDSR 0x05/* Read status register
*/
drivers/mtd/devices/m25p80.c line 36
Quoted 1 line
drivers/mtd/devices/m25p80.c +1
-0+#define OPCODE_WRSR 0x01/* Write status register
1 byte */
drivers/mtd/devices/m25p80.c line 37
Quoted 1 line
drivers/mtd/devices/m25p80.c +0
-0#define OPCODE_NORM_READ 0x03/* Read data bytes (low
frequency) */
drivers/mtd/devices/m25p80.c line 38
Quoted 1 line
drivers/mtd/devices/m25p80.c +0
-0#define OPCODE_FAST_READ 0x0b/* Read data bytes (high
frequency) */
drivers/mtd/devices/m25p80.c line 39
Quoted 1 line
drivers/mtd/devices/m25p80.c +0
-0#define OPCODE_PP 0x02/* Page program (up to
256 bytes) */
Quoted 40 lines
drivers/mtd/devices/m25p80.c +23
-0@@ -112,6 +113,19 @@ static int read_sr(struct m25p *flash)return val; } +/* +* Write status register 1 byte +* Returns negative if error occurred. +*/ +static int write_sr (struct m25p *flash,u8 val) +{ + flash->command[0 ] =OPCODE_WRSR ; + flash->command[1 ] = val; + +spi_write (flash->spi, flash->command,2 ); + +return spi_write (flash->spi, flash->command,2 ); +}/* * Set write enable latch with Write Enable command. @@ -587,6 +601,16 @@ static int __devinit m25p_probe(struct spi_device *spi)mutex_init (&flash->lock);dev_set_drvdata (&spi->dev, flash); +/* +* Atmel serial flash tend to power up +* with the software protection bits set +*/ + +if (info->jedec_id >>16 ==0x1f ) { +write_enable (flash); +write_sr (flash,0 ); + } +if (data && data->name) flash->mtd.name = data->name;else
--
1.5.5
Quoted 8 lines · Michael
drivers/mtd/devices/m25p80.c static int read_sr(struct m25p *flash) · line 127
Quoted 3 lines
drivers/mtd/devices/m25p80.c +3
-0+spi_write (flash->spi, flash->command,2 ); + +return spi_write (flash->spi, flash->command,2 );I just noticed that
write_srcontains a duplicatedspi_write. Bryan sends out a new patch.
No problem, it is my fault. I should review the patch carefully.
Thanks
-Bryan
Quoted 8 lines · Bryan Wu
Quoted 5 lines
I just noticed that
write_srcontains a duplicatedspi_write. Bryan sends out a new patch.No problem, it is my fault. I should review the patch carefully.
Was there a new patch coming?
Signature · 1 line
dwmw2
RE: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to becopied to
David,
Bryan sent an incremental update patch, some time ago. See below ...
Regards,
Michael
From: Michael Hennerich <[email protected]>
remove duplicate code.
--- drivers/mtd/devices/m25p80.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/mtd/devices/m25p80.c +0 -3
@@ -122,8 +122,6 @@ static int write_sr(struct m25p *flash, u8 val) flash->command[0 ] =OPCODE_WRSR ; flash->command[1 ] = val; -spi_write (flash->spi, flash->command,2 ); -return spi_write (flash->spi, flash->command,2 ); } --
1.5.5
Quoted 23 lines
-----Original Message-----
From: David Woodhouse [mailto:[email protected]]
Sent: Mittwoch, 4. Juni 2008 18:59
To: Bryan Wu
Cc: Hennerich, Michael; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to becopied toQuoted 8 lines · Bryan Wu
Quoted 5 lines
I just noticed that
write_srcontains a duplicatedspi_write. Bryan sends out a new patch.No problem, it is my fault. I should review the patch carefully.
Was there a new patch coming?
--
dwmw2