It seems that the devices gpio0 and gpio1 are swapped by the kernel when it probes a Beaglebone Black (but gpio2 and gpio3 seem ok). The following is how they are described in the device tree file. These lines are taken from sys/external/gpl2/dts/dist/arch/arm/boot/dts/am33xx-l4.dtsi, and are the identifiers for the modules that contain the indicated device tree nodes. Note the addresses given in the comments, which correspond to those listed in tables 2.2 and 2.3 in the TI AM335x Technical Reference Manual (https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf). See the attached file am33xx-l4.dtsi for the full contents. gpio0 -- gpio0_target: target-module@7000 { /* 0x44e07000, ap 14 20.0 */ gpio1 -- target-module@4c000 { /* 0x4804c000, ap 32 36.0 */ gpio2 -- target-module@ac000 { /* 0x481ac000, ap 54 38.0 */ gpio3 -- gpio3_target: target-module@ae000 { /* 0x481ae000, ap 56 3a.0 */ However, the following is an excerpt of dmesg showing how the GPIO devices are probed (see the attached file for the full contents). Notice that the addresses given for tigpio0 and tigpio1 are reversed from those in the device tree file. [ 1.0000000] tigpio0 at tisysc4: GPIO (gpio@4804c000) [ 1.0000000] gpio0 at tigpio0: 32 pins [ 1.0000000] tigpio0: interrupting on INTC irq 98 [ 1.0000000] tigpio1 at tisysc8: GPIO (gpio@44e07000) [ 1.0000000] gpio1 at tigpio1: 32 pins [ 1.0000000] tigpio1: interrupting on INTC irq 96 [ 1.0000000] tigpio2 at tisysc40: GPIO (gpio@481ac000) [ 1.0000000] gpio2 at tigpio2: 32 pins [ 1.0000000] tigpio2: interrupting on INTC irq 32 [ 1.0000000] tigpio3 at tisysc41: GPIO (gpio@481ae000) [ 1.0000000] gpio3 at tigpio3: 32 pins [ 1.0000000] tigpio3: interrupting on INTC irq 62 In order to control a pin connected to either of these controllers (but not for example gpio2), the device must be swapped between gpio0 and gpio1 in the gpioctl command line. For example, the first LED is wired to gpio1, pin 21; however, the command to control it is "gpioctl gpio0 21”. Why are these devices (but not others) being probed incorrectly? Thanks for your help. Cheers, Brook
Attachment:
dmesg
Description: Binary data
Attachment:
am33xx-l4.dtsi
Description: Binary data