aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/drivers/imx_gpio.c
AgeCommit message (Collapse)AuthorFilesLines
2022-09-18openocd: fix SPDX tag format for files .cAntonio Borneo1-1/+1
With the old checkpatch we cannot use the correct format for the SPDX tags in the file .c, in fact the C99 comments are not allowed and we had to use the block comment. With the new checkpatch, let's switch to the correct SPDX format. Change created automatically through the command: sed -i \ 's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \ $(find src/ contrib/ -name \*.c) Change-Id: I6da16506baa7af718947562505dd49606d124171 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7153 Tested-by: jenkins
2022-07-23openocd: src/jtag: replace the GPL-2.0-or-later license tagAntonio Borneo1-13/+2
Replace the FSF boilerplate with the SPDX tag. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: Ie873d12bb0fb838d0d6252e6b9ca3c2118853e9a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7069 Tested-by: jenkins
2020-07-14jtag/drivers: replace perror() with LOG_ERROR()Antonio Borneo1-2/+2
The function perror() sends the output to stderr, but OpenOCD cannot intercept such output to send it to the log. Replace all occurrences of perror() with LOG_ERROR(), but keeping the same output format of perror(). The replacement is done automatically through: sed -i 's/perror("\([^":]*\)[: ]*")/LOG_ERROR("\1: %s", strerror(errno))/' src/jtag/drivers/*.c Change-Id: I4c140bdb09235d56cfd8bef75da9b56fbe7c2aec Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5728 Tested-by: jenkins
2020-07-14imx_gpio: enable only the transport specific gpioAntonio Borneo1-21/+25
Change-Id: Idb1fabbc1e9385f8c23b643584bf7863ea91ffbf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5557 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-07-14bitbang: split jtag and swd operationsAntonio Borneo1-7/+5
The split in OpenOCD between SWD and JTAG has been already fully implemented. The bitbang driver still keeps a single API write() to drive the output lines. Introduce a new SWD specific API swd_write(). Move the existing SWD bitbang drivers to the new API by extracting the available conditional implementation. Cleanup some function prototype. Remove the now unused global swd_mode, handled implicitly. Rename bitbang_exchange() as bitbang_swd_exchange() to track its scope for SWD only. Change-Id: Ie53080b941cb1ac7a34a1f80bad8bee4e304454d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5555 Tested-by: jenkins
2020-07-13bitbang: remove superfluous switch between jtag and swdAntonio Borneo1-1/+0
The SWD framework already takes care of switching between JTAG and SWD by calling driver's switch_seq() in swd_connect() and in swd_quit(); there is no need for the driver to force the switch again. Remove the extra switch between jtag and swd. Change-Id: I84de4bffb593374b96fce31951c6cc83f92d2578 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5554 Tested-by: jenkins
2020-01-14adapter: switch from struct jtag_interface to adapter_driverAntonio Borneo1-6/+12
To reorganize the adapters code, introduce an adapter_driver struct that contains all the adapter generic part, while keeping in two separate struct the specific API jtag_ops and swd_ops. Move the allocation of *adapter_driver from the JTAG-specific file core.c to the more adapter-specific file adapter.c While splitting the old jtag_interface for every driver, put the fields in the same order as in the struct declaration so we keep a consistent code across all the drivers. While other transport specific API could/would be added as separate ops, nothing is done here for HLA. Change-Id: I2d60f97ac514c0dd2d93a6ec9be66fd9d388dad5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4900 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14swd: get rid of jtag queue to assert/deassert srstAntonio Borneo1-2/+1
The transport SWD uses the JTAG queue to assert/deassert the system reset srst. This is the major inconsistency that has to be removed to properly split JTAG and SWD. Introduce a new driver API, reset(), to controls both the signals trst and srst in the driver, skipping the JTAG queue. Put the new API in struct jtag_interface, even if in this patch it's used for SWD only; the goal is to get it reused by the other transports. Add the implementation of the API in all the drivers that implement SWD. Such implementation is almost the same of the old code in JTAG queue. Create a wrapper adapter_system_reset() to use the new API and remove the SWD specific swd_add_reset(). In the wrapper replace jtag_add_sleep() with jtag_sleep(), because the former uses the JTAG queue too. Rename the old jtag_add_reset() as legacy_jtag_add_reset() with the target to remove it when all drivers would be ported to the new reset API. Create a new jtag_add_reset() that calls the legacy function for drivers still on the old reset API. Use the new API also on JTAG transport for the drivers that can support both SWD and JTAG. For the moment, do not modify the implementation of JTAG-only drivers, which will continue using the usual method. This should be cleaned-up in future commits. Change-Id: I32331c88313f6059b25e12c6bb0156aebc1c074f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4895 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-05-15jtag/drivers/imx_gpio: fixed calls to command_printJan Matyas1-2/+2
Two calls to command_print() in imx_gpio fixed - the first parameter adjusted (CMD_CTX -> CMD) per the changes from this commit: 6cb5ba6f1136df2986850f5c176cb38e34ca1795 Change-Id: I6cb0909439a632d3109edfc68070b9b561f86d49 Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: http://openocd.zylin.com/5176 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2019-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo1-10/+10
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07drivers/imx_gpio: fix usage messagesAntonio Borneo1-2/+18
The notation "(tck tms tdi tdo)* " is incorrect, because it means the quadruple of gpio can be repeated on the command-line. The correct syntax of the command requires instead to provide either all the four gpio numbers (in order to set the values) or to pass an empty command-line (to dump the values previously set). Change the .usage field to "[tck tms tdi tdo]". Change similarly the corresponding .usage field for SWD command. Add the .usage field for the commands that individually set each gpio or gpio property. Dump the previously set values when commands imx_gpio_speed_coeffs or imx_gpio_peripheral_base are executed with empty command-line. Change-Id: Id56a68622817101bd0a46fed1fead6d2cd2b6ec6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5018 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-02-07drivers/imx_gpio: fix polarity of srst and trstAntonio Borneo1-2/+2
The comment above the function is correct, but the code set the GPIO with wrong (reversed) polarity. Change-Id: Ifd09688150d3d2018af73521e0da3926bb1b7f84 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4847 Tested-by: jenkins Reviewed-by: Grzegorz Kostka <kostka.grzegorz@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-25Add read buffer to bitbang, improving performance.Tim Newsome1-9/+15
Previously for every bit scanned OpenOCD would write the bit, wait for that bit to be scanned, and then read the result. This involves at least 2 context switches. Most of the time the next bit scanned does not depend on the last bit we read, so with a buffer we now write a bunch of bits to be scanned all at once, and then we wait for them all to be scanned and have a result. This reduces the time for one testcase where OpenOCD connects to a simulator from 12.30s to 5.35s! Running all our tests went from 13m13s to 3m55s. Change-Id: Ie9fcea043ac1d7877a521125334ed47d4b3e1615 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4312 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-05-31imx_gpio: add mmap based jtag interface for IMX processorsGrzegorz Kostka1-0/+552
For some targets (like nrf51) sysfs driver is too slow. This patch implements memory maped driver for IMX processors. Mostly based on bcm2835gpio. Tested on imx6ul CPU. However, it should work on any NXP IMX CPU. Change-Id: Idace4c98181c6e9c64dd158bfa52631204b5c4a7 Signed-off-by: Grzegorz Kostka <kostka.grzegorz@gmail.com> Reviewed-on: http://openocd.zylin.com/4106 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>