drivers: new jtag bitbang driver using sysfs gpio

This driver implements a bitbang jtag interface using gpio lines exported via
sysfs.

The aim of this driver implementation is to use system GPIOs but to avoid the
need for an additional kernel driver.

A config suitable for RaspberryPi is included.

Change-Id: Ib2acf720247a219768d1cbfeebd88057ed2d7b8b
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
Reviewed-on: http://openocd.zylin.com/762
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
This commit is contained in:
Marc Reilly
2012-08-20 09:46:07 +10:00
committed by Freddie Chopin
parent a4830e7a6a
commit fe52282c37
5 changed files with 549 additions and 0 deletions

View File

@@ -487,6 +487,10 @@ AC_ARG_ENABLE([opendous],
AS_HELP_STRING([--enable-opendous], [Enable building support for the estick/opendous JTAG Programmer]),
[build_opendous=$enableval], [build_opendous=no])
AC_ARG_ENABLE([sysfsgpio],
AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
[build_sysfsgpio=$enableval], [build_sysfsgpio=no])
AC_ARG_ENABLE([minidriver_dummy],
AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
[build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
@@ -819,6 +823,12 @@ else
AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
fi
if test $build_sysfsgpio = yes; then
build_bitbang=yes
AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
else
AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
fi
#-- Deal with MingW/Cygwin FTD2XX issues
if test $is_win32 = yes; then
@@ -1185,6 +1195,7 @@ AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
AM_CONDITIONAL([STLINK], [test $build_stlink = yes])
AM_CONDITIONAL([OSBDM], [test $build_osbdm = yes])
AM_CONDITIONAL([OPENDOUS], [test $build_opendous = yes])
AM_CONDITIONAL([SYSFSGPIO], [test $build_sysfsgpio = yes])
AM_CONDITIONAL([USB], [test $build_usb = yes])
AM_CONDITIONAL([USB_NG], [test $build_usb_ng = yes])
AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])

View File

@@ -107,6 +107,9 @@ endif
if OPENDOUS
DRIVERFILES += opendous.c
endif
if SYSFSGPIO
DRIVERFILES += sysfsgpio.c
endif
noinst_HEADERS = \
bitbang.h \

File diff suppressed because it is too large Load Diff

View File

@@ -113,6 +113,9 @@ extern struct jtag_interface osbdm_interface;
#if BUILD_OPENDOUS == 1
extern struct jtag_interface opendous_interface;
#endif
#if BUILD_SYSFSGPIO == 1
extern struct jtag_interface sysfsgpio_interface;
#endif
#endif /* standard drivers */
/**
@@ -194,6 +197,9 @@ struct jtag_interface *jtag_interfaces[] = {
#if BUILD_OPENDOUS == 1
&opendous_interface,
#endif
#if BUILD_SYSFSGPIO == 1
&sysfsgpio_interface,
#endif
#endif /* standard drivers */
NULL,
};

View File

@@ -0,0 +1,24 @@
#
# Config for using RaspberryPi's expansion header
#
# This is best used with a fast enough buffer but also
# is suitable for direct connection if the target voltage
# matches RPi's 3.3V
#
# Do not forget the GND connection, pin 6 of the expansion header.
#
interface sysfsgpio
# This has no effect on the driver, but is required
adapter_khz 100
# Each of the JTAG lines need a gpio number set: tck tms tdi tdo
# Header pin numbers: 23 22 19 21
sysfsgpio_jtag_nums 11 25 10 9
# At least one of srst or trst needs to be specified
# Header pin numbers: TRST - 26, SRST - 18
sysfsgpio_trst_num 7
# sysfsgpio_srst_num 24