jtag/drivers/ftdi: require defining SWD_EN signal for SWD mode
Use a special signal instead of a dedicated swd mask. Amend jtag-lock-pick_tiny_2 config accordingly. Change-Id: Ifb007a0b5434b590c52f936efd5f5458e913e2e4 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2183 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins__archive__
parent
64d02ccf82
commit
bf96df255e
|
@ -127,8 +127,6 @@ static uint16_t output;
|
|||
static uint16_t direction;
|
||||
static uint16_t jtag_output_init;
|
||||
static uint16_t jtag_direction_init;
|
||||
static uint16_t swd_output_init;
|
||||
static uint16_t swd_direction_init;
|
||||
|
||||
static int ftdi_swd_switch_seq(struct adiv5_dap *dap, enum swd_special_seq seq);
|
||||
|
||||
|
@ -634,8 +632,19 @@ static int ftdi_initialize(void)
|
|||
if (!mpsse_ctx)
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
|
||||
output = swd_mode ? swd_output_init : jtag_output_init;
|
||||
direction = swd_mode ? swd_direction_init : jtag_direction_init;
|
||||
output = jtag_output_init;
|
||||
direction = jtag_direction_init;
|
||||
|
||||
if (swd_mode) {
|
||||
struct signal *sig = find_signal_by_name("SWD_EN");
|
||||
if (!sig) {
|
||||
LOG_ERROR("SWD mode is active but SWD_EN signal is not defined");
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
/* A dummy SWD_EN would have zero mask */
|
||||
if (sig->data_mask)
|
||||
ftdi_set_signal(sig, '1');
|
||||
}
|
||||
|
||||
mpsse_set_data_bits_low_byte(mpsse_ctx, output & 0xff, direction & 0xff);
|
||||
mpsse_set_data_bits_high_byte(mpsse_ctx, output >> 8, direction >> 8);
|
||||
|
@ -707,17 +716,6 @@ COMMAND_HANDLER(ftdi_handle_layout_init_command)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(ftdi_handle_layout_init_swd_command)
|
||||
{
|
||||
if (CMD_ARGC != 2)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], swd_output_init);
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], swd_direction_init);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(ftdi_handle_layout_signal_command)
|
||||
{
|
||||
if (CMD_ARGC < 1)
|
||||
|
@ -863,17 +861,7 @@ static const struct command_registration ftdi_command_handlers[] = {
|
|||
.handler = &ftdi_handle_layout_init_command,
|
||||
.mode = COMMAND_CONFIG,
|
||||
.help = "initialize the FTDI GPIO signals used "
|
||||
"to control output-enables and reset signals"
|
||||
"when JTAG mode is selected",
|
||||
.usage = "data direction",
|
||||
},
|
||||
{
|
||||
.name = "ftdi_layout_init_swd",
|
||||
.handler = &ftdi_handle_layout_init_swd_command,
|
||||
.mode = COMMAND_CONFIG,
|
||||
.help = "initialize the FTDI GPIO signals used "
|
||||
"to control output-enables and reset signals"
|
||||
"when SWD mode is selected",
|
||||
"to control output-enables and reset signals",
|
||||
.usage = "data direction",
|
||||
},
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ ftdi_device_desc "JTAG-lock-pick Tiny 2"
|
|||
ftdi_vid_pid 0x0403 0x8220
|
||||
|
||||
ftdi_layout_init 0x8c28 0xff3b
|
||||
ftdi_layout_init_swd 0xac08 0xff3b
|
||||
ftdi_layout_signal SWD_EN -ndata 0x0020 -oe 0x2000
|
||||
ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400
|
||||
ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800
|
||||
ftdi_layout_signal SWDIO_OE -ndata 0x1000
|
||||
|
|
Loading…
Reference in New Issue