* [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature
@ 2012-07-13 18:07 Stephan Linz
2012-07-13 18:07 ` [U-Boot] [PATCH 2/2] sf: stmicro: add support N25Q128 parts Stephan Linz
2012-08-01 17:53 ` [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature Mike Frysinger
0 siblings, 2 replies; 5+ messages in thread
From: Stephan Linz @ 2012-07-13 18:07 UTC (permalink / raw)
To: u-boot
There are more than the M25Pxx serial flashs that can be
used with the stmicro driver, for example: the M25PXxx or
N25Qxx serie. All these chips have burned in the original
stmicro manufacture id 0x20 together with a standard
two-byte signature.
In preperation to support all these chips the stmicro driver
have to decode the full two-byte signature.
Signed-off-by: Stephan Linz <linz@li-pro.net>
---
drivers/mtd/spi/stmicro.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index a9b33cf..4bee9ce 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -47,7 +47,7 @@
#define CMD_M25PXX_RES 0xab /* Release from DP, and Read Signature */
struct stmicro_spi_flash_params {
- u8 idcode1;
+ u16 id;
u16 page_size;
u16 pages_per_sector;
u16 nr_sectors;
@@ -56,56 +56,56 @@ struct stmicro_spi_flash_params {
static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
{
- .idcode1 = 0x11,
+ .id = 0x2011,
.page_size = 256,
.pages_per_sector = 128,
.nr_sectors = 4,
.name = "M25P10",
},
{
- .idcode1 = 0x15,
+ .id = 0x2015,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 32,
.name = "M25P16",
},
{
- .idcode1 = 0x12,
+ .id = 0x2012,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 4,
.name = "M25P20",
},
{
- .idcode1 = 0x16,
+ .id = 0x2016,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "M25P32",
},
{
- .idcode1 = 0x13,
+ .id = 0x2013,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 8,
.name = "M25P40",
},
{
- .idcode1 = 0x17,
+ .id = 0x2017,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 128,
.name = "M25P64",
},
{
- .idcode1 = 0x14,
+ .id = 0x2014,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 16,
.name = "M25P80",
},
{
- .idcode1 = 0x18,
+ .id = 0x2018,
.page_size = 256,
.pages_per_sector = 1024,
.nr_sectors = 64,
@@ -139,13 +139,13 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
params = &stmicro_spi_flash_table[i];
- if (params->idcode1 == idcode[2]) {
+ if (params->id == ((idcode[1] << 8) | idcode[2]))
break;
- }
}
if (i == ARRAY_SIZE(stmicro_spi_flash_table)) {
- debug("SF: Unsupported STMicro ID %02x\n", idcode[1]);
+ debug("SF: Unsupported STMicro ID %02x%02x\n",
+ idcode[1], idcode[2]);
return NULL;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 2/2] sf: stmicro: add support N25Q128 parts
2012-07-13 18:07 [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature Stephan Linz
@ 2012-07-13 18:07 ` Stephan Linz
2012-08-01 17:53 ` Mike Frysinger
2012-08-01 17:53 ` [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature Mike Frysinger
1 sibling, 1 reply; 5+ messages in thread
From: Stephan Linz @ 2012-07-13 18:07 UTC (permalink / raw)
To: u-boot
Adds support for Numonyx's N25Q128 SPI flash. These devices
are used on (among others) Avnet Spartan-6 LX9 micro-evaluation
boards. Tested with "sf" commands and CONFIG_ENV_IS_IN_SPI_FLASH.
Signed-off-by: Stephan Linz <linz@li-pro.net>
---
drivers/mtd/spi/stmicro.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 4bee9ce..50b8aad 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -111,6 +111,13 @@ static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
.nr_sectors = 64,
.name = "M25P128",
},
+ {
+ .id = 0xba18,
+ .page_size = 256,
+ .pages_per_sector = 256,
+ .nr_sectors = 256,
+ .name = "N25Q128",
+ },
};
static int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature
2012-07-13 18:07 [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature Stephan Linz
2012-07-13 18:07 ` [U-Boot] [PATCH 2/2] sf: stmicro: add support N25Q128 parts Stephan Linz
@ 2012-08-01 17:53 ` Mike Frysinger
1 sibling, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2012-08-01 17:53 UTC (permalink / raw)
To: u-boot
On Friday 13 July 2012 14:07:18 Stephan Linz wrote:
> There are more than the M25Pxx serial flashs that can be
> used with the stmicro driver, for example: the M25PXxx or
> N25Qxx serie. All these chips have burned in the original
> stmicro manufacture id 0x20 together with a standard
> two-byte signature.
can you rebase onto mainline and re-post ?
> --- a/drivers/mtd/spi/stmicro.c
> +++ b/drivers/mtd/spi/stmicro.c
>
> for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
> params = &stmicro_spi_flash_table[i];
> - if (params->idcode1 == idcode[2]) {
> + if (params->id == ((idcode[1] << 8) | idcode[2]))
> break;
> - }
> }
can you add a local u16 variable and store the computation of the idcode here
to that above the for loop ?
> if (i == ARRAY_SIZE(stmicro_spi_flash_table)) {
> - debug("SF: Unsupported STMicro ID %02x\n", idcode[1]);
> + debug("SF: Unsupported STMicro ID %02x%02x\n",
> + idcode[1], idcode[2]);
then here you can simply change:
%02x -> %04x
idcode[1] -> <new var>
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120801/96268ffa/attachment.pgp>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-01 21:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 18:07 [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature Stephan Linz
2012-07-13 18:07 ` [U-Boot] [PATCH 2/2] sf: stmicro: add support N25Q128 parts Stephan Linz
2012-08-01 17:53 ` Mike Frysinger
2012-08-01 21:24 ` Stephan Linz
2012-08-01 17:53 ` [U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox