diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 2f45e5c0..55cf84d9 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,10 @@ +2003-02-14 Marcel Telka + + * src/cfi.c (detect_cfi): Added support for 1 x 16 bit flash configuration (Christian + Pellegrin). + * src/detect.c (find_record): Added error message if file cannot be opened (Christian + Pellegrin). + 2003-02-14 Marcel Telka * data/xilinx/xc2c256-tq144/xc2c256-tq144: Added JTAG declarations for Xilinx diff --git a/jtag/NEWS b/jtag/NEWS index 233b229d..95ab470b 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -9,6 +9,7 @@ $Id$ * Added JTAG declarations for Intel IXP425 (Christian Pellegrin). * Added bus driver for Intel IXP425 (Christian Pellegrin). * Added JTAG declarations for Xilinx XC2C256-TQ144 (Alessandro Zummo). + * Added support for 1 x 16 bit flash memory detection (Christian Pellegrin). jtag-0.2.2 (2003-02-04): diff --git a/jtag/src/cfi.c b/jtag/src/cfi.c index 148485be..c0dffee2 100644 --- a/jtag/src/cfi.c +++ b/jtag/src/cfi.c @@ -34,6 +34,9 @@ #include "bus.h" +/* function to cover 2x16 and 1x16 modes */ +#define BW16(x) ( (bus_width(ps) == 16) ? x : ( (x<<16) | x ) ) + static uint16_t read2( parts *ps, uint32_t adr, int o ) { @@ -51,24 +54,25 @@ detect_cfi( parts *ps ) int o = 2; uint32_t tmp; - /* TODO: 2 x 16 bit only */ + if (bus_width(ps) == 16) + o = 1; /* detect CFI capable devices - see Table 1 in [1] */ - bus_write( ps, CFI_CMD_QUERY_OFFSET << o, (CFI_CMD_QUERY << 16) | CFI_CMD_QUERY ); - if (bus_read( ps, CFI_QUERY_ID_OFFSET << o ) != (('Q' << 16) | 'Q')) { + bus_write( ps, CFI_CMD_QUERY_OFFSET << o, BW16(CFI_CMD_QUERY) ); + if (bus_read( ps, CFI_QUERY_ID_OFFSET << o ) != BW16('Q')) { printf( "No CFI device detected (Q)!\n" ); return NULL; } - if (bus_read( ps, (CFI_QUERY_ID_OFFSET + 1) << o ) != (('R' << 16) | 'R')) { + if (bus_read( ps, (CFI_QUERY_ID_OFFSET + 1) << o ) != BW16('R')) { printf( "No CFI device detected (R)!\n" ); return NULL; } - if (bus_read( ps, (CFI_QUERY_ID_OFFSET + 2) << o ) != (('Y' << 16) | 'Y')) { + if (bus_read( ps, (CFI_QUERY_ID_OFFSET + 2) << o ) != BW16('Y')) { printf( "No CFI device detected (Y)!\n" ); return NULL; } - printf( "\n2 x 16 bit CFI devices detected (QRY ok)!\n\n" ); + printf( "\n%d x 16 bit CFI devices detected (QRY ok)!\n\n", o); cfi = malloc( sizeof *cfi ); if (!cfi) diff --git a/jtag/src/detect.c b/jtag/src/detect.c index faf07587..cebba85c 100644 --- a/jtag/src/detect.c +++ b/jtag/src/detect.c @@ -47,8 +47,10 @@ find_record( char *filename, tap_register *key, struct id_record *idr ) int r = 0; file = fopen( filename, "r" ); - if (!file) + if (!file) { + printf( "Cannot open %s\n", filename ); return 0; + } tr = register_alloc( key->len );