Hi team,
I’ve been having issues trying to add custom defined GPIOs in Torizon even with the latest images (Colibri iMX8X V1.0B, so recompiled with Yocto to get the correct machine).
Very simple change: 2 pins (SODIMM 28 and 30) that are not originally defined as GPIO, define them as GPIO. By default, gpioset
won’t do anything.
Following some other posts I tried using the below dts but the kernel won’t boot (Stuck at “Starting kernel”). I checked that several customers had the same issue when trying to change GPIOs pinmux:
/dts-v1/;
/plugin/;
#include </device-tree-overlays/include/dt-bindings/pinctrl/pads-imx8qxp.h>
/ {
compatible = "toradex";
fragment@0 {
target = <&iomuxc>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_my_gpios>;
pinctrl_my_gpios: gpiomuxgrp {
fsl,pins = <
SC_P_UART1_TX_LSIO_GPIO0_IO21 0x41
SC_P_UART1_RX_LSIO_GPIO0_IO22 0x41
>;
};
};
};
};
Even without any pins at fsl,pins
, the module won’t boot. My thoughts are that this overlay overwrites ALL of the iomuxc node.
After checking the original device tree I managed to make it work by “hijacking” one of the already activated nodes pinctrl_ext_io0
:
/dts-v1/;
/plugin/;
#include </device-tree-overlays/include/dt-bindings/pinctrl/pads-imx8qxp.h>
/ {
compatible = "toradex";
fragment@0 {
target = <&pinctrl_ext_io0>;
__overlay__ {
fsl,pins = <
SC_P_UART1_TX_LSIO_GPIO0_IO21 0x41
SC_P_UART1_RX_LSIO_GPIO0_IO22 0x41
>;
};
};
fragment@1{
target = <&pwm0>;
__overlay__ {
status = "disabled";
};
};
fragment@2{
target = <&pwm1>;
__overlay__ {
status = "disabled";
};
};
};
Needless to say, this is not ideal since we are overwritting stuff. What would be the correct way in changing these GPIOs? Thanks.
In case we cannot create new nodes directly in iomuxc without rewritting the whole node, an idea: Add an empty pinctrl node inside iomuxc called “custom_gpios”, activated by default, that the customers can target and overwrite without touching iomuxc (avoiding breaking the kernel).