From d5b5b52ff3d51532f5627eb8350e79fc15c0d874 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Thu, 15 May 2003 11:29:55 +0000 Subject: [PATCH] 2003-05-15 Marcel Telka * configure.ac (CPPFLAGS): Added path to the openwince include arm directory. * include/bus.h (bus_width): Added new `adr' parameter for this macro. All relevant functions and callers updated. * src/bus/pxa2x0.c (bus_params_t): Added last_adr and MC_registers structure members. (LAST_ADR, MC_pointer): New macros. (pxa250_bus_read_start, pxa250_bus_read_next, pxa250_bus_read_end, pxa250_bus_write): Disabled external bus cycles for addresses above 0x0400000. (pxa250_bus_width): Removed some output messages. Implemented BOOT_DEF emulation. (new_pxa250_bus): Implemented BOOT_DEF emulation. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@428 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 13 ++++++++++++ jtag/NEWS | 1 + jtag/configure.ac | 2 +- jtag/include/bus.h | 4 ++-- jtag/src/bus/ixp425.c | 2 +- jtag/src/bus/pxa2x0.c | 45 ++++++++++++++++++++++++++++++++---------- jtag/src/bus/sa1110.c | 2 +- jtag/src/flash.c | 2 +- jtag/src/flash/cfi.c | 4 ++-- jtag/src/flash/intel.c | 4 ++-- jtag/src/readmem.c | 4 ++-- 11 files changed, 61 insertions(+), 22 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 6ad11c69..4805d99d 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,16 @@ +2003-05-15 Marcel Telka + + * configure.ac (CPPFLAGS): Added path to the openwince include arm directory. + * include/bus.h (bus_width): Added new `adr' parameter for this macro. + All relevant functions and callers updated. + + * src/bus/pxa2x0.c (bus_params_t): Added last_adr and MC_registers structure members. + (LAST_ADR, MC_pointer): New macros. + (pxa250_bus_read_start, pxa250_bus_read_next, pxa250_bus_read_end, pxa250_bus_write): Disabled + external bus cycles for addresses above 0x0400000. + (pxa250_bus_width): Removed some output messages. Implemented BOOT_DEF emulation. + (new_pxa250_bus): Implemented BOOT_DEF emulation. + 2003-05-14 Marcel Telka * include/Makefile.am (noinst_HEADERS): Added cfi.h. diff --git a/jtag/NEWS b/jtag/NEWS index e13be482..b83ccdbd 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -2,6 +2,7 @@ $Id$ * Added new manufacturer: DEC. * Added support for executing scripts directly from stdin (parameter '-'). + * Disabled external bus cycles for PXA250 for addresses above 0x04000000. jtag-0.3.2 (2003-04-04): diff --git a/jtag/configure.ac b/jtag/configure.ac index 8546d626..b94c65ab 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -73,7 +73,7 @@ AC_CACHE_CHECK([for the openwince includes], openwince_includes_path, [ if test "$openwince_includes_path" = "no"; then AC_MSG_ERROR([The openwince include package not found.]) fi -CPPFLAGS="$CPPFLAGS -I$openwince_includes_path -I$openwince_includes_path/device" +CPPFLAGS="$CPPFLAGS -I$openwince_includes_path -I$openwince_includes_path/device -I$openwince_includes_path/arm" AC_SEARCH_LIBS([ioperm], [ioperm]) if test "$ac_cv_search_ioperm" != "no"; then diff --git a/jtag/include/bus.h b/jtag/include/bus.h index 0f2e2053..a0d91014 100644 --- a/jtag/include/bus.h +++ b/jtag/include/bus.h @@ -34,7 +34,7 @@ typedef struct bus bus_t; struct bus { void *params; void (*prepare)( bus_t *bus ); - int (*width)( bus_t *bus ); + int (*width)( bus_t *bus, uint32_t adr ); void (*read_start)( bus_t *bus, uint32_t adr ); uint32_t (*read_next)( bus_t *bus, uint32_t adr ); uint32_t (*read_end)( bus_t *bus ); @@ -44,7 +44,7 @@ struct bus { }; #define bus_prepare(bus) bus->prepare(bus) -#define bus_width(bus) bus->width(bus) +#define bus_width(bus,adr) bus->width(bus,adr) #define bus_read_start(bus,adr) bus->read_start(bus,adr) #define bus_read_next(bus,adr) bus->read_next(bus,adr) #define bus_read_end(bus) bus->read_end(bus) diff --git a/jtag/src/bus/ixp425.c b/jtag/src/bus/ixp425.c index 38f223d3..53623073 100644 --- a/jtag/src/bus/ixp425.c +++ b/jtag/src/bus/ixp425.c @@ -201,7 +201,7 @@ ixp425_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) } static int -ixp425_bus_width( bus_t *bus ) +ixp425_bus_width( bus_t *bus, uint32_t adr ) { return 16; } diff --git a/jtag/src/bus/pxa2x0.c b/jtag/src/bus/pxa2x0.c index a8fd2590..69aaf323 100644 --- a/jtag/src/bus/pxa2x0.c +++ b/jtag/src/bus/pxa2x0.c @@ -30,16 +30,23 @@ #include #include +#include + #include "part.h" #include "bus.h" typedef struct { chain_t *chain; part_t *part; + uint32_t last_adr; + MC_registers_t MC_registers; } bus_params_t; #define CHAIN ((bus_params_t *) bus->params)->chain #define PART ((bus_params_t *) bus->params)->part +#define LAST_ADR ((bus_params_t *) bus->params)->last_adr + +#define MC_pointer (&((bus_params_t *) bus->params)->MC_registers) static void setup_address( part_t *p, uint32_t a ) @@ -90,6 +97,10 @@ pxa250_bus_read_start( bus_t *bus, uint32_t adr ) chain_t *chain = CHAIN; part_t *p = PART; + LAST_ADR = adr; + if (adr >= 0x04000000) + return; + /* see Figure 6-13 in [1] */ part_set_signal( p, "nCS[0]", 1, 0 ); part_set_signal( p, "DQM[0]", 1, 0 ); @@ -107,12 +118,20 @@ pxa250_bus_read_start( bus_t *bus, uint32_t adr ) chain_shift_data_registers( chain ); } +static uint32_t pxa250_bus_read_end( bus_t *bus ); + static uint32_t pxa250_bus_read_next( bus_t *bus, uint32_t adr ) { part_t *p = PART; chain_t *chain = CHAIN; + if (LAST_ADR >= 0x04000000) + pxa250_bus_read_start( bus, adr ); + if (adr >= 0x04000000) + return pxa250_bus_read_end( bus ); + LAST_ADR = adr; + /* see Figure 6-13 in [1] */ setup_address( p, adr ); chain_shift_data_registers( chain ); @@ -137,6 +156,9 @@ pxa250_bus_read_end( bus_t *bus ) part_t *p = PART; chain_t *chain = CHAIN; + if (LAST_ADR >= 0x04000000) + return 0; + /* see Figure 6-13 in [1] */ part_set_signal( p, "nCS[0]", 1, 1 ); part_set_signal( p, "nOE", 1, 1 ); @@ -172,6 +194,9 @@ pxa250_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) part_t *p = PART; chain_t *chain = CHAIN; + if (adr >= 0x04000000) + return; + part_set_signal( p, "nCS[0]", 1, 0 ); part_set_signal( p, "DQM[0]", 1, 0 ); part_set_signal( p, "DQM[1]", 1, 0 ); @@ -194,20 +219,16 @@ pxa250_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) } static int -pxa250_bus_width( bus_t *bus ) +pxa250_bus_width( bus_t *bus, uint32_t adr ) { - part_t *p = PART; - uint8_t boot_sel = (part_get_signal( p, "BOOT_SEL[2]" ) << 2) - | (part_get_signal( p, "BOOT_SEL[1]" ) << 1) - | part_get_signal( p, "BOOT_SEL[0]" ); + if (adr >= 0x04000000) + return 32; /* see Table 6-36. in [1] */ - switch (boot_sel) { + switch (get_BOOT_DEF_BOOT_SEL(BOOT_DEF)) { case 0: - printf( "BOOT_SEL: Asynchronous 32-bit ROM\n" ); return 32; case 1: - printf( "BOOT_SEL: Asynchronous 16-bit ROM\n" ); return 16; case 2: case 3: @@ -215,7 +236,7 @@ pxa250_bus_width( bus_t *bus ) case 5: case 6: case 7: - printf( "TODO - BOOT_SEL: %d\n", boot_sel ); + printf( "TODO - BOOT_SEL: %d\n", get_BOOT_DEF_BOOT_SEL(BOOT_DEF) ); return 0; default: printf( "BUG in code, file %s, line %d.\n", __FILE__, __LINE__ ); @@ -256,7 +277,7 @@ new_pxa250_bus( chain_t *chain, int pn ) memcpy( bus, &pxa250_bus, sizeof (bus_t) ); - bus->params = malloc( sizeof (bus_params_t) ); + bus->params = calloc( 1, sizeof (bus_params_t) ); if (!bus->params) { free( bus ); return NULL; @@ -265,5 +286,9 @@ new_pxa250_bus( chain_t *chain, int pn ) CHAIN = chain; PART = chain->parts->parts[pn]; + BOOT_DEF = BOOT_DEF_PKG_TYPE | BOOT_DEF_BOOT_SEL(part_get_signal( PART, "BOOT_SEL[2]" ) << 2 + | part_get_signal( PART, "BOOT_SEL[1]" ) << 1 + | part_get_signal( PART, "BOOT_SEL[0]" )); + return bus; } diff --git a/jtag/src/bus/sa1110.c b/jtag/src/bus/sa1110.c index 4106b1c2..5a32df1c 100644 --- a/jtag/src/bus/sa1110.c +++ b/jtag/src/bus/sa1110.c @@ -204,7 +204,7 @@ sa1110_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) } static int -sa1110_bus_width( bus_t *bus ) +sa1110_bus_width( bus_t *bus, uint32_t adr ) { if (part_get_signal( PART, "ROM_SEL" )) { printf( "ROM_SEL: 32 bits\n" ); diff --git a/jtag/src/flash.c b/jtag/src/flash.c index e2445c9c..65394d5e 100644 --- a/jtag/src/flash.c +++ b/jtag/src/flash.c @@ -86,7 +86,7 @@ flashcheck( bus_t *bus, cfi_query_structure_t **cfi ) printf( "Note: Supported configuration is 2 x 16 bit or 1 x 16 bit only\n" ); - switch (bus_width( bus )) { + switch (bus_width( bus, 0 )) { case 16: o = 1; break; diff --git a/jtag/src/flash/cfi.c b/jtag/src/flash/cfi.c index e532a176..bd68eef0 100644 --- a/jtag/src/flash/cfi.c +++ b/jtag/src/flash/cfi.c @@ -36,7 +36,7 @@ #include "bus.h" /* function to cover 2x16 and 1x16 modes */ -#define BW16(x) ( (bus_width(bus) == 16) ? x : ( (x<<16) | x ) ) +#define BW16(x) ( (bus_width(bus, 0) == 16) ? x : ( (x<<16) | x ) ) static uint16_t read2( bus_t *bus, uint32_t adr, int o ) @@ -55,7 +55,7 @@ detect_cfi( bus_t *bus ) int o = 2; uint32_t tmp; - if (bus_width( bus ) == 16) + if (bus_width( bus, 0 ) == 16) o = 1; /* detect CFI capable devices - see Table 1 in [1] */ diff --git a/jtag/src/flash/intel.c b/jtag/src/flash/intel.c index 643ba101..f3a5b065 100644 --- a/jtag/src/flash/intel.c +++ b/jtag/src/flash/intel.c @@ -54,13 +54,13 @@ static int intel_flash_program32( bus_t *bus, uint32_t adr, uint32_t data ); static int intel_flash_autodetect32( bus_t *bus, cfi_query_structure_t *cfi ) { - return (cfi->identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) && (bus_width( bus ) == 32); + return (cfi->identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) && (bus_width( bus, 0 ) == 32); } static int intel_flash_autodetect( bus_t *bus, cfi_query_structure_t *cfi ) { - return (cfi->identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) && (bus_width( bus ) == 16); + return (cfi->identification_string.pri_id_code == CFI_VENDOR_INTEL_ECS) && (bus_width( bus, 0 ) == 16); } static void diff --git a/jtag/src/readmem.c b/jtag/src/readmem.c index 81d417f7..ff1f8df6 100644 --- a/jtag/src/readmem.c +++ b/jtag/src/readmem.c @@ -60,7 +60,7 @@ detectflash( bus_t *bus ) printf( "Note: Supported configuration is 2 x 16 bit or 1 x 16 bit only\n" ); - switch (bus_width( bus )) { + switch (bus_width( bus, 0 )) { case 16: o = 1; break; @@ -223,7 +223,7 @@ readmem( bus_t *bus, FILE *f, uint32_t addr, uint32_t len ) bus_prepare( bus ); - step = bus_width( bus ) / 8; + step = bus_width( bus, 0 ) / 8; if (step == 0) { printf( "Unknown bus width!\n" );