mirror of
https://git.code.sf.net/p/openocd/code
synced 2025-07-14 15:14:58 +00:00
Previously, Linux assigned gpiochip numbers sequentially depending on when the chip driver was probed. As RP1 is on the end of a PCIe link, it is probed later than the on-board chips (including expanders connected over SPI/I2C). This meant that RP1's gpiochip assignment was at an offset that could potentially change. A downstream kernel patch now assigns fixed offsets for RP1 and the onboard gpiochips. Query the device tree to get proper GPIO_CHIP index. Change-Id: I759978d4b3021c815a7d9febb41961cd1d3d185c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8650 Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Tested-by: jenkins
37 lines
1.1 KiB
INI
37 lines
1.1 KiB
INI
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# Config for Raspberry Pi 5 used as a bitbang adapter.
|
|
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html
|
|
|
|
# Raspberry Pi 5 is not compatible with bcm2835gpio native GPIO driver.
|
|
# The linuxgpiod driver without configurable adapter speed runs at approximately
|
|
# 800 kHz (SWD writes) and 360 kHz (SWD reads)
|
|
|
|
adapter driver linuxgpiod
|
|
|
|
proc read_file { name } {
|
|
if {[catch {open $name r} fd]} {
|
|
return ""
|
|
}
|
|
set result [read $fd]
|
|
close $fd
|
|
return $result
|
|
}
|
|
|
|
proc find_rp1_alias {} {
|
|
foreach f [glob -directory "/proc/device-tree/aliases" "gpio\[0-9\]"] {
|
|
if {[string match "*/rp1/*" [read_file $f]]} {
|
|
return $f
|
|
}
|
|
}
|
|
}
|
|
|
|
set pcie_aspm [read_file /sys/module/pcie_aspm/parameters/policy]
|
|
if {![string match {*\[performance\]*} $pcie_aspm]} {
|
|
echo "Warn : Switch PCIe power saving off or the first couple of pulses gets clocked as fast as 20 MHz"
|
|
echo "Warn : Issue 'echo performance | sudo tee /sys/module/pcie_aspm/parameters/policy'"
|
|
}
|
|
|
|
set GPIO_CHIP [string index [find_rp1_alias] end]
|
|
source [find interface/raspberrypi-gpio-connector.cfg]
|