19 #define IMX_GPIO_BASE 0x0209c000
20 #define IMX_GPIO_SIZE 0x00004000
21 #define IMX_GPIO_REGS_COUNT 8
215 "imx_gpio GPIO config: tck = %d, tms = %d, tdi = %d, tdo = %d",
285 "imx_gpio GPIO nums: swclk = %d, swdio = %d",
333 .
name =
"imx_gpio_jtag_nums",
334 .handler = &imx_gpio_handle_jtag_gpionums,
336 .help =
"gpio numbers for tck, tms, tdi, tdo. (in that order)",
337 .usage =
"[tck tms tdi tdo]",
340 .name =
"imx_gpio_tck_num",
341 .handler = &imx_gpio_handle_jtag_gpionum_tck,
343 .help =
"gpio number for tck.",
347 .name =
"imx_gpio_tms_num",
348 .handler = &imx_gpio_handle_jtag_gpionum_tms,
350 .help =
"gpio number for tms.",
354 .name =
"imx_gpio_tdo_num",
355 .handler = &imx_gpio_handle_jtag_gpionum_tdo,
357 .help =
"gpio number for tdo.",
361 .name =
"imx_gpio_tdi_num",
362 .handler = &imx_gpio_handle_jtag_gpionum_tdi,
364 .help =
"gpio number for tdi.",
368 .name =
"imx_gpio_swd_nums",
369 .handler = &imx_gpio_handle_swd_gpionums,
371 .help =
"gpio numbers for swclk, swdio. (in that order)",
372 .usage =
"[swclk swdio]",
375 .name =
"imx_gpio_swclk_num",
376 .handler = &imx_gpio_handle_swd_gpionum_swclk,
378 .help =
"gpio number for swclk.",
382 .name =
"imx_gpio_swdio_num",
383 .handler = &imx_gpio_handle_swd_gpionum_swdio,
385 .help =
"gpio number for swdio.",
389 .name =
"imx_gpio_srst_num",
390 .handler = &imx_gpio_handle_jtag_gpionum_srst,
392 .help =
"gpio number for srst.",
396 .name =
"imx_gpio_trst_num",
397 .handler = &imx_gpio_handle_jtag_gpionum_trst,
399 .help =
"gpio number for trst.",
403 .name =
"imx_gpio_speed_coeffs",
404 .handler = &imx_gpio_handle_speed_coeffs,
406 .help =
"SPEED_COEFF and SPEED_OFFSET for delay calculations.",
407 .usage =
"[SPEED_COEFF SPEED_OFFSET]",
410 .name =
"imx_gpio_peripheral_base",
411 .handler = &imx_gpio_handle_peripheral_base,
413 .help =
"peripheral base to access GPIOs (0x0209c000 for most IMX).",
469 LOG_INFO(
"imx_gpio GPIO JTAG/SWD bitbang driver");
472 LOG_ERROR(
"Require tck, tms, tdi and tdo gpios for JTAG mode");
477 LOG_ERROR(
"Require swclk and swdio gpio for SWD mode");
481 dev_mem_fd = open(
"/dev/mem", O_RDWR | O_SYNC);
487 LOG_INFO(
"imx_gpio mmap: pagesize: %u, regionsize: %u",
490 PROT_READ | PROT_WRITE,
541 LOG_DEBUG(
"saved pinmux settings: tck %d tms %d tdi %d "
bool transport_is_swd(void)
Returns true if the current debug session is using SWD as its transport.
int bitbang_execute_queue(struct jtag_command *cmd_queue)
const struct swd_driver bitbang_swd
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
static int trst_gpio_mode
static bool imx_gpio_swd_mode_possible(void)
static int imx_gpio_speed(int speed)
static int imx_gpio_khz(int khz, int *jtag_speed)
struct adapter_driver imx_gpio_adapter_driver
static const char *const imx_gpio_transports[]
static struct jtag_interface imx_gpio_interface
static void gpio_mode_input_set(int g)
static int imx_gpio_write(int tck, int tms, int tdi)
static void imx_gpio_swdio_drive(bool is_output)
static int imx_gpio_speed_div(int speed, int *khz)
static int swdio_gpio_mode
static uint32_t imx_gpio_peri_base
static void gpio_mode_output_set(int g)
static int srst_gpio_mode
static int imx_gpio_quit(void)
static int imx_gpio_init(void)
static int is_gpio_valid(int gpio)
static bool gpio_level(int g)
static int imx_gpio_swd_write(int swclk, int swdio)
struct imx_gpio_regs __attribute__((aligned(IMX_GPIO_SIZE)))
static const struct command_registration imx_gpio_command_handlers[]
COMMAND_HANDLER(imx_gpio_handle_jtag_gpionums)
static void gpio_set(int g)
static void gpio_clear(int g)
static volatile struct imx_gpio_regs * pio_base
static unsigned int jtag_delay
static void gpio_mode_set(int g, int m)
static int swclk_gpio_mode
static struct bitbang_interface imx_gpio_bitbang
static int imx_gpio_swdio_read(void)
#define IMX_GPIO_REGS_COUNT
static int imx_gpio_reset(int trst, int srst)
static bool gpio_mode_get(int g)
static bb_value_t imx_gpio_read(void)
static bool imx_gpio_jtag_mode_possible(void)
#define DEBUG_CAP_TMS_SEQ
bool transport_is_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
#define ERROR_JTAG_INIT_FAILED
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
Represents a driver for a debugging interface.
const char *const name
The name of the interface driver.
Low level callbacks (for bitbang).
bb_value_t(* read)(void)
Sample TDO and return the value.
Represents a driver for a debugging interface.
unsigned int supported
Bit vector listing capabilities exposed by this driver.