I'm new to Linux and I have the following problem. Unfortunately, I was not able to find appropriate information on the web, which helped me to solve it.
I have a Linux system here and a PCIe-to-UART converter from MaxLinear (XR17V358) connected to it. To enable support for this converter, I have activated the exar-serial driver in the kernel config. Furthermore, this XR17V358 provides 16 GPIOs, which can be freely used. There is also a kernel driver available to enable these GPIOs (exar-gpio) and I have also activated it in the kernel config. As a first step, all seems to work fine. There are ttyS0 to ttyS7 created in the /dev directory and I'm able to send and receive data. Also, a gpiochip472 is created in /sys/class/gpio and I'm able to export the 16 GPIOs manually and use them as expected.
So far so good...
Now I don't want to export the GPIOs manually after boot but automatically. For example, some LEDs are connected to the GPIOs of XR17V358 and I'd like to export these LEDs in /sys/class/leds via the device tree. I have searched for information, on how to export the GPIOs via device tree but the only information I could find was in https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio-exar.txt:
Exportable MPIO interface of Exar UART chips
Required properties of the device:
- exar,first-pin: first exportable pins (0..15)
- ngpios: number of exportable pins (1..16)
I have then tried to describe a node of this XR17V358 GPIO controller like this:
fragment@1001 {
target-path = "/";
__overlay__ {
gpio_exar: gpio@18100000 {
compatible = "exar,gpio_exar";
exar,first-pin = <0>;
ngpios = <16>;
status = "okay";
};
};
};
...and refer to it in the leds-node:
fragment@1002 {
target-path = "/";
__overlay__ {
leds {
pinctrl-names = "default";
compatible = "gpio-leds";
status = "okay";
led0 {
label = "led1";
gpios = <&gpio_exar 2 GPIO_ACTIVE_HIGH>;
default-state = "off";
linux,default-trigger = "none";
};
};
};
};
I'm sure, that LEDs-node implementation should be okay because in the same way, I'm able to export any native GPIO of the SoC. My problem seems to be, that I cannot correctly bind exar-gpio driver to device tree node.
When I have a look into driver code gpio-exar.c, there seems not to be any code block, which declares a "compatible" name for the driver. Also, the properties exar,first-pin
as well as ngpios
seem not to be read out from a device tree node. Instead, it seems, that these values come from the exar-serial driver (8250_exar.c) and in that driver code, the values are hard coded.
So my question is, what I'm doing wrong? Or is there no possibility at all to make any device tree binding to this exar-gpio driver?