sf: unify write enable commands
Subsystems (2)
PATCH 1/4 sf: unify write enable commands
Every spi flash uses the same write enable command, so unify this in the common code.
--- drivers/mtd/spi/eon.c | 2 +- drivers/mtd/spi/macronix.c | 2 +- drivers/mtd/spi/ramtron.c | 2 +- drivers/mtd/spi/spansion.c | 2 +- drivers/mtd/spi/spi_flash.c | 2 +- drivers/mtd/spi/spi_flash_internal.h | 8 ++++++++ drivers/mtd/spi/sst.c | 2 +- drivers/mtd/spi/stmicro.c | 2 +- drivers/mtd/spi/winbond.c | 2 +- 9 files changed, 16 insertions(+), 8 deletions(-)
drivers/mtd/spi/eon.c +1 -1
@@ -91,7 +91,7 @@ static int eon_write(struct spi_flash *flash, ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n" , buf + actual, cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], chunk_len); - ret =spi_flash_cmd (flash->spi,CMD_EN25Q128_WREN ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret <0 ) {debug ("SF: Enabling Write failed\n" );break ;
drivers/mtd/spi/macronix.c +1 -1
@@ -163,7 +163,7 @@ static int macronix_write(struct spi_flash *flash, ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n" , buf + actual, cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], chunk_len); - ret =spi_flash_cmd (flash->spi,CMD_MX25XX_WREN ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret <0 ) {debug ("SF: Enabling Write failed\n" );break ;
drivers/mtd/spi/ramtron.c +1 -1
@@ -198,7 +198,7 @@ static int ramtron_common(struct spi_flash *flash,if (command ==CMD_RAMTRON_WRITE ) {/* send WREN */ - ret =spi_flash_cmd (flash->spi,CMD_RAMTRON_WREN ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret <0 ) {debug ("SF: Enabling Write failed\n" ); goto releasebus;
drivers/mtd/spi/spansion.c +1 -1
@@ -177,7 +177,7 @@ static int spansion_write(struct spi_flash *flash, ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n" , buf + actual, cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], chunk_len); - ret =spi_flash_cmd (flash->spi,CMD_S25FLXX_WREN ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret <0 ) {debug ("SF: Enabling Write failed\n" );break ;
drivers/mtd/spi/spi_flash.c +1 -1
@@ -163,7 +163,7 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u8 erase_cmd,debug ("SF: erase %2x %2x %2x %2x (%x)\n" , cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], offset); - ret =spi_flash_cmd (flash->spi,CMD_WRITE_ENABLE ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret) goto out;
drivers/mtd/spi/spi_flash_internal.h +8 -0
@@ -46,6 +46,14 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len, const void *data, size_t data_len);/* +* Enable writing on the SPI flash. +*/ +static inline int spi_flash_cmd_write_enable (struct spi_flash *flash) +{ +return spi_flash_cmd (flash->spi,CMD_WRITE_ENABLE ,NULL ,0 ); +} + +/* * Same as spi_flash_cmd_read() except it also claims/releases the SPI * bus. Used as common part of the ->read() operation. */
drivers/mtd/spi/sst.c +1 -1
@@ -96,7 +96,7 @@ static const struct sst_spi_flash_params sst_spi_flash_table[] = {static int sst_enable_writing (struct spi_flash *flash) { -int ret =spi_flash_cmd (flash->spi,CMD_SST_WREN ,NULL ,0 ); +int ret =spi_flash_cmd_write_enable (flash);if (ret)debug ("SF: Enabling Write failed\n" );return ret;
drivers/mtd/spi/stmicro.c +1 -1
@@ -169,7 +169,7 @@ static int stmicro_write(struct spi_flash *flash, ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n" , buf + actual, cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], chunk_len); - ret =spi_flash_cmd (flash->spi,CMD_M25PXX_WREN ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret <0 ) {debug ("SF: Enabling Write failed\n" );break ;
drivers/mtd/spi/winbond.c +1 -1
@@ -140,7 +140,7 @@ static int winbond_write(struct spi_flash *flash, buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); - ret =spi_flash_cmd (flash->spi,CMD_W25_WREN ,NULL ,0 ); + ret =spi_flash_cmd_write_enable (flash);if (ret <0 ) {debug ("SF: Enabling Write failed\n" ); goto out;
Signature · 1 line
1.7.5.rc1
PATCH 2/4 sf: unify write funcs
Once we add a new page_size field for write lengths, we can unify the write methods for most of the spi flash drivers.
--- drivers/mtd/spi/eon.c | 61 ++----------------------------- drivers/mtd/spi/macronix.c | 61 ++----------------------------- drivers/mtd/spi/spansion.c | 61 ++----------------------------- drivers/mtd/spi/spi_flash.c | 57 +++++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash_internal.h | 7 ++++ drivers/mtd/spi/stmicro.c | 61 ++----------------------------- drivers/mtd/spi/winbond.c | 66 ++------------------------------- include/spi_flash.h | 5 ++- 8 files changed, 84 insertions(+), 295 deletions(-)
drivers/mtd/spi/eon.c +3 -58
@@ -59,64 +59,8 @@ static const struct eon_spi_flash_params eon_spi_flash_table[] = {static int eon_write (struct spi_flash *flash,u32 offset,size_t len,const void *buf) { -struct eon_spi_flash *eon =to_eon_spi_flash (flash); -unsigned long page_addr; -unsigned long byte_addr; -unsigned long page_size; -size_t chunk_len; -size_t actual; -int ret; -u8 cmd[4 ]; - - page_size = eon->params->page_size; - page_addr = offset / page_size; - byte_addr = offset % page_size; - - ret =spi_claim_bus (flash->spi); -if (ret) { -debug ("SF: Unable to claim SPI bus\n" ); -return ret; - } - - ret =0 ; -for (actual =0 ; actual < len; actual += chunk_len) { - chunk_len =min (len - actual, page_size - byte_addr); - - cmd[0 ] =CMD_EN25Q128_PP ; - cmd[1 ] = page_addr >>8 ; - cmd[2 ] = page_addr; - cmd[3 ] = byte_addr; - -debug - ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n" , - buf + actual, cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], chunk_len); - - ret =spi_flash_cmd_write_enable (flash); -if (ret <0 ) { -debug ("SF: Enabling Write failed\n" ); -break ; - } - - ret =spi_flash_cmd_write (flash->spi, cmd,4 , - buf + actual, chunk_len); -if (ret <0 ) { -debug ("SF: EON Page Program failed\n" ); -break ; - } - - ret =spi_flash_cmd_wait_ready (flash,SPI_FLASH_PROG_TIMEOUT ); -if (ret) -break ; - - page_addr++; - byte_addr =0 ; - } - -debug ("SF: EON: Successfully programmed %u bytes @ 0x%x\n" , - len, offset); - -spi_release_bus (flash->spi); -return ret; +return spi_flash_cmd_write_multi (flash,CMD_EN25Q128_PP , + offset, len, buf); }static int eon_erase (struct spi_flash *flash,u32 offset,size_t len)
@@ -154,6 +98,7 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode) eon->flash.write = eon_write; eon->flash.erase = eon_erase; eon->flash.read = spi_flash_cmd_read_fast; + eon->flash.page_size = params->page_size; eon->flash.sector_size = params->page_size * params->pages_per_sector * params->sectors_per_block; eon->flash.size = params->page_size * params->pages_per_sector
drivers/mtd/spi/macronix.c +3 -58
73 lines not on this page · raw message
drivers/mtd/spi/spansion.c +3 -58
73 lines not on this page · raw message
drivers/mtd/spi/spi_flash.c +57 -0
63 lines not on this page · raw message
drivers/mtd/spi/spi_flash_internal.h +7 -0
@@ -46,6 +46,13 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len, const void *data, size_t data_len);/* +* Write the requested data out breaking it up into multiple write +* commands as needed per the write size. +*/ +int spi_flash_cmd_write_multi (struct spi_flash *flash,u8 write_cmd, +u32 offset,size_t len,const void *buf); + +/* * Enable writing on the SPI flash. */ static inline int spi_flash_cmd_write_enable (struct spi_flash *flash)
drivers/mtd/spi/stmicro.c +3 -58
73 lines not on this page · raw message
drivers/mtd/spi/winbond.c +4 -62
78 lines not on this page · raw message
include/spi_flash.h +4 -1
@@ -31,8 +31,11 @@ struct spi_flash {const char *name; +/* Total flash size */ u32 size; - +/* Write (page) size */ +u32 page_size; +/* Erase (sector) size */ u32 sector_size; int (*read)(struct spi_flash *flash, u32 offset,
Signature · 1 line
1.7.5.rc1
PATCH 3/4 sf: kill off now-unused local state
In reply to Mike FrysingerNow that the common spi_flash structure tracks all the info that these drivers need, kill off their local state indirection and use just what the common code provides.
--- drivers/mtd/spi/eon.c | 36 ++++++++++++------------------------ drivers/mtd/spi/macronix.c | 36 ++++++++++++------------------------ drivers/mtd/spi/spansion.c | 36 ++++++++++++------------------------ drivers/mtd/spi/stmicro.c | 37 ++++++++++++------------------------- drivers/mtd/spi/winbond.c | 39 +++++++++++++-------------------------- 5 files changed, 61 insertions(+), 123 deletions(-)
drivers/mtd/spi/eon.c +12 -24
@@ -34,17 +34,6 @@ struct eon_spi_flash_params {const char *name; }; -/* spi_flash needs to be first so upper layers can free() it */ -struct eon_spi_flash { -struct spi_flash flash; -const struct eon_spi_flash_params *params; -}; - -static inline struct eon_spi_flash *to_eon_spi_flash (struct spi_flash *flash) -{ - return container_of(flash, struct eon_spi_flash, flash); -} -static const struct eon_spi_flash_params eon_spi_flash_table[] = { { .idcode1 =EON_ID_EN25Q128 ,
@@ -71,7 +60,7 @@ static int eon_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_eon (struct spi_slave *spi,u8 *idcode) {const struct eon_spi_flash_params *params; -struct eon_spi_flash *eon; +struct spi_flash *flash;unsigned int i;for (i =0 ; i <ARRAY_SIZE (eon_spi_flash_table); ++i) {
@@ -85,24 +74,23 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)return NULL ; } - eon =malloc (sizeof (*eon)); -if (!eon) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - eon->params = params; - eon->flash.spi = spi; - eon->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - eon->flash.write = eon_write; - eon->flash.erase = eon_erase; - eon->flash.read = spi_flash_cmd_read_fast; - eon->flash.page_size = params->page_size; - eon->flash.sector_size = params->page_size * params->pages_per_sector + flash->write = eon_write; + flash->erase = eon_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector * params->sectors_per_block; - eon->flash.size = params->page_size * params->pages_per_sector + flash->size = params->page_size * params->pages_per_sector * params->nr_sectors; -return &eon->flash; +return flash; }
drivers/mtd/spi/macronix.c +12 -24
@@ -58,17 +58,6 @@ struct macronix_spi_flash_params {const char *name; }; -struct macronix_spi_flash { -struct spi_flash flash; -const struct macronix_spi_flash_params *params; -}; - -static inline struct macronix_spi_flash *to_macronix_spi_flash (struct spi_flash - *flash) -{ - return container_of(flash, struct macronix_spi_flash, flash); -} -static const struct macronix_spi_flash_params macronix_spi_flash_table[] = { { .idcode =0x2013 ,
@@ -143,7 +132,7 @@ static int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_macronix (struct spi_slave *spi,u8 *idcode) {const struct macronix_spi_flash_params *params; -struct macronix_spi_flash *mcx; +struct spi_flash *flash;unsigned int i;u16 id = idcode[2 ] | idcode[1 ] <<8 ;
@@ -158,23 +147,22 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)return NULL ; } - mcx =malloc (sizeof (*mcx)); -if (!mcx) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - mcx->params = params; - mcx->flash.spi = spi; - mcx->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - mcx->flash.write = macronix_write; - mcx->flash.erase = macronix_erase; - mcx->flash.read = spi_flash_cmd_read_fast; - mcx->flash.page_size = params->page_size; - mcx->flash.sector_size = params->page_size * params->pages_per_sector + flash->write = macronix_write; + flash->erase = macronix_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector * params->sectors_per_block; - mcx->flash.size = mcx->flash.sector_size * params->nr_blocks; + flash->size = flash->sector_size * params->nr_blocks; -return &mcx->flash; +return flash; }
drivers/mtd/spi/spansion.c +12 -24
@@ -64,17 +64,6 @@ struct spansion_spi_flash_params {const char *name; }; -struct spansion_spi_flash { -struct spi_flash flash; -const struct spansion_spi_flash_params *params; -}; - -static inline struct spansion_spi_flash *to_spansion_spi_flash (struct spi_flash - *flash) -{ - return container_of(flash, struct spansion_spi_flash, flash); -} -static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 =SPSN_ID_S25FL008A ,
@@ -157,7 +146,7 @@ static int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_spansion (struct spi_slave *spi,u8 *idcode) {const struct spansion_spi_flash_params *params; -struct spansion_spi_flash *spsn; +struct spi_flash *flash;unsigned int i;unsigned short jedec, ext_jedec;
@@ -177,22 +166,21 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)return NULL ; } - spsn =malloc (sizeof (struct spansion_spi_flash )); -if (!spsn) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - spsn->params = params; - spsn->flash.spi = spi; - spsn->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - spsn->flash.write = spansion_write; - spsn->flash.erase = spansion_erase; - spsn->flash.read = spi_flash_cmd_read_fast; - spsn->flash.page_size = params->page_size; - spsn->flash.sector_size = params->page_size * params->pages_per_sector; - spsn->flash.size = spsn->flash.sector_size * params->nr_sectors; + flash->write = spansion_write; + flash->erase = spansion_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector; + flash->size = flash->sector_size * params->nr_sectors; -return &spsn->flash; +return flash; }
drivers/mtd/spi/stmicro.c +12 -25
@@ -63,18 +63,6 @@ struct stmicro_spi_flash_params {const char *name; }; -/* spi_flash needs to be first so upper layers can free() it */ -struct stmicro_spi_flash { -struct spi_flash flash; -const struct stmicro_spi_flash_params *params; -}; - -static inline struct stmicro_spi_flash *to_stmicro_spi_flash (struct spi_flash - *flash) -{ - return container_of(flash, struct stmicro_spi_flash, flash); -} -static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { { .idcode1 =STM_ID_M25P10 ,
@@ -149,7 +137,7 @@ static int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_stmicro (struct spi_slave *spi,u8 * idcode) {const struct stmicro_spi_flash_params *params; -struct stmicro_spi_flash *stm; +struct spi_flash *flash;unsigned int i;if (idcode[0 ] ==0xff ) {
@@ -177,22 +165,21 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)return NULL ; } - stm =malloc (sizeof (struct stmicro_spi_flash )); -if (!stm) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - stm->params = params; - stm->flash.spi = spi; - stm->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - stm->flash.write = stmicro_write; - stm->flash.erase = stmicro_erase; - stm->flash.read = spi_flash_cmd_read_fast; - stm->flash.page_size = params->page_size; - stm->flash.sector_size = params->page_size * params->pages_per_sector; - stm->flash.size = stm->flash.sector_size * params->nr_sectors; + flash->write = stmicro_write; + flash->erase = stmicro_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector; + flash->size = flash->sector_size * params->nr_sectors; -return &stm->flash; +return flash; }
drivers/mtd/spi/winbond.c +13 -26
@@ -34,18 +34,6 @@ struct winbond_spi_flash_params {const char *name; }; -/* spi_flash needs to be first so upper layers can free() it */ -struct winbond_spi_flash { -struct spi_flash flash; -const struct winbond_spi_flash_params *params; -}; - -static inline struct winbond_spi_flash * -to_winbond_spi_flash (struct spi_flash *flash) -{ - return container_of(flash, struct winbond_spi_flash, flash); -} -static const struct winbond_spi_flash_params winbond_spi_flash_table[] = { { .id =0x3015 ,
@@ -120,9 +108,9 @@ static int winbond_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_winbond (struct spi_slave *spi,u8 *idcode) {const struct winbond_spi_flash_params *params; -unsigned page_size; -struct winbond_spi_flash *stm; +struct spi_flash *flash;unsigned int i; +unsigned page_size;for (i =0 ; i <ARRAY_SIZE (winbond_spi_flash_table); i++) { params = &winbond_spi_flash_table[i];
@@ -136,27 +124,26 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)return NULL ; } - stm =malloc (sizeof (struct winbond_spi_flash )); -if (!stm) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - stm->params = params; - stm->flash.spi = spi; - stm->flash.name = params->name; + flash->spi = spi; + flash->name = params->name;/* Assuming power-of-two page size initially. */ page_size =1 << params->l2_page_size; - stm->flash.write = winbond_write; - stm->flash.erase = winbond_erase; - stm->flash.read = spi_flash_cmd_read_fast; - stm->flash.page_size = page_size; - stm->flash.sector_size = page_size * stm->params->pages_per_sector; - stm->flash.size = page_size * params->pages_per_sector + flash->write = winbond_write; + flash->erase = winbond_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = page_size; + flash->sector_size = page_size * params->pages_per_sector; + flash->size = page_size * params->pages_per_sector * params->sectors_per_block * params->nr_blocks; -return &stm->flash; +return flash; }
Signature · 1 line
1.7.5.rc1
PATCH 4/4 sf: eon/stmicro: inline useless ID defines
In reply to Mike FrysingerThese defines are used in only one place, so just inline them.
--- drivers/mtd/spi/eon.c | 4 +--- drivers/mtd/spi/stmicro.c | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 20 deletions(-)
drivers/mtd/spi/eon.c +1 -3
@@ -23,8 +23,6 @@#define CMD_EN25Q128_DP 0xb9/* Deep Power-down */ #define CMD_EN25Q128_RES 0xab/* Release from DP, and Read Signature */ -#define EON_ID_EN25Q128 0x18 -struct eon_spi_flash_params {u8 idcode1;u16 page_size;
@@ -36,7 +34,7 @@ struct eon_spi_flash_params {static const struct eon_spi_flash_params eon_spi_flash_table[] = { { - .idcode1 =EON_ID_EN25Q128 , + .idcode1 =0x18 , .page_size =256 , .pages_per_sector =16 , .sectors_per_block =16 ,
drivers/mtd/spi/stmicro.c +8 -17
@@ -46,15 +46,6 @@#define CMD_M25PXX_DP 0xb9/* Deep Power-down */ #define CMD_M25PXX_RES 0xab/* Release from DP, and Read Signature */ -#define STM_ID_M25P10 0x11 -#define STM_ID_M25P16 0x15 -#define STM_ID_M25P20 0x12 -#define STM_ID_M25P32 0x16 -#define STM_ID_M25P40 0x13 -#define STM_ID_M25P64 0x17 -#define STM_ID_M25P80 0x14 -#define STM_ID_M25P128 0x18 -struct stmicro_spi_flash_params {u8 idcode1;u16 page_size;
@@ -65,56 +56,56 @@ struct stmicro_spi_flash_params {static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { { - .idcode1 =STM_ID_M25P10 , + .idcode1 =0x11 , .page_size =256 , .pages_per_sector =128 , .nr_sectors =4 , .name ="M25P10" , }, { - .idcode1 =STM_ID_M25P16 , + .idcode1 =0x15 , .page_size =256 , .pages_per_sector =256 , .nr_sectors =32 , .name ="M25P16" , }, { - .idcode1 =STM_ID_M25P20 , + .idcode1 =0x12 , .page_size =256 , .pages_per_sector =256 , .nr_sectors =4 , .name ="M25P20" , }, { - .idcode1 =STM_ID_M25P32 , + .idcode1 =0x16 , .page_size =256 , .pages_per_sector =256 , .nr_sectors =64 , .name ="M25P32" , }, { - .idcode1 =STM_ID_M25P40 , + .idcode1 =0x13 , .page_size =256 , .pages_per_sector =256 , .nr_sectors =8 , .name ="M25P40" , }, { - .idcode1 =STM_ID_M25P64 , + .idcode1 =0x17 , .page_size =256 , .pages_per_sector =256 , .nr_sectors =128 , .name ="M25P64" , }, { - .idcode1 =STM_ID_M25P80 , + .idcode1 =0x14 , .page_size =256 , .pages_per_sector =256 , .nr_sectors =16 , .name ="M25P80" , }, { - .idcode1 =STM_ID_M25P128 , + .idcode1 =0x18 , .page_size =256 , .pages_per_sector =1024 , .nr_sectors =64 ,
Signature · 1 line
1.7.5.rc1
PATCH v2 2/4 sf: unify write funcs
In reply to Mike FrysingerOnce we add a new page_size field for write lengths, we can unify the write methods for most of the spi flash drivers.
---
v2
- push page program command into common code too since all spi flashes use the same one (0x02)
drivers/mtd/spi/eon.c | 66 +------------------------------ drivers/mtd/spi/macronix.c | 66 +------------------------------ drivers/mtd/spi/spansion.c | 66 +------------------------------ drivers/mtd/spi/spi_flash.c | 57 +++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash_internal.h | 8 ++++ drivers/mtd/spi/stmicro.c | 66 +------------------------------ drivers/mtd/spi/winbond.c | 71 +-------------------------------- include/spi_flash.h | 5 ++- 8 files changed, 80 insertions(+), 325 deletions(-)
drivers/mtd/spi/eon.c +2 -64
@@ -56,69 +56,6 @@ static const struct eon_spi_flash_params eon_spi_flash_table[] = { }, }; -static int eon_write (struct spi_flash *flash, -u32 offset,size_t len,const void *buf) -{ -struct eon_spi_flash *eon =to_eon_spi_flash (flash); -unsigned long page_addr; -unsigned long byte_addr; -unsigned long page_size; -size_t chunk_len; -size_t actual; -int ret; -u8 cmd[4 ]; - - page_size = eon->params->page_size; - page_addr = offset / page_size; - byte_addr = offset % page_size; - - ret =spi_claim_bus (flash->spi); -if (ret) { -debug ("SF: Unable to claim SPI bus\n" ); -return ret; - } - - ret =0 ; -for (actual =0 ; actual < len; actual += chunk_len) { - chunk_len =min (len - actual, page_size - byte_addr); - - cmd[0 ] =CMD_EN25Q128_PP ; - cmd[1 ] = page_addr >>8 ; - cmd[2 ] = page_addr; - cmd[3 ] = byte_addr; - -debug - ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n" , - buf + actual, cmd[0 ], cmd[1 ], cmd[2 ], cmd[3 ], chunk_len); - - ret =spi_flash_cmd_write_enable (flash); -if (ret <0 ) { -debug ("SF: Enabling Write failed\n" ); -break ; - } - - ret =spi_flash_cmd_write (flash->spi, cmd,4 , - buf + actual, chunk_len); -if (ret <0 ) { -debug ("SF: EON Page Program failed\n" ); -break ; - } - - ret =spi_flash_cmd_wait_ready (flash,SPI_FLASH_PROG_TIMEOUT ); -if (ret) -break ; - - page_addr++; - byte_addr =0 ; - } - -debug ("SF: EON: Successfully programmed %u bytes @ 0x%x\n" , - len, offset); - -spi_release_bus (flash->spi); -return ret; -} -static int eon_erase (struct spi_flash *flash,u32 offset,size_t len) {return spi_flash_cmd_erase (flash,CMD_EN25Q128_BE , offset, len);
@@ -151,9 +88,10 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode) eon->flash.spi = spi; eon->flash.name = params->name; - eon->flash.write = eon_write; + eon->flash.write = spi_flash_cmd_write_multi; eon->flash.erase = eon_erase; eon->flash.read = spi_flash_cmd_read_fast; + eon->flash.page_size = params->page_size; eon->flash.sector_size = params->page_size * params->pages_per_sector * params->sectors_per_block; eon->flash.size = params->page_size * params->pages_per_sector
drivers/mtd/spi/macronix.c +2 -64
80 lines not on this page · raw message
drivers/mtd/spi/spansion.c +2 -64
80 lines not on this page · raw message
drivers/mtd/spi/spi_flash.c +57 -0
63 lines not on this page · raw message
drivers/mtd/spi/spi_flash_internal.h +8 -0
@@ -19,6 +19,7 @@#define CMD_READ_ARRAY_FAST 0x0b#define CMD_READ_ARRAY_LEGACY 0xe8 +#define CMD_PAGE_PROGRAM 0x02#define CMD_READ_STATUS 0x05#define CMD_WRITE_ENABLE 0x06
@@ -46,6 +47,13 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len, const void *data, size_t data_len);/* +* Write the requested data out breaking it up into multiple write +* commands as needed per the write size. +*/ +int spi_flash_cmd_write_multi (struct spi_flash *flash,u32 offset, +size_t len,const void *buf); + +/* * Enable writing on the SPI flash. */ static inline int spi_flash_cmd_write_enable (struct spi_flash *flash)
drivers/mtd/spi/stmicro.c +2 -64
80 lines not on this page · raw message
drivers/mtd/spi/winbond.c +3 -68
85 lines not on this page · raw message
include/spi_flash.h +4 -1
@@ -31,8 +31,11 @@ struct spi_flash {const char *name; +/* Total flash size */ u32 size; - +/* Write (page) size */ +u32 page_size; +/* Erase (sector) size */ u32 sector_size; int (*read)(struct spi_flash *flash, u32 offset,
Signature · 1 line
1.7.5.rc1
[U-Boot] [PATCH 5/4] sf: unify write disable commands
In reply to Mike FrysingerEvery spi flash uses the same write disnable command, so unify this in the common code.
--- drivers/mtd/spi/spi_flash_internal.h | 9 +++++++++ drivers/mtd/spi/sst.c | 2 +- 2 files changed, 10 insertions(+), 1 deletions(-)
drivers/mtd/spi/spi_flash_internal.h +9 -0
@@ -20,6 +20,7 @@#define CMD_READ_ARRAY_LEGACY 0xe8#define CMD_PAGE_PROGRAM 0x02 +#define CMD_WRITE_DISABLE 0x04#define CMD_READ_STATUS 0x05#define CMD_WRITE_ENABLE 0x06
@@ -62,6 +63,14 @@ static inline int spi_flash_cmd_write_enable(struct spi_flash *flash) }/* +* Disable writing on the SPI flash. +*/ +static inline int spi_flash_cmd_write_disable (struct spi_flash *flash) +{ +return spi_flash_cmd (flash->spi,CMD_WRITE_DISABLE ,NULL ,0 ); +} + +/* * Same as spi_flash_cmd_read() except it also claims/releases the SPI * bus. Used as common part of the ->read() operation. */
drivers/mtd/spi/sst.c +1 -1
@@ -105,7 +105,7 @@ sst_enable_writing(struct spi_flash *flash)static int sst_disable_writing (struct spi_flash *flash) { -int ret =spi_flash_cmd (flash->spi,CMD_SST_WRDI ,NULL ,0 ); +int ret =spi_flash_cmd_write_disable (flash);if (ret)debug ("SF: Disabling Write failed\n" );return ret;
Signature · 1 line
1.7.5.rc1
[U-Boot] [PATCH 6/4] sf: sst: support newer standardized flashes
Newer SST flashes have dropped the Auto Address Increment (AAI) word programming (WP) modes in favor of the standard page programming mode that most flashes now support. So add a flags field to the different flashes to support both modes with new and old styles.
--- drivers/mtd/spi/sst.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
drivers/mtd/spi/sst.c +20 -2
@@ -36,8 +36,12 @@#define SST_SR_AAI (1 << 6)/* Addressing mode */ #define SST_SR_BPL (1 << 7)/* BP bits lock */ +#define SST_FEAT_WP (1 << 0)/* Supports AAI word program */ +#define SST_FEAT_MBP (1 << 1)/* Supports multibyte program */ +struct sst_spi_flash_params {u8 idcode1; +u8 flags;u16 nr_sectors;const char *name; };
@@ -53,41 +57,51 @@ static inline struct sst_spi_flash *to_sst_spi_flash(struct spi_flash *flash) }#define SST_SECTOR_SIZE (4 * 1024) +#define SST_PAGE_SIZE 256static const struct sst_spi_flash_params sst_spi_flash_table[] = { { .idcode1 =0x8d , + .flags =SST_FEAT_WP , .nr_sectors =128 , .name ="SST25VF040B" , },{ .idcode1 =0x8e , + .flags =SST_FEAT_WP , .nr_sectors =256 , .name ="SST25VF080B" , },{ .idcode1 =0x41 , + .flags =SST_FEAT_WP , .nr_sectors =512 , .name ="SST25VF016B" , },{ .idcode1 =0x4a , + .flags =SST_FEAT_WP , .nr_sectors =1024 , .name ="SST25VF032B" , },{ .idcode1 =0x4b , + .flags =SST_FEAT_MBP , .nr_sectors =2048 , .name ="SST25VF064C" , },{ .idcode1 =0x01 , + .flags =SST_FEAT_WP , .nr_sectors =16 , .name ="SST25WF512" , },{ .idcode1 =0x02 , + .flags =SST_FEAT_WP , .nr_sectors =32 , .name ="SST25WF010" , },{ .idcode1 =0x03 , + .flags =SST_FEAT_WP , .nr_sectors =64 , .name ="SST25WF020" , },{ .idcode1 =0x04 , + .flags =SST_FEAT_WP , .nr_sectors =128 , .name ="SST25WF040" , },
@@ -137,7 +151,7 @@ sst_byte_write(struct spi_flash *flash, u32 offset, const void *buf) }static int -sst_write (struct spi_flash *flash,u32 offset,size_t len,const void *buf) +sst_write_wp (struct spi_flash *flash,u32 offset,size_t len,const void *buf) {size_t actual, cmd_len;int ret;
@@ -257,9 +271,13 @@ spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode) stm->flash.spi = spi; stm->flash.name = params->name; - stm->flash.write = sst_write; +if (stm->params->flags &SST_FEAT_WP ) + stm->flash.write = sst_write_wp; +else + stm->flash.write = spi_flash_cmd_write_multi; stm->flash.erase = sst_erase; stm->flash.read = spi_flash_cmd_read_fast; + stm->flash.page_size =SST_PAGE_SIZE ; stm->flash.sector_size =SST_SECTOR_SIZE ; stm->flash.size = stm->flash.sector_size * params->nr_sectors;
Signature · 1 line
1.7.5.rc1
PATCH 1/4 sf: unify write enable commands
In reply to Mike Frysingerbtw, i dont currently plan on pushing these spi patches for 2011.06 since it's kind of late in the merge window. but people can find them in my sf branch if they feel like playing with them:git://www.denx.de/git/u-boot-blackfin.git sf
-mike
PATCH v2 1/1 sf: kill off now-unused local state
In reply to Mike FrysingerNow that the common spi_flash structure tracks all the info that these drivers need, kill off their local state indirection and use just what the common code provides.
---
v2
- rebase onto latest master
drivers/mtd/spi/eon.c | 36 ++++++++++++------------------------ drivers/mtd/spi/macronix.c | 36 ++++++++++++------------------------ drivers/mtd/spi/spansion.c | 36 ++++++++++++------------------------ drivers/mtd/spi/stmicro.c | 37 ++++++++++++------------------------- drivers/mtd/spi/winbond.c | 39 +++++++++++++-------------------------- 5 files changed, 61 insertions(+), 123 deletions(-)
drivers/mtd/spi/eon.c +12 -24
@@ -34,17 +34,6 @@ struct eon_spi_flash_params {const char *name; }; -/* spi_flash needs to be first so upper layers can free() it */ -struct eon_spi_flash { -struct spi_flash flash; -const struct eon_spi_flash_params *params; -}; - -static inline struct eon_spi_flash *to_eon_spi_flash (struct spi_flash *flash) -{ - return container_of(flash, struct eon_spi_flash, flash); -} -static const struct eon_spi_flash_params eon_spi_flash_table[] = { { .idcode1 =EON_ID_EN25Q128 ,
@@ -64,7 +53,7 @@ static int eon_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_eon (struct spi_slave *spi,u8 *idcode) {const struct eon_spi_flash_params *params; -struct eon_spi_flash *eon; +struct spi_flash *flash;unsigned int i;for (i =0 ; i <ARRAY_SIZE (eon_spi_flash_table); ++i) {
@@ -78,24 +67,23 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)return NULL ; } - eon =malloc (sizeof (*eon)); -if (!eon) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - eon->params = params; - eon->flash.spi = spi; - eon->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - eon->flash.write = spi_flash_cmd_write_multi; - eon->flash.erase = eon_erase; - eon->flash.read = spi_flash_cmd_read_fast; - eon->flash.page_size = params->page_size; - eon->flash.sector_size = params->page_size * params->pages_per_sector + flash->write = spi_flash_cmd_write_multi; + flash->erase = eon_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector * params->sectors_per_block; - eon->flash.size = params->page_size * params->pages_per_sector + flash->size = params->page_size * params->pages_per_sector * params->nr_sectors; -return &eon->flash; +return flash; }
drivers/mtd/spi/macronix.c +12 -24
@@ -58,17 +58,6 @@ struct macronix_spi_flash_params {const char *name; }; -struct macronix_spi_flash { -struct spi_flash flash; -const struct macronix_spi_flash_params *params; -}; - -static inline struct macronix_spi_flash *to_macronix_spi_flash (struct spi_flash - *flash) -{ - return container_of(flash, struct macronix_spi_flash, flash); -} -static const struct macronix_spi_flash_params macronix_spi_flash_table[] = { { .idcode =0x2013 ,
@@ -136,7 +125,7 @@ static int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_macronix (struct spi_slave *spi,u8 *idcode) {const struct macronix_spi_flash_params *params; -struct macronix_spi_flash *mcx; +struct spi_flash *flash;unsigned int i;u16 id = idcode[2 ] | idcode[1 ] <<8 ;
@@ -151,23 +140,22 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)return NULL ; } - mcx =malloc (sizeof (*mcx)); -if (!mcx) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - mcx->params = params; - mcx->flash.spi = spi; - mcx->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - mcx->flash.write = spi_flash_cmd_write_multi; - mcx->flash.erase = macronix_erase; - mcx->flash.read = spi_flash_cmd_read_fast; - mcx->flash.page_size = params->page_size; - mcx->flash.sector_size = params->page_size * params->pages_per_sector + flash->write = spi_flash_cmd_write_multi; + flash->erase = macronix_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector * params->sectors_per_block; - mcx->flash.size = mcx->flash.sector_size * params->nr_blocks; + flash->size = flash->sector_size * params->nr_blocks; -return &mcx->flash; +return flash; }
drivers/mtd/spi/spansion.c +12 -24
@@ -64,17 +64,6 @@ struct spansion_spi_flash_params {const char *name; }; -struct spansion_spi_flash { -struct spi_flash flash; -const struct spansion_spi_flash_params *params; -}; - -static inline struct spansion_spi_flash *to_spansion_spi_flash (struct spi_flash - *flash) -{ - return container_of(flash, struct spansion_spi_flash, flash); -} -static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 =SPSN_ID_S25FL008A ,
@@ -150,7 +139,7 @@ static int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_spansion (struct spi_slave *spi,u8 *idcode) {const struct spansion_spi_flash_params *params; -struct spansion_spi_flash *spsn; +struct spi_flash *flash;unsigned int i;unsigned short jedec, ext_jedec;
@@ -170,22 +159,21 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)return NULL ; } - spsn =malloc (sizeof (struct spansion_spi_flash )); -if (!spsn) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - spsn->params = params; - spsn->flash.spi = spi; - spsn->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - spsn->flash.write = spi_flash_cmd_write_multi; - spsn->flash.erase = spansion_erase; - spsn->flash.read = spi_flash_cmd_read_fast; - spsn->flash.page_size = params->page_size; - spsn->flash.sector_size = params->page_size * params->pages_per_sector; - spsn->flash.size = spsn->flash.sector_size * params->nr_sectors; + flash->write = spi_flash_cmd_write_multi; + flash->erase = spansion_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector; + flash->size = flash->sector_size * params->nr_sectors; -return &spsn->flash; +return flash; }
drivers/mtd/spi/stmicro.c +12 -25
@@ -63,18 +63,6 @@ struct stmicro_spi_flash_params {const char *name; }; -/* spi_flash needs to be first so upper layers can free() it */ -struct stmicro_spi_flash { -struct spi_flash flash; -const struct stmicro_spi_flash_params *params; -}; - -static inline struct stmicro_spi_flash *to_stmicro_spi_flash (struct spi_flash - *flash) -{ - return container_of(flash, struct stmicro_spi_flash, flash); -} -static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { { .idcode1 =STM_ID_M25P10 ,
@@ -142,7 +130,7 @@ static int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_stmicro (struct spi_slave *spi,u8 * idcode) {const struct stmicro_spi_flash_params *params; -struct stmicro_spi_flash *stm; +struct spi_flash *flash;unsigned int i;if (idcode[0 ] ==0xff ) {
@@ -170,22 +158,21 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)return NULL ; } - stm =malloc (sizeof (struct stmicro_spi_flash )); -if (!stm) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - stm->params = params; - stm->flash.spi = spi; - stm->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - stm->flash.write = spi_flash_cmd_write_multi; - stm->flash.erase = stmicro_erase; - stm->flash.read = spi_flash_cmd_read_fast; - stm->flash.page_size = params->page_size; - stm->flash.sector_size = params->page_size * params->pages_per_sector; - stm->flash.size = stm->flash.sector_size * params->nr_sectors; + flash->write = spi_flash_cmd_write_multi; + flash->erase = stmicro_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector; + flash->size = flash->sector_size * params->nr_sectors; -return &stm->flash; +return flash; }
drivers/mtd/spi/winbond.c +13 -26
@@ -34,18 +34,6 @@ struct winbond_spi_flash_params {const char *name; }; -/* spi_flash needs to be first so upper layers can free() it */ -struct winbond_spi_flash { -struct spi_flash flash; -const struct winbond_spi_flash_params *params; -}; - -static inline struct winbond_spi_flash * -to_winbond_spi_flash (struct spi_flash *flash) -{ - return container_of(flash, struct winbond_spi_flash, flash); -} -static const struct winbond_spi_flash_params winbond_spi_flash_table[] = { { .id =0x3015 ,
@@ -113,9 +101,9 @@ static int winbond_erase(struct spi_flash *flash, u32 offset, size_t len)struct spi_flash *spi_flash_probe_winbond (struct spi_slave *spi,u8 *idcode) {const struct winbond_spi_flash_params *params; -unsigned page_size; -struct winbond_spi_flash *stm; +struct spi_flash *flash;unsigned int i; +unsigned page_size;for (i =0 ; i <ARRAY_SIZE (winbond_spi_flash_table); i++) { params = &winbond_spi_flash_table[i];
@@ -129,27 +117,26 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)return NULL ; } - stm =malloc (sizeof (struct winbond_spi_flash )); -if (!stm) { + flash =malloc (sizeof (*flash)); +if (!flash) {debug ("SF: Failed to allocate memory\n" );return NULL ; } - stm->params = params; - stm->flash.spi = spi; - stm->flash.name = params->name; + flash->spi = spi; + flash->name = params->name;/* Assuming power-of-two page size initially. */ page_size =1 << params->l2_page_size; - stm->flash.write = spi_flash_cmd_write_multi; - stm->flash.erase = winbond_erase; - stm->flash.read = spi_flash_cmd_read_fast; - stm->flash.page_size = page_size; - stm->flash.sector_size = page_size * stm->params->pages_per_sector; - stm->flash.size = page_size * params->pages_per_sector + flash->write = spi_flash_cmd_write_multi; + flash->erase = winbond_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = page_size; + flash->sector_size = page_size * params->pages_per_sector; + flash->size = page_size * params->pages_per_sector * params->sectors_per_block * params->nr_blocks; -return &stm->flash; +return flash; }
Signature · 1 line
1.7.6
Wolfgang Denk
AppliedPATCH 1/4 sf: unify write enable commands
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 4 lines · In message <[email protected]> you wrote:
Every spi flash uses the same write enable command, so unify this in the common code.
Signed-off-by Mike Frysinger <[email protected]>
Quoted 11 lines
--- drivers/mtd/spi/eon.c | 2 +- drivers/mtd/spi/macronix.c | 2 +- drivers/mtd/spi/ramtron.c | 2 +- drivers/mtd/spi/spansion.c | 2 +- drivers/mtd/spi/spi_flash.c | 2 +- drivers/mtd/spi/spi_flash_internal.h | 8 ++++++++ drivers/mtd/spi/sst.c | 2 +- drivers/mtd/spi/stmicro.c | 2 +- drivers/mtd/spi/winbond.c | 2 +- 9 files changed, 16 insertions(+), 8 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"An open mind has but one disadvantage: it collects dirt."
- a saying at RPIWolfgang Denk
AppliedPATCH v2 2/4 sf: unify write funcs
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 9 lines · In message <[email protected]> you wrote:
Once we add a new
page_sizefield for write lengths, we can unify the write methods for most of the spi flash drivers.Signed-off-by Mike Frysinger <[email protected]>---
v2- push page program command into common code too since all spi flashes use the same one (0x02)
Quoted 9 lines
drivers/mtd/spi/eon.c | 66 +------------------------------ drivers/mtd/spi/macronix.c | 66 +------------------------------ drivers/mtd/spi/spansion.c | 66 +------------------------------ drivers/mtd/spi/spi_flash.c | 57 +++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash_internal.h | 8 ++++ drivers/mtd/spi/stmicro.c | 66 +------------------------------ drivers/mtd/spi/winbond.c | 71 +-------------------------------- include/spi_flash.h | 5 ++- 8 files changed, 80 insertions(+), 325 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The only person who always got his work done by Friday
was Robinson Crusoe.Wolfgang Denk
AppliedPATCH v2 1/1 sf: kill off now-unused local state
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 9 lines · In message <[email protected]> you wrote:
Now that the common
spi_flashstructure tracks all the info that these drivers need, kill off their local state indirection and use just what the common code provides.Signed-off-by Mike Frysinger <[email protected]>---
v2
- rebase onto latest master
Quoted 6 lines
drivers/mtd/spi/eon.c | 36 ++++++++++++------------------------ drivers/mtd/spi/macronix.c | 36 ++++++++++++------------------------ drivers/mtd/spi/spansion.c | 36 ++++++++++++------------------------ drivers/mtd/spi/stmicro.c | 37 ++++++++++++------------------------- drivers/mtd/spi/winbond.c | 39 +++++++++++++-------------------------- 5 files changed, 61 insertions(+), 123 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de ... The prejudices people feel about each other disappear when then get to know each other. -- Kirk, "Elaan of Troyius", stardate 4372.5
Wolfgang Denk
AppliedPATCH 4/4 sf: eon/stmicro: inline useless ID defines
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 7 lines · In message <[email protected]> you wrote:
These defines are used in only one place, so just inline them.
Signed-off-by Mike Frysinger <[email protected]>--- drivers/mtd/spi/eon.c | 4 +--- drivers/mtd/spi/stmicro.c | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 20 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Love your country but never trust its government." - from a hand-painted road sign in central Pennsylvania
[U-Boot] [PATCH 5/4] sf: unify write disable commands
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 8 lines · In message <[email protected]> you wrote:
Every spi flash uses the same write disnable command, so unify this in the common code.
Signed-off-by Mike Frysinger <[email protected]>--- drivers/mtd/spi/spi_flash_internal.h | 9 +++++++++ drivers/mtd/spi/sst.c | 2 +- 2 files changed, 10 insertions(+), 1 deletions(-)
Applied (after fixing the typo in the commit message), thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Machines take me by surprise with great frequency. - Alan Turing
Wolfgang Denk
Applied[U-Boot] [PATCH 6/4] sf: sst: support newer standardized flashes
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 9 lines · In message <[email protected]> you wrote:
Newer SST flashes have dropped the Auto Address Increment (AAI) word programming (WP) modes in favor of the standard page programming mode that most flashes now support. So add a flags field to the different flashes to support both modes with new and old styles.
Signed-off-by Mike Frysinger <[email protected]>--- drivers/mtd/spi/sst.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de You are an excellent tactician, Captain. You let your second in com- mand attack while you sit and watch for weakness. -- Khan Noonian Singh, "Space Seed", stardate 3141.9