Re: [PATCH v5 1/7] dt-bindings: connector: Add mikrobus-connector

Ayush Singh
2024-09-04T17:08:58Z

>> gpio-map is what you are looking for. It's documented in the DT spec.
>> It was created exactly for this purpose of remapping GPIO lines on a
>> connector.
>>
>> Rob

Hi. I found docs on nexus nodes [1] and tried using it for mikroBUS, but
it does not seem to be working. Here is my connector:

```

mikrobus_gpio0: mikrobus-gpio0 {
#gpio-cells = <2>;
gpio-map =
<0 0 &main_gpio1 11 0>, <1 0 &main_gpio1 9 0>,
<2 0 &main_gpio1 24 0>, <3 0 &main_gpio1 25 0>,
<4 0 &main_gpio1 22 0>, <5 0 &main_gpio1 23 0>,
<6 0 &main_gpio1 7 0>, <7 0 &main_gpio1 8 0>,
<8 0 &main_gpio1 14 0>, <9 0 &main_gpio1 13 0>,
<10 0 &main_gpio1 12 0>, <11 0 &main_gpio1 10 0>;
gpio-map-mask = <0xf 0x0>;
gpio-map-pass-thru = <0x0 0x1>;
};

...

&main_uart5 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&mikrobus_uart_pins_default>;

gnss {
compatible = "u-blox,neo-8";
reset-gpios = <&mikrobus_gpio0 10 GPIO_ACTIVE_LOW>;
};
};

```

After some fdtdump, I can see that at least the dtc compiler does not
seem to do the forwarding at dt compile time. Here is the dump:

```

mikrobus-gpio0 {
#gpio-cells = <0x00000002>;
gpio-map = <0x00000000 0x00000000 0x00000025 0x0000000b
0x00000000 0x00000001 0x00000000 0x00000025 0x00000009 0x00000000
0x00000002 0x00000000 0x00000025 0x00000018 0x00000000 0x00000003
0x00000000 0x00000025 0x00000019 0x00000000 0x00000004 0x00000000
0x00000025 0x00000016 0x00000000 0x00000005 0x00000000 0x00000025
0x00000017 0x00000000 0x00000006 0x00000000 0x00000025 0x00000007
0x00000000 0x00000007 0x00000000 0x00000025 0x00000008 0x00000000
0x00000008 0x00000000 0x00000025 0x0000000e 0x00000000 0x00000009
0x00000000 0x00000025 0x0000000d 0x00000000 0x0000000a 0x00000000
0x00000025 0x0000000c 0x00000000 0x0000000b 0x00000000 0x00000025
0x0000000a 0x00000000>;
gpio-map-mask = <0x0000000f 0x00000000>;
gpio-map-pass-thru = <0x00000000 0x00000001>;
phandle = <0x0000000e>;
};

...

serial@2850000 {
compatible = "ti,am64-uart", "ti,am654-uart";
reg = <0x00000000 0x02850000 0x00000000 0x00000100>;
interrupts = <0x00000000 0x000000b7 0x00000004>;
power-domains = <0x00000003 0x0000009c 0x00000001>;
clocks = <0x00000002 0x0000009c 0x00000000>;
clock-names = "fclk";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <0x0000000d>;
phandle = <0x00000081>;
gnss {
compatible = "u-blox,neo-8";
reset-gpios = <0x0000000e 0x0000000a 0x00000001>;
};
};

```

So I am a bit unsure. Is the dtc parser in the kernel supposed to do the
mapping, or is it supposed to be done by `dtc` at compile time? Maybe we
do not have support for it in upstream kernel yet? Or maybe I am missing
something?

[1]:
https://devicetree-specification.readthedocs.io/en/v0.3/devicetree-basics.html#nexus-nodes-and-specifier-mapping

Ayush Singh