From: Mike Frysinger Date: Fri, 3 Jul 2009 14:01:23 -0400 Subject: [U-Boot] [PATCH v2] sf: Macronix additional chips supported In-Reply-To: <1246642081-23395-1-git-send-email-prafulla@marvell.com> References: <1246642081-23395-1-git-send-email-prafulla@marvell.com> Message-ID: <200907031401.26096.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday 03 July 2009 13:28:01 Prafulla Wadaskar wrote: > new chips supported:- > MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E > out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms > > Modified the Macronix flash support to use 2 bytes of device id instead of > 1 This was required to support MX25L12855E > > Contributor: Piyush Shah a contributor really should be a signed-off-by > --- a/drivers/mtd/spi/macronix.c > +++ b/drivers/mtd/spi/macronix.c > @@ -49,17 +49,21 @@ > #define CMD_MX25XX_DP 0xb9 /* Deep Power-down */ > #define CMD_MX25XX_RES 0xab /* Release from DP, and Read Signature */ > > -#define MXIC_ID_MX2516 0x15 > -#define MXIC_ID_MX2520 0x12 > -#define MXIC_ID_MX2532 0x16 > -#define MXIC_ID_MX2540 0x13 > -#define MXIC_ID_MX2564 0x17 > -#define MXIC_ID_MX2580 0x14 > -#define MXIC_ID_MX25128 0x18 > +#define MXIC_ID_MD_MX251605D 0x15 /* MD : Memory Density */ > +#define MXIC_ID_MT_MX251605D 0x20 /* MT : Memory Type */ > +#define MXIC_ID_MD_MX253205D 0x16 /* MD : Memory Density */ > +#define MXIC_ID_MT_MX253205D 0x20 /* MT : Memory Type */ > +#define MXIC_ID_MD_MX256405D 0x17 /* MD : Memory Density */ > +#define MXIC_ID_MT_MX256405D 0x20 /* MT : Memory Type */ > +#define MXIC_ID_MD_MX2512805D 0x18 /* MD : Memory Density */ > +#define MXIC_ID_MT_MX2512805D 0x20 /* MT : Memory Type */ > +#define MXIC_ID_MD_MX2512855E 0x18 /* MD : Memory Density */ > +#define MXIC_ID_MT_MX2512855E 0x26 /* MT : Memory Type */ > > #define MACRONIX_SR_WIP (1 << 0) /* Write-in-Progress */ > > struct macronix_spi_flash_params { > + u8 idcode0; > u8 idcode1; > u16 page_size; > u16 pages_per_sector; > @@ -81,13 +85,50 @@ static inline struct macronix_spi_flash > *to_macronix_spi_flash(struct spi_flash > > static const struct macronix_spi_flash_params macronix_spi_flash_table[] = > { { > - .idcode1 = MXIC_ID_MX25128, > + .idcode0 = MXIC_ID_MT_MX251605D, > + .idcode1 = MXIC_ID_MD_MX251605D, > + .page_size = 256, > + .pages_per_sector = 16, > + .sectors_per_block = 16, > + .nr_blocks = 32, > + .name = "MX25L1605D", > + }, > + { > + .idcode0 = MXIC_ID_MT_MX253205D, > + .idcode1 = MXIC_ID_MD_MX253205D, > + .page_size = 256, > + .pages_per_sector = 16, > + .sectors_per_block = 16, > + .nr_blocks = 64, > + .name = "MX25L3205D", > + }, > + { > + .idcode0 = MXIC_ID_MT_MX256405D, > + .idcode1 = MXIC_ID_MD_MX256405D, > + .page_size = 256, > + .pages_per_sector = 16, > + .sectors_per_block = 16, > + .nr_blocks = 128, > + .name = "MX25L6405D", > + }, > + { > + .idcode0 = MXIC_ID_MT_MX2512805D, > + .idcode1 = MXIC_ID_MD_MX2512805D, > .page_size = 256, > .pages_per_sector = 16, > .sectors_per_block = 16, > .nr_blocks = 256, > .name = "MX25L12805D", > }, > + { > + .idcode0 = MXIC_ID_MT_MX2512855E, > + .idcode1 = MXIC_ID_MD_MX2512855E, > + .page_size = 256, > + .pages_per_sector = 16, > + .sectors_per_block = 16, > + .nr_blocks = 256, > + .name = "MX25L12855E", > + }, > }; can you compare the code size to see if combining the id's in a u16 is better than comparing multiple u8's ? and creating a dedicated list of defines for the id's isnt really necessary. using them inline in the structure itself is fine. > for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) { > params = ¯onix_spi_flash_table[i]; > - if (params->idcode1 == idcode[2]) > + if (params->idcode1 == idcode[2] && params->idcode0 == > idcode[1]) break; > } > > if (i == ARRAY_SIZE(macronix_spi_flash_table)) { > - debug("SF: Unsupported Macronix ID %02x\n", idcode[1]); > + debug("SF: Unsupported Macronix ID %02x%02x\n", > idcode[1],idcode[2]); return NULL; > } > > Change log:- > v2: white space removed for clean patch apply > build error fixed looks like you broke whitespace in this version. you changed these if statements to use leading spaces, not tabs. -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/20090703/15d73aa5/attachment.pgp