I’ve been trying to update my setup to work on the new kernels that only accept libgpiod.
It seems that it is only possible to ‘activate’ functionalities with the device tree overlays if there is already a ‘driver’ in kernel that supports it, like uart1, uart2, i2c2, etc… But, if I try to use the pins as simple output or input then I fail.
Following the advised new approach https://forum.beagleboard.org/t/debian-12-bookworm-dbto-files/36170, I downloaded the compatible DeviceTree ‘builder’ from https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees, and coded my test.dtso in src/arm/overlays, and then copied the test.dtbo file, generated with ‘make’, to /lib/firmware.
In /boot/uEnv.txt, I then enabled ‘enable_uboot_overlays=1’ and referenced my DTO in uboot_overlay_addr4=/lib/firmware/test.dtbo.
I have tried multiple approaches to get it work with no luck. I will post some of them just so that some kind soul can give me light:
#1 - test01.dtso
/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/am33xx.h>
&am33xx_pinmux {
pinmux_p9_41_input_pu: pinmux_p9_41_input_pu {
pinctrl-single,pins = <
AM33XX_IOPAD(0x09B4, PIN_INPUT_PULLUP | MUX_MODE7) // GPIO0_20
>;
};
};
&ocp {
p9_41_setup {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_p9_41_input_pu>;
};
};
#2 - test02.dtso
/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/am33xx.h>
&{/chosen} {
overlays {
test02.kernel = __TIMESTAMP__;
};
};
/ {
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
P9_41_input_pu_pin: pinmux_P9_41_input_pu_pin {
pinctrl-single,pins = <
AM33XX_IOPAD(0x09b4, PIN_INPUT_PULLUP | MUX_MODE7)
>;
};
};
};
fragment@1 {
target = <&ocp>;
__overlay__ {
my_gpio_user {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&P9_41_input_pu_pin>;
};
};
};
};
With the above 2, when I do gpioget gpiochip3 20 I get the same result ‘0’ regardless if i am grounding the pin or not.
#3 test03.dtso
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = "ti,am33xx";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pinmux_gpio_keys: pinmux-gpio-keys {
pinctrl-single,pins = <
AM33XX_IOPAD(0x09B4, PIN_INPUT_PULLUP | INPUT_EN | MUX_MODE7)
>;
};
};
};
fragment@1 {
target = <&gpio0>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pinmux_gpio_keys>;
status = "okay";
};
};
fragment@2 {
target-path = "/";
__overlay__ {
gpio_keys: gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_gpio_keys>;
status = "okay";
button_p9_41 {
label = "P9_41_BTN";
gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
};
};
};
};
};
With test03 it hangs on boot:
[ 6.495911] pinctrl-single 44e10800.pinmux: Invalid number of rows: 0
[ 6.502518] pinctrl-single 44e10800.pinmux: no pins entries for pinmux-gpio-keys
[ 6.511993] clk: Disabling unused clocks
[ 6.516187] PM: genpd: Disabling unused power domains
[ 6.521897] Waiting for root device /dev/mmcblk0p3...
[ 16.612515] platform 48060000.mmc: deferred probe pending: platform: supplier 44e07000.gpio not ready
I even tried to use the gpio-leds framework, but then I cannot access the pins in userspace, I always get Resource Busy when trying gpioset gpiochip3 20 for example.
I also tried the BBORG_RELAY-00A2.dtbo which already comes with the DeviceTree defaults. And when I try to set any of the defined relays I also get Resource Busy…