From ffde6167cb6792107b5bea4c83e92ae96efd7bd0 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Sat, 16 Feb 2008 09:48:27 +0000 Subject: [PATCH] s3c4510: Read B0SIZE etc. earlier during bus_prepare, so bus_area can return correct values immediately after init git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1021 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 +++- jtag/src/bus/s3c4510x.c | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 8da37d8f..84284eab 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -3,7 +3,9 @@ * 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..) + * src/bus/s3c4510x.c: disable debug output (was enabled in 929..), do a + chain_shift_data_registers before trying to read b0size (fixes the + old problem of B0SIZE unknown, needed for proper flash detection) * 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/src/bus/s3c4510x.c b/jtag/src/bus/s3c4510x.c index 1e512a9f..fd7294f6 100644 --- a/jtag/src/bus/s3c4510x.c +++ b/jtag/src/bus/s3c4510x.c @@ -150,13 +150,6 @@ s3c4510_bus_printinfo( bus_t *bus ) printf( _("Samsung S3C4510B compatibile bus driver via BSR (JTAG part No. %d) RCS0=%ubit\n"), i ,dbus_width ); } -static void -s3c4510_bus_prepare( bus_t *bus ) -{ - part_set_instruction( PART, "EXTEST" ); - chain_shift_instructions( CHAIN ); -} - static void s3c4510_bus_setup_ctrl( bus_t *bus, int mode ) { int k; @@ -177,6 +170,19 @@ static void s3c4510_bus_setup_ctrl( bus_t *bus, int mode ) part_set_signal( p, nOE, 1, (mode & (1 << 16)) ? 1 : 0 ); } +static void +s3c4510_bus_prepare( bus_t *bus ) +{ + part_set_instruction( PART, "EXTEST" ); + chain_shift_instructions( CHAIN ); + + /* Do one shift_data_registers to capture current values */ + + s3c4510_bus_setup_ctrl( bus, 0x1FFFF ); + chain_shift_data_registers( chain, 1 ); +} + + static void s3c4510_bus_read_start( bus_t *bus, uint32_t adr ) { @@ -288,11 +294,9 @@ s3c4510_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->start = UINT32_C(0x00000000); area->length = UINT64_C(0x100000000); - // endian = part_get_signal( PART, part_find_signal( PART, "LITTLE" )); - b0size0 = part_get_signal( PART, part_find_signal( PART, "B0SIZE0" )); - if(b0size0==0) // TODO: try again (initialization problem?) - b0size0 = part_get_signal( PART, part_find_signal( PART, "B0SIZE0" )); - b0size1 = part_get_signal( PART, part_find_signal( PART, "B0SIZE1" )); + // endian = part_get_signal( PART, part_find_signal( PART, "LITTLE" )); + b0size0 = part_get_signal( PART, part_find_signal( PART, "B0SIZE0" )); + b0size1 = part_get_signal( PART, part_find_signal( PART, "B0SIZE1" )); switch ((b0size1 << 1) | b0size0) { case 1: