diff --git a/jtag/ChangeLog b/jtag/ChangeLog index ed89e29d..8da37d8f 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,5 +1,8 @@ 2008-02-15 Kolja Waschk + * src/flash/Makefile.am, src/flash/jedec_exp.c, src/flash/detectflash.c, + configure.ac: Experimental new code for flash detection, to be enabled + during configuration with --enable-jedec-exp (disabled by default) * src/bus/s3c4510x.c: disable debug output (was enabled in 929..) * include/register.h, src/tap/register.c, src/discovery.c: report if tdo seems to be stuck during detect_register_size (ie. "detect"). diff --git a/jtag/configure.ac b/jtag/configure.ac index 5a602d11..8d19ac03 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -395,6 +395,21 @@ AS_IF([test "x$conservative_flush" = xtrue], [ AC_DEFINE(CONSERVATIVE_FLUSH, 1, [define if conservative queue flushing is enabled]) ]) +dnl Enable experimental brute-force JEDEC flash autodetection? +AC_ARG_ENABLE(jedec-exp, +[ --enable-jedec-exp Enable experimental JEDEC flash detection], +[case "${enableval}" in + yes) jedecexp=true ;; + no) jedecexp=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-jedec-exp) ;; + esac], +[jedecexp=false]) +AS_IF([test "x$jedecexp" = xtrue], [ + AM_CONDITIONAL(JEDEC_EXP, true) + AC_DEFINE(JEDEC_EXP, 1, [define if experimental JEDEC flash detection is enabled]) +],[ + AM_CONDITIONAL(JEDEC_EXP, false) +]) AC_OUTPUT diff --git a/jtag/src/flash/Makefile.am b/jtag/src/flash/Makefile.am index c95334c9..08036829 100644 --- a/jtag/src/flash/Makefile.am +++ b/jtag/src/flash/Makefile.am @@ -32,3 +32,9 @@ libflash_a_SOURCES = \ detectflash.c \ intel.c \ jedec.c + +if JEDEC_EXP +libflash_a_SOURCES += \ + jedec_exp.c +endif + diff --git a/jtag/src/flash/detectflash.c b/jtag/src/flash/detectflash.c index a30605f1..fae2bc5b 100644 --- a/jtag/src/flash/detectflash.c +++ b/jtag/src/flash/detectflash.c @@ -41,6 +41,7 @@ cfi_array_t *cfi_array = NULL; +extern int jedec_exp_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ); extern int jedec_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ); extern int amd_detect(bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ); //Ajith @@ -66,17 +67,27 @@ detectflash( bus_t *bus, uint32_t adr ) cfi_array = NULL; if (jedec_detect( bus, adr, &cfi_array ) != 0) { cfi_array_free( cfi_array ); + cfi_array = NULL; if(amd_detect(bus, adr, &cfi_array ) != 0) { cfi_array_free( cfi_array ); - cfi_array->bus_width = 1; cfi_array = NULL; - printf( _("Flash not found!\n") ); - return; +#ifdef JEDEC_EXP + if (jedec_exp_detect( bus, adr, &cfi_array )) { + cfi_array_free( cfi_array ); + cfi_array = NULL; + } +#endif } } } + if (cfi_array == NULL) + { + printf( _("Flash not found!\n") ); + return; + } + cfi = &cfi_array->cfi_chips[0]->cfi; /* detect CFI capable devices */