This is an automated email from Gerrit. "Name of user not set <chris.whee...@narfindustries.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8140
-- gerrit commit c77a436bead7357194233b6f0dbfb27950784b6e Author: WheelNarf <chris.whee...@narfindustries.com> Date: Mon Feb 12 10:23:25 2024 -0800 jtag/drivers/imx_gpio: add configurable gpio address space size to accommodate other imx chips. Fix style/formatting errors Change-Id: I1f462e318acc04f249696938b69af781570f2b1b Signed-off-by: WheelNarf <chris.whee...@narfindustries.com> diff --git a/src/jtag/drivers/imx_gpio.c b/src/jtag/drivers/imx_gpio.c index 7227899860..e9f2b76982 100644 --- a/src/jtag/drivers/imx_gpio.c +++ b/src/jtag/drivers/imx_gpio.c @@ -20,7 +20,7 @@ #define IMX_GPIO_SIZE 0x00004000 #define IMX_GPIO_REGS_COUNT 8 -#define IMX_GPIO_REGS_DR (sizeof(uint32_t) * 0) +#define IMX_GPIO_REGS_DR (sizeof(uint32_t) * 0) #define IMX_GPIO_REGS_GDIR (sizeof(uint32_t) * 1) #define IMX_GPIO_REGS_PSR (sizeof(uint32_t) * 1) #define IMX_GPIO_REGS_ICR1 (sizeof(uint32_t) * 1) @@ -35,7 +35,7 @@ static uint32_t imx_gpio_peri_size = IMX_GPIO_SIZE; static int dev_mem_fd; /* imx_gpio_peri_size is in bytes so using 1 byte pointer to be able to address arbitrary sizes for different chips */ -static volatile uint8_t *pio_base = 0; +static volatile uint8_t *pio_base; /* GPIO setup functions */ static inline bool gpio_mode_get(int g) @@ -65,7 +65,7 @@ static inline void gpio_set(int g) static inline void gpio_clear(int g) { - pio_base[(g /32) * imx_gpio_peri_size + IMX_GPIO_REGS_DR] &= ~(1u << (g & 0x1F)); + pio_base[(g / 32) * imx_gpio_peri_size + IMX_GPIO_REGS_DR] &= ~(1u << (g & 0x1F)); } static inline bool gpio_level(int g) @@ -212,6 +212,10 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionums) return ERROR_COMMAND_SYNTAX_ERROR; } + if( tck_gpio / 32 >= IMX_GPIO_REGS_COUNT || tms_gpio / 32 >= IMX_GPIO_REGS_COUNT || tdi_gpio / 32 >= IMX_GPIO_REGS_COUNT || tdo_gpio / 32 >= IMX_GPIO_REGS_COUNT) { + return ERROR_JTAG_INIT_FAILED; + } + command_print(CMD, "imx_gpio GPIO config: tck = %d, tms = %d, tdi = %d, tdo = %d", tck_gpio, tms_gpio, tdi_gpio, tdo_gpio); @@ -424,7 +428,7 @@ static const struct command_registration imx_gpio_command_handlers[] = { .help = "peripheral base to access GPIOs (0x0209c000 for most IMX).", .usage = "[base]", }, - { + { .name = "imx_gpio_peripheral_size", .handler = &imx_gpio_handle_peripheral_size, .mode = COMMAND_CONFIG, @@ -490,15 +494,6 @@ static int imx_gpio_init(void) LOG_ERROR("Require tck, tms, tdi and tdo gpios for JTAG mode"); return ERROR_JTAG_INIT_FAILED; } - - if(transport_is_jtag()) { - if( tck_gpio / 32 >= IMX_GPIO_REGS_COUNT || - tms_gpio / 32 >= IMX_GPIO_REGS_COUNT || - tdi_gpio / 32 >= IMX_GPIO_REGS_COUNT || - tdo_gpio / 32 >= IMX_GPIO_REGS_COUNT ) { - return ERROR_JTAG_INIT_FAILED; - } - } if (transport_is_swd() && !imx_gpio_swd_mode_possible()) { LOG_ERROR("Require swclk and swdio gpio for SWD mode"); --