]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/spi/spansion.c
Merge branch 'master' of git://git.denx.de/u-boot-video
[karo-tx-uboot.git] / drivers / mtd / spi / spansion.c
index bedde0760db6d2408dc8f8ac3c311b2d2273027e..dad30b54c54e97547f13c14039483da30e1eb409 100644 (file)
 
 #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;
@@ -98,15 +94,17 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
                .idcode2 = 0x4d01,
                .pages_per_sector = 256,
                .nr_sectors = 256,
-               .name = "S25FL129P_64K",
+               .name = "S25FL129P_64K/S25FL128S",
+       },
+       {
+               .idcode1 = 0x0219,
+               .idcode2 = 0x4d01,
+               .pages_per_sector = 256,
+               .nr_sectors = 512,
+               .name = "S25FL256S",
        },
 };
 
-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;
@@ -130,18 +128,12 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
                return NULL;
        }
 
-       flash = malloc(sizeof(*flash));
+       flash = spi_flash_alloc_base(spi, params->name);
        if (!flash) {
                debug("SF: Failed to allocate memory\n");
                return NULL;
        }
 
-       flash->spi = spi;
-       flash->name = params->name;
-
-       flash->write = spi_flash_cmd_write_multi;
-       flash->erase = spansion_erase;
-       flash->read = spi_flash_cmd_read_fast;
        flash->page_size = 256;
        flash->sector_size = 256 * params->pages_per_sector;
        flash->size = flash->sector_size * params->nr_sectors;