]> git.sur5r.net Git - openocd/commitdiff
str9xpec: Find flash controller from the chain.
authorSanteri Salko <santeri.salko@gmail.com>
Thu, 13 Jan 2011 13:21:06 +0000 (15:21 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Fri, 14 Jan 2011 13:55:24 +0000 (14:55 +0100)
Find the flash controller by position since it is before the core,
not after it.

This fixes the problem that str9xpec enable_turbo (or any other
str9xpec command) did not work. (See my post in
http://forum.sparkfun.com/viewtopic.php?f=18&t=25542)

Signed-off-by: Santeri Salko <santeri.salko@gmail.com>
src/flash/nor/str9xpec.c
src/jtag/core.c
src/jtag/jtag.h

index 18761c2f616045103349d4a9ff236634aa609d11..c06e6d163dd707c1c9db3e259a1f54712fe0f248 100644 (file)
@@ -306,7 +306,8 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
        arm7_9 = armv4_5->arch_info;
        jtag_info = &arm7_9->jtag_info;
 
-       str9xpec_info->tap = bank->target->tap;
+       /* The core is the next tap after the flash controller in the chain */
+       str9xpec_info->tap = jtag_tap_by_position(jtag_info->tap->abs_chain_position - 1);
        str9xpec_info->isc_enable = 0;
 
        str9xpec_build_block_list(bank);
index 0c222db91e2193c3b72b0b933e87f80f609daa45..d7e1ccec764e50b93f80727185b08be73af44280 100644 (file)
@@ -216,7 +216,7 @@ void jtag_tap_add(struct jtag_tap *t)
 }
 
 /* returns a pointer to the n-th device in the scan chain */
-static inline struct jtag_tap *jtag_tap_by_position(unsigned n)
+struct jtag_tap *jtag_tap_by_position(unsigned n)
 {
        struct jtag_tap *t = jtag_all_taps();
 
index df01537697dac1d787daad7386df3f13d2ff89ae..6709cf717daef7c734973189b17be1660335c817 100644 (file)
@@ -173,6 +173,7 @@ struct jtag_tap* jtag_all_taps(void);
 const char *jtag_tap_name(const struct jtag_tap *tap);
 struct jtag_tap* jtag_tap_by_string(const char* dotted_name);
 struct jtag_tap* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj);
+struct jtag_tap* jtag_tap_by_position(unsigned abs_position);
 struct jtag_tap* jtag_tap_next_enabled(struct jtag_tap* p);
 unsigned jtag_tap_count_enabled(void);
 unsigned jtag_tap_count(void);