From ec02ca7aa89a1010d19c081b0376c5e43dc04f66 Mon Sep 17 00:00:00 2001
From: Michel JAOUEN <michel.jaouen@stericsson.com>
Date: Tue, 12 Apr 2011 18:24:50 +0200
Subject: [PATCH 2/3] cortex_a :  multiple target on the same dap

---
 src/jtag/jtag.h       |    2 ++
 src/target/cortex_a.c |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 6709cf7..a3ce371 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -164,6 +164,8 @@ struct jtag_tap {
 	struct jtag_tap_event_action *event_action;
 
 	struct jtag_tap* next_tap;
+	/* dap instance if some null if no instance , initialized to 0 by calloc*/
+	struct adiv5_dap *dap; 
 };
 
 void jtag_tap_init(struct jtag_tap *tap);
diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c
index f81f069..74516d2 100644
--- a/src/target/cortex_a.c
+++ b/src/target/cortex_a.c
@@ -1959,6 +1959,11 @@ static int cortex_a8_init_arch_info(struct target *target,
 
 	/* Setup struct cortex_a8_common */
 	cortex_a8->common_magic = CORTEX_A8_COMMON_MAGIC;
+	/*  tap has no dap initialized */
+	if (!tap->dap)
+	{
+	armv7a->armv4_5_common.dap = dap;
+	/* Setup struct cortex_a8_common */
 	armv4_5->arch_info = armv7a;
 
 	/* prepare JTAG information for the new target */
@@ -1971,6 +1976,11 @@ static int cortex_a8_init_arch_info(struct target *target,
 
 	/* Number of bits for tar autoincrement, impl. dep. at least 10 */
 	dap->tar_autoincr_block = (1 << 10);
+	dap->memaccess_tck = 80;
+	tap->dap = dap;
+    }
+	else
+	armv7a->armv4_5_common.dap = tap->dap;
 
 	cortex_a8->fast_reg_read = 0;
 
-- 
1.7.1

