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[] = {
37 struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)
39 const struct eon_spi_flash_params *params;
40 struct spi_flash *flash;
43 for (i = 0; i < ARRAY_SIZE(eon_spi_flash_table); ++i) {
44 params = &eon_spi_flash_table[i];
45 if (params->idcode1 == idcode[2])
49 if (i == ARRAY_SIZE(eon_spi_flash_table)) {
50 debug("SF: Unsupported EON ID %02x\n", idcode[1]);
54 flash = malloc(sizeof(*flash));
56 debug("SF: Failed to allocate memory\n");
61 flash->name = params->name;
63 flash->write = spi_flash_cmd_write_multi;
64 flash->erase = spi_flash_cmd_erase;
65 flash->read = spi_flash_cmd_read_fast;
66 flash->page_size = 256;
67 flash->sector_size = 256 * 16 * 16;
68 flash->size = 256 * 16