* [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to
@ 2008-05-17 10:52 Bryan Wu
2008-05-19 9:12 ` Hennerich, Michael
0 siblings, 1 reply; 5+ messages in thread
From: Bryan Wu @ 2008-05-17 10:52 UTC (permalink / raw)
To: linux-mtd, linux-kernel, mike; +Cc: Bryan Wu, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
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
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/devices/m25p80.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 25efd33..b10649b 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -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
--
1.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to
2008-05-17 10:52 [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to Bryan Wu
@ 2008-05-19 9:12 ` Hennerich, Michael
2008-05-19 9:53 ` Bryan Wu
0 siblings, 1 reply; 5+ messages in thread
From: Hennerich, Michael @ 2008-05-19 9:12 UTC (permalink / raw)
To: Bryan Wu, linux-mtd, linux-kernel, mike; +Cc: Michael Hennerich
>+ 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
>-----Original Message-----
>From: Bryan Wu [mailto:cooloney.lkml@gmail.com] On Behalf Of Bryan Wu
>Sent: Samstag, 17. Mai 2008 12:52
>To: linux-mtd@lists.infradead.org; linux-kernel@vger.kernel.org;
>mike@steroidmicros.com
>Cc: Michael Hennerich; Bryan Wu
>Subject: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be
>copied to
>
>From: Michael Hennerich <michael.hennerich@analog.com>
>
>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
>
>Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>Signed-off-by: Bryan Wu <cooloney@kernel.org>
>---
> drivers/mtd/devices/m25p80.c | 24 ++++++++++++++++++++++++
> 1 files changed, 24 insertions(+), 0 deletions(-)
>
>diff --git a/drivers/mtd/devices/m25p80.c
b/drivers/mtd/devices/m25p80.c
>index 25efd33..b10649b 100644
>--- a/drivers/mtd/devices/m25p80.c
>+++ b/drivers/mtd/devices/m25p80.c
>@@ -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
>--
>1.5.5
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to
2008-05-19 9:12 ` Hennerich, Michael
@ 2008-05-19 9:53 ` Bryan Wu
2008-06-04 16:58 ` David Woodhouse
0 siblings, 1 reply; 5+ messages in thread
From: Bryan Wu @ 2008-05-19 9:53 UTC (permalink / raw)
To: Hennerich, Michael; +Cc: linux-mtd, linux-kernel, mike
On Mon, May 19, 2008 at 5:12 PM, Hennerich, Michael
<Michael.Hennerich@analog.com> wrote:
>>+ 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.
>
No problem, it is my fault. I should review the patch carefully.
Thanks
-Bryan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to
2008-05-19 9:53 ` Bryan Wu
@ 2008-06-04 16:58 ` David Woodhouse
2008-06-04 17:20 ` [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to becopied to Hennerich, Michael
0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2008-06-04 16:58 UTC (permalink / raw)
To: Bryan Wu; +Cc: mike, linux-mtd, linux-kernel, Hennerich, Michael
On Mon, 2008-05-19 at 17:53 +0800, Bryan Wu wrote:
>
> >
> > I just noticed that write_sr contains a duplicated spi_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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to becopied to
2008-06-04 16:58 ` David Woodhouse
@ 2008-06-04 17:20 ` Hennerich, Michael
0 siblings, 0 replies; 5+ messages in thread
From: Hennerich, Michael @ 2008-06-04 17:20 UTC (permalink / raw)
To: David Woodhouse, Bryan Wu
Cc: mike, linux-mtd, linux-kernel, Hennerich, Michael
David,
Bryan sent an incremental update patch, some time ago.
See below ...
Regards,
Michael
From: Michael Hennerich <michael.hennerich@analog.com>
remove duplicate code.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/devices/m25p80.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index b10649b..7f89b54 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -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
>-----Original Message-----
>From: David Woodhouse [mailto:dwmw2@infradead.org]
>Sent: Mittwoch, 4. Juni 2008 18:59
>To: Bryan Wu
>Cc: Hennerich, Michael; linux-mtd@lists.infradead.org; linux-
>kernel@vger.kernel.org; mike@steroidmicros.com
>Subject: Re: [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to
>becopied to
>
>On Mon, 2008-05-19 at 17:53 +0800, Bryan Wu wrote:
>>
>> >
>> > I just noticed that write_sr contains a duplicated spi_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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-04 17:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-17 10:52 [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to be copied to Bryan Wu
2008-05-19 9:12 ` Hennerich, Michael
2008-05-19 9:53 ` Bryan Wu
2008-06-04 16:58 ` David Woodhouse
2008-06-04 17:20 ` [PATCH 1/1] mtd m25p80: fix bug - ATmel spi flash fails to becopied to Hennerich, Michael
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox