From 266b12cac6c1dfe6e214768d26591b88fd248a5d Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Mon, 11 Aug 2003 18:17:58 +0000 Subject: [PATCH] 2003-06-18 Marcel Telka * flash/amd.c (amd_flash_autodetect): Function renamed ... (amd_flash_autodetect32): ... to this one (patch 772499, Matan Ziv-Av). (amd_flash_autodetect8): New function (patch 772499, Matan Ziv-Av). (amdstatus29, amdisprotected, amd_flash_print_info, amd_flash_erase_block, amd_flash_program): Local variable 'o' becomes global (patch 772499, Matan Ziv-Av). (amd_8_flash_driver): Added new driver (patch 772499, Matan Ziv-Av). git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@498 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- libbrux/ChangeLog | 9 +++++++++ libbrux/NEWS | 1 + libbrux/flash/amd.c | 32 +++++++++++++++++++++++++------- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/libbrux/ChangeLog b/libbrux/ChangeLog index 195768a1..acb271cf 100644 --- a/libbrux/ChangeLog +++ b/libbrux/ChangeLog @@ -1,3 +1,12 @@ +2003-06-18 Marcel Telka + + * flash/amd.c (amd_flash_autodetect): Function renamed ... + (amd_flash_autodetect32): ... to this one (patch 772499, Matan Ziv-Av). + (amd_flash_autodetect8): New function (patch 772499, Matan Ziv-Av). + (amdstatus29, amdisprotected, amd_flash_print_info, amd_flash_erase_block, amd_flash_program): Local + variable 'o' becomes global (patch 772499, Matan Ziv-Av). + (amd_8_flash_driver): Added new driver (patch 772499, Matan Ziv-Av). + 2003-06-18 Marcel Telka * flash/cfi.c (read2): Fixed operator precedence in macro. diff --git a/libbrux/NEWS b/libbrux/NEWS index f7f92c92..3e0c7620 100644 --- a/libbrux/NEWS +++ b/libbrux/NEWS @@ -1,3 +1,4 @@ $Id$ +2003-08-11: Added support for 1 x 8 bit AMD Flash (patch 772499, Matan Ziv-Av). 2003-06-18: Added support for 1 x 8 bit Intel Flash (patch 753295, Matan Ziv-Av). diff --git a/libbrux/flash/amd.c b/libbrux/flash/amd.c index 5f5f8858..603d8401 100644 --- a/libbrux/flash/amd.c +++ b/libbrux/flash/amd.c @@ -52,13 +52,24 @@ static int amd_flash_unlock_block( cfi_array_t *cfi_array, uint32_t adr ); static int amd_flash_program( cfi_array_t *cfi_array, uint32_t adr, uint32_t data ); static void amd_flash_read_array( cfi_array_t *cfi_array ); +static int o; + /* autodetect, we can handle this chip */ static int -amd_flash_autodetect( cfi_array_t *cfi_array ) +amd_flash_autodetect32( cfi_array_t *cfi_array ) { + if(cfi_array->bus_width != 4) return 0; + o = 2; /* Heuristic */ return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_AMD_SCS); } +static int +amd_flash_autodetect8( cfi_array_t *cfi_array ) +{ + if(cfi_array->bus_width != 1) return 0; + o = 1; /* Heuristic */ + return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_AMD_SCS); +} /* * check device status * 1/true PASS @@ -71,7 +82,6 @@ amd_flash_autodetect( cfi_array_t *cfi_array ) static int amdstatus29( parts *ps, uint32_t adr, uint32_t data ) { - int o = 2; int timeout; uint32_t dq7mask = ((1 << 7) << 16) + (1 << 7); uint32_t dq5mask = ((1 << 5) << 16) + (1 << 5); @@ -134,7 +144,6 @@ static int amdisprotected( parts *ps, uint32_t adr ) { uint32_t data; - int o = 2; bus_write( ps, 0x0555 << o, 0x00aa00aa ); /* autoselect p29, sector erase */ bus_write( ps, 0x02aa << o, 0x00550055 ); @@ -151,7 +160,6 @@ amdisprotected( parts *ps, uint32_t adr ) static void amd_flash_print_info( cfi_array_t *cfi_array ) { - int o = 2; int mid, cid, prot; bus_t *bus = cfi_array->bus; @@ -186,7 +194,6 @@ amd_flash_print_info( cfi_array_t *cfi_array ) static int amd_flash_erase_block( cfi_array_t *cfi_array, uint32_t adr ) { - int o = 2; bus_t *bus = cfi_array->bus; printf("flash_erase_block 0x%08X\n", adr); @@ -222,7 +229,6 @@ amd_flash_unlock_block( cfi_array_t *cfi_array, uint32_t adr ) static int amd_flash_program( cfi_array_t *cfi_array, uint32_t adr, uint32_t data ) { - int o = 2; int status; bus_t *bus = cfi_array->bus; @@ -251,7 +257,19 @@ flash_driver_t amd_32_flash_driver = { 4, /* buswidth */ N_("AMD/Fujitsu Standard Command Set"), N_("supported: AMD 29LV640D, 29LV641D, 29LV642D; 2x16 Bit"), - amd_flash_autodetect, + amd_flash_autodetect32, + amd_flash_print_info, + amd_flash_erase_block, + amd_flash_unlock_block, + amd_flash_program, + amd_flash_read_array, +}; + +flash_driver_t amd_8_flash_driver = { + 1, /* buswidth */ + N_("AMD/Fujitsu Standard Command Set"), + N_("supported: AMD 29LV160; 1x8 Bit"), + amd_flash_autodetect8, amd_flash_print_info, amd_flash_erase_block, amd_flash_unlock_block,