ftdi swd: disable SWD output pin during input

* Disables the data output pin while SWD is reading, so that a simple FTDI
   SWD interface can be made by connecting TCK to SWD_CLK and TDI+TDO directly
   to SWDIO. Enabled by setting SWDIO_OE to 0.

Change-Id: I7d3b71cf3f4eea163cb320aff69ed95d219190bd
Signed-off-by: Patrick Stewart <patstew@gmail.com>
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
Reviewed-on: http://openocd.zylin.com/2274
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
This commit is contained in:
Patrick Stewart
2014-08-27 17:17:27 +01:00
committed by Paul Fertser
parent ab25205bbf
commit 1003bc7be7
4 changed files with 130 additions and 2 deletions

View File

@@ -1064,8 +1064,19 @@ static int ftdi_swd_init(void)
static void ftdi_swd_swdio_en(bool enable)
{
struct signal *oe = find_signal_by_name("SWDIO_OE");
if (oe)
ftdi_set_signal(oe, enable ? '1' : '0');
if (oe) {
if (oe->data_mask)
ftdi_set_signal(oe, enable ? '1' : '0');
else {
/* Sets TDI/DO pin (pin 2) to input during rx when both pins are connected
to SWDIO */
if (enable)
direction |= jtag_direction_init & 0x0002U;
else
direction &= ~0x0002U;
mpsse_set_data_bits_low_byte(mpsse_ctx, output & 0xff, direction & 0xff);
}
}
}
/**