jtag: drivers: bcm2835gpio: don't allow GPIOs > 31

Current code assumes all the GPIO signals are manipulated via a single
32-bit register so using higher GPIOs silently fails.

Fix the check instead of trying to handle additional GPIOs (available on
Raspberry Pi Compute Modules) as that would slow the driver down.

Change-Id: Ib3b5864afb3b972d952f9b74665201cd93924959
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6658
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Paul Fertser 2021-10-09 23:32:01 +03:00 committed by Antonio Borneo
parent 4afd8852bb
commit da434d7d59
2 changed files with 3 additions and 1 deletions

View File

@ -3207,6 +3207,8 @@ able to coexist nicely with both sysfs bitbanging and various
peripherals' kernel drivers. The driver restores the previous
configuration on exit.
GPIO numbers >= 32 can't be used for performance reasons.
See @file{interface/raspberrypi-native.cfg} for a sample config and
pinout.

View File

@ -198,7 +198,7 @@ static int bcm2835gpio_speed(int speed)
static int is_gpio_valid(int gpio)
{
return gpio >= 0 && gpio <= 53;
return gpio >= 0 && gpio <= 31;
}
COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionums)