From 44ec2fc697ca337cdab3b9423343434f53dc8a48 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Thu, 28 Aug 2003 06:18:45 +0000 Subject: [PATCH] 2003-08-28 Marcel Telka * flash/cfi.c (cfi_detect): Replaced bus_width macro with new bus_area. * flash/intel.c (intel_flash_autodetect32, intel_flash_autodetect, intel_flash_autodetect8): Ditto. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@550 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- libbrux/ChangeLog | 5 +++++ libbrux/flash/cfi.c | 5 ++++- libbrux/flash/intel.c | 21 ++++++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/libbrux/ChangeLog b/libbrux/ChangeLog index 780af172..669c46ea 100644 --- a/libbrux/ChangeLog +++ b/libbrux/ChangeLog @@ -1,3 +1,8 @@ +2003-08-28 Marcel Telka + + * flash/cfi.c (cfi_detect): Replaced bus_width macro with new bus_area. + * flash/intel.c (intel_flash_autodetect32, intel_flash_autodetect, intel_flash_autodetect8): Ditto. + 2003-08-27 Marcel Telka * flash/amd.c: Changed included headers. diff --git a/libbrux/flash/cfi.c b/libbrux/flash/cfi.c index afe1b058..6cdcdff2 100644 --- a/libbrux/flash/cfi.c +++ b/libbrux/flash/cfi.c @@ -66,6 +66,7 @@ cfi_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ) unsigned int d; /* data offset */ int ba; /* bus width address multiplier */ int ma; /* flash mode address multiplier */ + bus_area_t area; if (!cfi_array || !bus) return -1; /* invalid parameters */ @@ -76,7 +77,9 @@ cfi_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ) (*cfi_array)->bus = bus; (*cfi_array)->address = adr; - bw = bus_width( bus, adr ); + if (bus_area( bus, adr, &area ) != 0) + return -8; /* bus width detection failed */ + bw = area.width; if (bw != 8 && bw != 16 && bw != 32) return -3; /* invalid bus width */ (*cfi_array)->bus_width = ba = bw / 8; diff --git a/libbrux/flash/intel.c b/libbrux/flash/intel.c index b85a2943..60cd946b 100644 --- a/libbrux/flash/intel.c +++ b/libbrux/flash/intel.c @@ -57,25 +57,40 @@ static int intel_flash_program32( cfi_array_t *cfi_array, uint32_t adr, uint32_t static int intel_flash_autodetect32( cfi_array_t *cfi_array ) { + bus_area_t area; + + if (bus_area( cfi_array->bus, 0, &area ) != 0) + return 0; + return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) || (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_INTEL_SCS)) - && (bus_width( cfi_array->bus, 0 ) == 32); + && (area.width == 32); } static int intel_flash_autodetect( cfi_array_t *cfi_array ) { + bus_area_t area; + + if (bus_area( cfi_array->bus, 0, &area ) != 0) + return 0; + return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) || (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_INTEL_SCS)) - && (bus_width( cfi_array->bus, 0 ) == 16); + && (area.width == 16); } static int intel_flash_autodetect8( cfi_array_t *cfi_array ) { + bus_area_t area; + + if (bus_area( cfi_array->bus, 0, &area ) != 0) + return 0; + return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) || (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_INTEL_SCS)) - && (bus_width( cfi_array->bus, 0 ) == 8); + && (area.width == 8); } static void