summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/spansion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/spi/spansion.c')
-rw-r--r--drivers/mtd/spi/spansion.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c
index 457cc06298..9a114ac6a1 100644
--- a/drivers/mtd/spi/spansion.c
+++ b/drivers/mtd/spi/spansion.c
@@ -31,14 +31,9 @@
#include "spi_flash_internal.h"
-/* S25FLxx-specific commands */
-#define CMD_S25FLXX_SE 0xd8 /* Sector Erase */
-#define CMD_S25FLXX_BE 0xc7 /* Bulk Erase */
-
struct spansion_spi_flash_params {
u16 idcode1;
u16 idcode2;
- u16 page_size;
u16 pages_per_sector;
u16 nr_sectors;
const char *name;
@@ -48,7 +43,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x0213,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 16,
.name = "S25FL008A",
@@ -56,7 +50,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x0214,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 32,
.name = "S25FL016A",
@@ -64,7 +57,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x0215,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "S25FL032A",
@@ -72,7 +64,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x0216,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 128,
.name = "S25FL064A",
@@ -80,7 +71,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x2018,
.idcode2 = 0x0301,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 256,
.name = "S25FL128P_64K",
@@ -88,7 +78,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x2018,
.idcode2 = 0x0300,
- .page_size = 256,
.pages_per_sector = 1024,
.nr_sectors = 64,
.name = "S25FL128P_256K",
@@ -96,7 +85,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x0215,
.idcode2 = 0x4d00,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "S25FL032P",
@@ -104,18 +92,12 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
{
.idcode1 = 0x2018,
.idcode2 = 0x4d01,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 256,
.name = "S25FL129P_64K",
},
};
-static int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)
-{
- return spi_flash_cmd_erase(flash, CMD_S25FLXX_SE, offset, len);
-}
-
struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
{
const struct spansion_spi_flash_params *params;
@@ -149,10 +131,10 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
flash->name = params->name;
flash->write = spi_flash_cmd_write_multi;
- flash->erase = spansion_erase;
+ flash->erase = spi_flash_cmd_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->page_size = 256;
+ flash->sector_size = 256 * params->pages_per_sector;
flash->size = flash->sector_size * params->nr_sectors;
return flash;