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[] = {
58 .name = "W25Q80BL/W25Q80BV",
63 .name = "W25Q16CL/W25Q16DV",
68 .name = "W25Q32BV/W25Q32FV_SPI",
73 .name = "W25Q64CV/W25Q64FV_SPI",
78 .name = "W25Q128BV/W25Q128FV_SPI",
98 .name = "W25Q32DW/W25Q32FV_QPI",
103 .name = "W25Q64DW/W25Q64FV_QPI",
108 .name = "W25Q128FW/W25Q128FV_QPI",
112 struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
114 const struct winbond_spi_flash_params *params;
115 struct spi_flash *flash;
118 for (i = 0; i < ARRAY_SIZE(winbond_spi_flash_table); i++) {
119 params = &winbond_spi_flash_table[i];
120 if (params->id == ((idcode[1] << 8) | idcode[2]))
124 if (i == ARRAY_SIZE(winbond_spi_flash_table)) {
125 debug("SF: Unsupported Winbond ID %02x%02x\n",
126 idcode[1], idcode[2]);
130 flash = spi_flash_alloc_base(spi, params->name);
132 debug("SF: Failed to allocate memory\n");
136 flash->page_size = 256;
137 flash->sector_size = (idcode[1] == 0x20) ? 65536 : 4096;
138 flash->size = 4096 * 16 * params->nr_blocks;