aboutsummaryrefslogtreecommitdiff
path: root/tcl/target/quark_d20xx.cfg
blob: ca8f4406a5539da76d6412610e63937ebc32c4b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# SPDX-License-Identifier: GPL-2.0-or-later

if { [info exists CPUTAPID] } {
   set _CPUTAPID $CPUTAPID
} else {
   set _CPUTAPID 0x38289013
}

jtag newtap quark_d20xx quark -irlen 8 -irmask 0xff -expected-id $_CPUTAPID -disable
jtag newtap quark_d20xx cltap -irlen 8 -irmask 0xff -expected-id 0x0e786013 -enable

proc quark_d20xx_tapenable {} {
	echo "enabling quark core tap"
	irscan quark_d20xx.cltap 0x11
	drscan quark_d20xx.cltap 12 1
	runtest 10
}

proc quark_d20xx_tapdisable {} {
	echo "disabling quark core tap"
	irscan quark_d20xx.cltap 0x11
	drscan quark_d20xx.cltap 12 0
	runtest 10
}

proc quark_d20xx_setup {} {
	jtag tapenable quark_d20xx.quark
}

jtag configure quark_d20xx.quark -event tap-enable \
   "quark_d20xx_tapenable"

jtag configure quark_d20xx.quark -event tap-disable \
   "quark_d20xx_tapdisable"

target create quark_d20xx.quark quark_d20xx -endian little -chain-position quark_d20xx.quark

quark_d20xx.quark configure -event reset-start {
	# need to halt the target to write to memory
	if {[quark_d20xx.quark curstate] ne "halted"} { halt }
	# set resetbreak via the core tap
	irscan quark_d20xx.quark 0x35 ; drscan quark_d20xx.quark 1 0x1
	# trigger a warm reset
	mww 0xb0800570 0x2
	# clear resetbreak
	irscan quark_d20xx.quark 0x35 ; drscan quark_d20xx.quark 1 0x0
}

jtag configure quark_d20xx.quark -event setup \
   "quark_d20xx_setup"