diff --git a/jtag/ChangeLog b/jtag/ChangeLog index f1149601..392537aa 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2003-06-10 Marcel Telka + + * src/bus/sh7727.c (bus_params_t): Added md3 and md4. + (sh7727_bus_width): Moved to implementation using MD3 and MD4 (thanks to Rainer Dörken). + (new_sh7727_bus): Added MD3 and MD4 signal searching (thanks to Rainer Dörken). + 2003-06-10 Marcel Telka * src/bus/ixp425.c (ixp425_bus_width): Changed return value type (int -> unsigned int). diff --git a/jtag/NEWS b/jtag/NEWS index c385034f..2bfee255 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -3,6 +3,8 @@ $Id$ * Fixed bug with SELECT, AUTOFD, and STROBE signals handling (bug 745824). * Added new commands 'peek' and 'poke' (patch 747447, Matan Ziv-Av). * Fixed bugs in SH7727 bus driver (thanks to Rainer Dörken). + * Added bus width detection using MD3 and MD4 signals in SH7727 bus driver + (thanks to Rainer Dörken). * Minor bugs fixed. jtag-0.4 (2003-05-29): diff --git a/jtag/src/bus/sh7727.c b/jtag/src/bus/sh7727.c index 94b8020d..86a1e5e6 100644 --- a/jtag/src/bus/sh7727.c +++ b/jtag/src/bus/sh7727.c @@ -43,6 +43,8 @@ typedef struct { signal_t *we[4]; signal_t *rdwr; signal_t *rd; + signal_t *md3; + signal_t *md4; } bus_params_t; #define CHAIN ((bus_params_t *) bus->params)->chain @@ -53,6 +55,8 @@ typedef struct { #define WE ((bus_params_t *) bus->params)->we #define RDWR ((bus_params_t *) bus->params)->rdwr #define RD ((bus_params_t *) bus->params)->rd +#define MD3 ((bus_params_t *) bus->params)->md3 +#define MD4 ((bus_params_t *) bus->params)->md4 static void setup_address( bus_t *bus, uint32_t a ) @@ -216,7 +220,19 @@ sh7727_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) static unsigned int sh7727_bus_width( bus_t *bus, uint32_t adr ) { - return 16; + part_t *p = PART; + + switch (part_get_signal( p, MD4 ) << 1 | part_get_signal( p, MD3 )) { + case 1: + return 8; + case 2: + return 16; + case 3: + return 32; + default: + printf( _("Error: Invalid bus width (MD3 = MD4 = 0)!\n") ); + return 0; + } } static void @@ -312,6 +328,16 @@ new_sh7727_bus( chain_t *chain, int pn ) printf( _("signal '%s' not found\n"), "RD" ); failed = 1; } + MD3 = part_find_signal( PART, "MD3" ); + if (!MD3) { + printf( _("signal '%s' not found\n"), "MD3" ); + failed = 1; + } + MD4 = part_find_signal( PART, "MD4" ); + if (!MD4) { + printf( _("signal '%s' not found\n"), "MD4" ); + failed = 1; + } if (failed) { free( bus->params );