aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2023-05-13 06:39:48 +0200
committerTomas Vanek <vanekt@fbl.cz>2023-05-24 05:27:02 +0000
commit5c46a5de49f5dd14227b9444a5815eaaadd7ceb4 (patch)
treee4f71f2e6dbe9e9ae72c44c8f7deba929f251b97 /doc
parentb41b368255d53d9561851900eeeba38b12720a82 (diff)
downloadriscv-openocd-5c46a5de49f5dd14227b9444a5815eaaadd7ceb4.zip
riscv-openocd-5c46a5de49f5dd14227b9444a5815eaaadd7ceb4.tar.gz
riscv-openocd-5c46a5de49f5dd14227b9444a5815eaaadd7ceb4.tar.bz2
jtag/drivers/bcm2835gpio: add peripheral_mem_dev config command
The bcm2835gpio driver preferred /dev/gpiomem for access to memory mapped GPIO control and used /dev/mem as a fallback only if it couldn't open /dev/gpiomem. /dev/mem usually requires elevated rights or specific capabilities of the opening process, so the fallback failed anyway. Although /dev/gpiomem is the strongly preferred option with respect to security, there could be also use cases which require /dev/mem even if /dev/gpiomem is available (e.g. changing the GPIO pad settings is necessary or testing/debugging OpenOCD). It was difficult to handle such cases because they required to block globally the system device /dev/gpiomem (remove, rename or chmod). Drop the fallback feature and select the memory device by 'bcm2835gpio peripheral_mem_dev' configuration command. Use /dev/gpiomem as a default. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I60e427bda795d7a13d55d61443590dd31d694832 Reviewed-on: https://review.openocd.org/c/openocd/+/7350 Tested-by: jenkins Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/openocd.texi23
1 files changed, 18 insertions, 5 deletions
diff --git a/doc/openocd.texi b/doc/openocd.texi
index f27e17c..d0bc3f9 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3292,10 +3292,6 @@ configuration on exit.
GPIO numbers >= 32 can't be used for performance reasons. GPIO configuration is
handled by the generic command @ref{adapter gpio, @command{adapter gpio}}.
-/dev/gpiomem is preferred for GPIO mapping with fallback to /dev/mem.
-If /dev/mem is used GPIO 0-27 pads are set to the limited
-slew rate and drive strength is reduced to 4 mA (2 mA on RPi 4).
-
See @file{interface/raspberrypi-native.cfg} for a sample config and
@file{interface/raspberrypi-gpio-connector.cfg} for pinout.
@@ -3304,8 +3300,25 @@ Set SPEED_COEFF and SPEED_OFFSET for delay calculations. If unspecified,
speed_coeff defaults to 113714, and speed_offset defaults to 28.
@end deffn
+@deffn {Config Command} {bcm2835gpio peripheral_mem_dev} @var{device}
+Set the device path for access to the memory mapped GPIO control registers.
+Uses @file{/dev/gpiomem} by default, this is also the preferred option with
+respect to system security.
+If overridden to @file{/dev/mem}:
+@itemize @minus
+@item OpenOCD needs @code{cap_sys_rawio} or run as root to open @file{/dev/mem}.
+Please be aware of security issues imposed by running OpenOCD with
+elevated user rights and by @file{/dev/mem} itself.
+@item correct @command{peripheral_base} must be configured.
+@item GPIO 0-27 pads are set to the limited slew rate
+and drive strength is reduced to 4 mA (2 mA on RPi 4).
+@end itemize
+
+@end deffn
+
@deffn {Config Command} {bcm2835gpio peripheral_base} @var{base}
-Set the peripheral base register address to access GPIOs. For the RPi1, use
+Set the peripheral base register address to access GPIOs.
+Ignored if @file{/dev/gpiomem} is used. For the RPi1, use
0x20000000. For RPi2 and RPi3, use 0x3F000000. For RPi4, use 0xFE000000. A full
list can be found in the
@uref{https://www.raspberrypi.org/documentation/hardware/raspberrypi/peripheral_addresses.md, official guide}.