AM3358: GPIO Mapping under Linux v6.6

Part Number: AM3358

Tool/software:

Hello

I'm upgrading our AM3358-based board from the ti-linux 5.4 kernel to the ti-linux 6.6 kernel and have some issues relating to the GPIO pin mapping. I understand that there have been changes to the 6.6 kernel to deprecate use of the sysfs interface, so I'm trying to move to using libgpiod.

Under the ti-linux 5.4 series kernel the GPIO 'chips' were probed/enumerated in ascending address order, i.e. 44e07000, 4804c000, 481ac000 and 481ae000, which would result in the processor and device tree (DT) chip numbers matching the 'gpiochipN' device under Linux. For example, CPU pin GPIO1_22 would map to /dev/gpiochip1 pin 22, CPU pin GPIO3_15 would map to /dev/gpiochip3 pin 15 etc. With the ti-linux 6.6 series kernel the GPIO devices are probed/enumerated in a different order (4804c000, 481ac000, 481ae000 and 44e07000) leading to a mismatch between the processor/DT numbering and the numbering under Linux, so CPU pin GPIO1_22 now maps to /dev/gpiochip0 pin 22 etc. I do have signal names allocated to the GPIO pins that I want to use, however it seems that there is no method in the libgpiod v2.x library to determine which chip a signal belongs to and I'm not sure that it is safe to assume that the new order is fixed.

Any ideas relating to the following questions would be gratefully received:

1) Is there any way to make the GPIO devices enumerate in the same sequence as they did under the 5.4 series kernel? The mismatch between the processor pins (plus device tree names) and the Linux chip device could lead to serious confusion, especially if the devices can enumerate in a random order.

2) Assuming that the enumeration of GPIO devices under the 6.6 series kernel may be random is there any way of determining which chip a signal belongs to other than checking the signal names for each chip device?

Thanks

Mark