[LEDE-DEV] [PATCH 2/3] ramips-mt7621: add GPIO-config for Ubiquiti-EdgeRouterX(-SFP)
Sven Roederer
devel-sven at geroedel.de
Sun May 14 13:13:23 PDT 2017
On Sonntag, 14. Mai 2017 21:22:42 CEST Sven Roederer wrote:
>
> I removed the 03_gpio_export and added this to the dts:
> gpio_export {
> compatible = "gpio-export";
> #size-cells = <0>;
>
> poe_passthrough {
> gpio-export,name = "poe_power_port0";
> gpio-export,output = <1>;
> gpios = <&gpio0 496 0>;
> };
> };
>
> But booting this kernel gives:
> [ 1.660000] ------------[ cut here ]------------
> [ 1.670000] WARNING: CPU: 0 PID: 1 at drivers/gpio/gpiolib.c:85 0x801dc2fc()
> [ 1.680000] invalid GPIO -22
> [ 1.690000] Modules linked in:
> [ 1.690000] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.61 #0
> [ 2.120000] ---[ end trace ceab04cd8881362f ]---
> [ 2.130000] gpiod_request: invalid GPIO
> [ 2.140000] gpio-export gpio_export: 0 gpio(s) exported
>
>
> I'm wondering on the "GPIO -22". Checking the source of
> drivers/gpio/gpiolib.c shows gpio is of type unsigned, large enough to
> handle gpio#496.
>
> Any Idea what's going on?
> Probably it's something related to the SoC-gpios and the additional pins defined from the pca9555
>
When using the following dts-file it improves, a bit:
/ {
model = "UBNT-ERX-SFP";
i2c-gpio {
compatible = "i2c-gpio";
gpios = <&gpio0 3 GPIO_ACTIVE_HIGH /* sda */
&gpio0 4 GPIO_ACTIVE_HIGH /* scl */
>;
#address-cells = <1>;
#size-cells = <0>;
gpio_pca: pca9555 at 25 {
compatible = "pca9555";
reg = <0x25>;
};
};
gpio_export {
compatible = "gpio-export";
#size-cells = <0>;
poe_passthrough {
gpio-export,name = "poe_power_port0";
gpio-export,output = <1>;
gpios = <&gpio_pca 0 0>;
};
};
};
I think I got the trick to define a name for the PCA-gpio-chip and
reference it in the gpio-export section.
But it fails now with
[ 1.640000] /gpio_export/poe_passthrough: could not get #gpio-cells for /i2c-gpio/pca9555 at 25
[ 1.660000] ------------[ cut here ]------------
[ 1.670000] WARNING: CPU: 3 PID: 1 at drivers/gpio/gpiolib.c:85 0x801dc2fc()
[ 1.680000] invalid GPIO -22
[ 1.690000] Modules linked in:
[ 1.690000] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.4.61 #0
seems not to find the i2c-pca and it's gpios, as these modules are not
compile into the kernel.
[ 10.460000] kmodloader: loading kernel modules from /etc/modules.d/*
[ 10.470000] i2c /dev entries driver
[ 10.480000] pca953x 0-0025: interrupt support not compiled in
[ 10.500000] i2c-gpio i2c-gpio: using pins 3 (SDA) and 4 (SCL)
[ 10.510000] PPP generic driver version 2.4.2
They will load during init.scripts.
I see following options:
- use the 03-gpio script in board.d
- compile the drivers into the kernel, but will this be done for all
mt7621-kernels?
More information about the Lede-dev
mailing list