2 * Copyright 2008, Network Appliance Inc.
3 * Author: Jason McMullan <mcmullan <at> netapp.com>
4 * Licensed under the GPL-2 or later.
11 #include "spi_flash_internal.h"
13 struct winbond_spi_flash_params {
19 static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
82 struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
84 const struct winbond_spi_flash_params *params;
85 struct spi_flash *flash;
88 for (i = 0; i < ARRAY_SIZE(winbond_spi_flash_table); i++) {
89 params = &winbond_spi_flash_table[i];
90 if (params->id == ((idcode[1] << 8) | idcode[2]))
94 if (i == ARRAY_SIZE(winbond_spi_flash_table)) {
95 debug("SF: Unsupported Winbond ID %02x%02x\n",
96 idcode[1], idcode[2]);
100 flash = malloc(sizeof(*flash));
102 debug("SF: Failed to allocate memory\n");
107 flash->name = params->name;
109 flash->write = spi_flash_cmd_write_multi;
110 flash->erase = spi_flash_cmd_erase;
111 flash->read = spi_flash_cmd_read_fast;
112 flash->page_size = 256;
113 flash->sector_size = 4096;
114 flash->size = 4096 * 16 * params->nr_blocks;