[flashrom] [PATCH] Add preliminary support for AMIC chips with uniform 4kB sectors
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Sat Jul 24 10:16:57 CEST 2010
On 24.07.2010 00:26, Daniel Lenski wrote:
> This patch should enable read/write/erase support for these
> chips, but does *not* implement unlock functionality for them yet,
> because they have more complex protection features than simply
> BPx block-protect bits.
>
> Datasheets:
> http://www.amictechnology.com/pdf/A25L512.pdf
> http://www.amictechnology.com/pdf/A25L010.pdf
> http://www.amictechnology.com/pdf/A25L020.pdf
> http://www.amictechnology.com/pdf/A25L040.pdf
> http://www.amictechnology.com/pdf/A25L080.pdf
> http://www.amictechnology.com/pdf/A25L016.pdf
> http://www.amictechnology.com/pdf/A25L032.pdf
> http://www.amictechnology.com/pdf/A25LQ032.pdf
>
> IDs:
> 0x37 0x3010 is A25L512 (uniform 4k sectors)
> 0x37 0x3011 is A25L010 (uniform 4k sectors)
> 0x37 0x3012 is A25L020 (uniform 4k sectors)
> 0x37 0x3013 is A25L040 (uniform 4k sectors)
> 0x37 0x3014 is A25L080 (uniform 4k sectors)
> 0x37 0x3015 is A25L016 (uniform 4k sectors)
> 0x37 0x3016 is A25L032 (uniform 4k sectors)
> 0x37 0x4016 is A25LQ032 (uniform 4k sectors, has quad-rate read)
>
> Please note that the IDs of the newer chips all use AMIC_ID_NOPREFIX
> instead of AMIC_ID, and that means they use probe_spi_rdid instead of
> probe_spi_rdid4.
>
> Signed-off-by: Dan Lenski <dlenski at gmail.com>
>
Thanks for your patch! Review follows.
General remark: Can you order the eraseblock definitions by eraseblock
size (smallest one first)? This allows us to use a better reflashing
granularity in the first write/erase attempt, and reserves bigger
granularities for the case where smaller granularities fail.
> diff --git a/flashchips.c b/flashchips.c
> index c6d265e..29dad48 100644
> --- a/flashchips.c
> +++ b/flashchips.c
> @@ -1532,6 +1532,292 @@ struct flashchip flashchips[] = {
>
> {
> .vendor = "AMIC",
> + .name = "A25L512",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L512,
> + .total_size = 64,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 1 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 1 } },
> + .block_erase = spi_block_erase_52,
>
I can't find the 52h SPI opcode in the datasheet.
> + }, {
> + .eraseblocks = { { 4 * 1024, 16 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 64 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
>
I can't find the 60h SPI opcode in the datasheet.
> + }, {
> + .eraseblocks = { { 64 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
> + }
> + },
> + .unlock = NULL,
>
Can you add a comment so it looks like this:
.unlock = NULL, /* Two-byte status reg */
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25L010",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L010,
> + .total_size = 128,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 2 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 2 } },
> + .block_erase = spi_block_erase_52,
>
I can't find 52h.
> + }, {
> + .eraseblocks = { { 4 * 1024, 32 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 128 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
>
I can't find 60h.
> + }, {
> + .eraseblocks = { { 128 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25L020",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L020,
> + .total_size = 256,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 4 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 4 } },
> + .block_erase = spi_block_erase_52,
>
I can't find 52h.
> + }, {
> + .eraseblocks = { { 4 * 1024, 64 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 256 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
>
I can't find 60h.
> + }, {
> + .eraseblocks = { { 256 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25L040",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L040,
> + .total_size = 512,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 8 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 8 } },
> + .block_erase = spi_block_erase_52,
>
I can't find 52h.
> + }, {
> + .eraseblocks = { { 4 * 1024, 128 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 512 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
>
I can't find 60h.
> + }, {
> + .eraseblocks = { { 512 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25L080",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L080,
> + .total_size = 1024,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 16 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 16 } },
> + .block_erase = spi_block_erase_52,
>
I can't find 52h.
> + }, {
> + .eraseblocks = { { 4 * 1024, 256 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 1024 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
>
I can't find 60h.
> + }, {
> + .eraseblocks = { { 1024 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25L016",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L016,
> + .total_size = 2048,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 32 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 32 } },
> + .block_erase = spi_block_erase_52,
>
I can't find 52h.
> + }, {
> + .eraseblocks = { { 4 * 1024, 512 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 2048 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
>
I can't find 60h.
> + }, {
> + .eraseblocks = { { 2048 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25L032",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25L032,
> + .total_size = 4096,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 64 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 64 } },
> + .block_erase = spi_block_erase_52,
> + }, {
> + .eraseblocks = { { 4 * 1024, 1024 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 4096 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
> + }, {
> + .eraseblocks = { { 4096 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
>
Can you use the order 20, 52, d8, 60, c7 here?
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> + {
> + .vendor = "AMIC",
> + .name = "A25LQ032",
> + .bustype = CHIP_BUSTYPE_SPI,
> + .manufacture_id = AMIC_ID_NOPREFIX,
> + .model_id = AMIC_A25LQ032,
> + .total_size = 4096,
> + .page_size = 256,
> + .tested = TEST_UNTESTED,
> + .probe = probe_spi_rdid,
> + .probe_timing = TIMING_ZERO,
> + .block_erasers =
> + {
> + {
> + .eraseblocks = { { 64 * 1024, 64 } },
> + .block_erase = spi_block_erase_d8,
> + }, {
> + .eraseblocks = { { 64 * 1024, 64 } },
> + .block_erase = spi_block_erase_52,
> + }, {
> + .eraseblocks = { { 4 * 1024, 1024 } },
> + .block_erase = spi_block_erase_20,
> + }, {
> + .eraseblocks = { { 4096 * 1024, 1} },
> + .block_erase = spi_block_erase_60,
> + }, {
> + .eraseblocks = { { 4096 * 1024, 1} },
> + .block_erase = spi_block_erase_c7,
>
Can you use the order 20, 52, d8, 60, c7 here?
> + }
> + },
> + .unlock = NULL,
> + .write = spi_chip_write_256,
> + .read = spi_chip_read,
> + },
> +
> + {
> + .vendor = "AMIC",
> .name = "A29002B",
> .bustype = CHIP_BUSTYPE_PARALLEL,
> .manufacture_id = AMIC_ID_NOPREFIX,
> diff --git a/flashchips.h b/flashchips.h
> index 3e2befa..0b16e3b 100644
> --- a/flashchips.h
> +++ b/flashchips.h
> @@ -88,6 +88,14 @@
> #define AMIC_A25L80P 0x2014 /* Seems that no A25L80PT exists */
> #define AMIC_A25L16PT 0x2025
> #define AMIC_A25L16PU 0x2015
> +#define AMIC_A25L512 0x3010
> +#define AMIC_A25L010 0x3011
> +#define AMIC_A25L020 0x3012
> +#define AMIC_A25L040 0x3013
> +#define AMIC_A25L080 0x3014
> +#define AMIC_A25L016 0x3015
> +#define AMIC_A25L032 0x3016
> +#define AMIC_A25LQ032 0x4016
> #define AMIC_A29002B 0x0d
> #define AMIC_A29002T 0x8C /* Same as A290021T */
> #define AMIC_A29040B 0x86
>
Looks good otherwise.
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
More information about the flashrom
mailing list