From 0fa110fc44d126eed5a19680c70e7261ffa9fa0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Wed, 15 Jul 2009 12:03:51 +0000 Subject: [PATCH] [ 2806917 ] Atmel AT49BV322D flash support (MURANAKA Masaki) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1656 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 6 ++++++ jtag/src/flash/amd.c | 36 +++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 7ebb7379..00be59c5 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2009-07-15 Arnim Laeuger + + * src/flash/amd.c: [ 2806917 ] Atmel AT49BV322D flash support (MURANAKA Masaki) + Work around flash chips that support multi byte write mode with a + different programming algorithm. + 2009-06-04 Arnim Laeuger * src/bsdl/bsdl_flex.l: force Base = DECIMAL for BOUNDARY_LENGTH attribute diff --git a/jtag/src/flash/amd.c b/jtag/src/flash/amd.c index 719027ac..d227ff1a 100644 --- a/jtag/src/flash/amd.c +++ b/jtag/src/flash/amd.c @@ -310,6 +310,12 @@ amd_flash_print_info( cfi_array_t *cfi_array ) printf( "Atmel" ); printf( _("\n\tChip: ") ); switch (cid) { + case 0x01c8: + printf( "AT49BV322D" ); + break; + case 0x01c9: + printf( "AT49BV322DT" ); + break; case 0x01d2: printf( "AT49BW642DT" ); break; @@ -515,19 +521,27 @@ amd_flash_program( cfi_array_t *cfi_array, uint32_t adr, uint32_t *buffer, int c #endif /* multi-byte writes supported? */ - if (max_bytes_write > 1) - return amd_flash_program_buffer( cfi_array, adr, buffer, count ); + if (max_bytes_write > 1) { + int result; + result = amd_flash_program_buffer( cfi_array, adr, buffer, count ); + if (result == 0) + return 0; + + /* Some flashes support max_bytes_write. + * But some of them don't support S29 style write buffer. + * See also the datasheet about AT49BV322D. + */ + cfi->device_geometry.max_bytes_write = 1; + } - else { - /* unroll buffer to single writes */ - int idx; + /* unroll buffer to single writes */ + int idx; - for (idx = 0; idx < count; idx++) { - int status = amd_flash_program_single( cfi_array, adr, buffer[idx] ); - if (status) - return status; - adr += cfi_array->bus_width; - } + for (idx = 0; idx < count; idx++) { + int status = amd_flash_program_single( cfi_array, adr, buffer[idx] ); + if (status) + return status; + adr += cfi_array->bus_width; } return 0;