2 * (C) Copyright 2010, ucRobotics Inc.
3 * Author: Chong Huang <chuang@ucrobotics.com>
4 * Licensed under the GPL-2 or later.
11 #include "spi_flash_internal.h"
13 struct eon_spi_flash_params {
19 static const struct eon_spi_flash_params eon_spi_flash_table[] = {
32 struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)
34 const struct eon_spi_flash_params *params;
35 struct spi_flash *flash;
38 for (i = 0; i < ARRAY_SIZE(eon_spi_flash_table); ++i) {
39 params = &eon_spi_flash_table[i];
40 if (params->idcode1 == idcode[2])
44 if (i == ARRAY_SIZE(eon_spi_flash_table)) {
45 debug("SF: Unsupported EON ID %02x\n", idcode[1]);
49 flash = malloc(sizeof(*flash));
51 debug("SF: Failed to allocate memory\n");
56 flash->name = params->name;
58 flash->write = spi_flash_cmd_write_multi;
59 flash->erase = spi_flash_cmd_erase;
60 flash->read = spi_flash_cmd_read_fast;
61 flash->page_size = 256;
62 flash->sector_size = 256 * 16 * 16;
63 flash->size = 256 * 16