Do you know how to set the GPIO bank number
in the device tree for an i2c gpio controller
?
I tried with gpio-base
(described in the gpio driver doc) but it was not very conclusive.
I have a device tree:
...
&i2c2 {
pca9502: pca9502@4C {
compatible = "nxp,pca9502";
reg = <0x4C>;
gpio-controller;
/* HERE */
gpio-base = <1>;
}
}
...
and the driver fetch the DT to find the gpio-base:
of_get_property(dev.of_node, "gpio-base", NULL);
In this case, a gpiochip
is created with the number 2^32
giving: gpiochip16777216
. And I can't access my GPIO using echo XX > export
.
When I don't add gpio-base = <1>;
, it works but the gpiochip
number is 504 (with -1 as a default bank number) which I don't understand.
I don't know how to define the bank number
into the device tree.
Well, my issue was not linked with the device tree structure but with the endianness
of the processor.