Re: GPIO regression on mvebu and/or max310x since 2ab73c6d8323

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All of the above seems to indicate that there are no GPIO ranges
associated with the pinmux controller, because that's the only reason
why gpiochip_generic_request() wouldn't call into pinctrl to request
the pin for GPIO.

I think it's the other way round: there are no pin_ranges associated with the mvebu's gpiochip, but there definitely are GPIOs registered for the pinctrl. I went looking further, and indeed: nothing calls gpiochip_add_pingroup_range() or gpiochip_add_pin_range().

From the docs it seems that this is supposed to be called by the GPIO (or
pinctrl? or pinmux?) core upon the "gpio-ranges" DT property. Unfortunately, the in-the-tree DTS files have no such property in arch/arm/boot/dts/armada-388-clearfog-base.dts. Is that a bug in these DTS files?

However, the reason why I sent that patch was because the absence of
GPIO ranges would actually cause pinctrl_gpio_request() to crash,

It's interesting because it doesn't crash for me. Are you referring to pinctrl_get_device_gpio_range() which gets called from pinctrl_gpio_request()? If so, I think that that one iterates over all pinctrl devices in the system, and it doesn't seem to care about a particular gpiodev's pin_ranges. It does check a pctldev's gpio_ranges later on in pinctrl_match_gpio_range(), but that's a different thing (a mapping in the opposite direction, right?).

Anyway, I added a few more print/debugs, and here's roughly how it looks on 5.7.1 with 2ab73c6d8323 reverted (and extra debugging):

[    2.313257] i2c-gpio gpio_i2c: GPIO lookup for consumer sda
[    2.313261] i2c-gpio gpio_i2c: using device tree for GPIO lookup
[ 2.313278] gpio gpiochip0: gpiochip_generic_request for offset 25: empty list of ranges, proceeding anyway
[    2.323070] pinctrl_gpio_request: 25:
[    2.326762] pinctrl_get_device_gpio_range: for gpio 25
[ 2.331916] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 25
[    2.341514] pinctrl_gpio_request 25: requesting via _request_gpio
[ 2.347628] armada-38x-pinctrl f1018000.pinctrl: pinmux_request_gpio pin 25 gpio 25 [ 2.355313] armada-38x-pinctrl f1018000.pinctrl: request pin 25 (PIN25) for mvebu-gpio:25 [ 2.355318] armada-38x-pinctrl f1018000.pinctrl: pinmux_request_gpio ret 0
[    2.362211]  got 0
[    2.364233] pinctrl_get_device_gpio_range: for gpio 25
[ 2.369386] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 25
[    2.378987] i2c-gpio gpio_i2c: GPIO lookup for consumer scl
[    2.378989] i2c-gpio gpio_i2c: using device tree for GPIO lookup
[ 2.379000] gpio gpiochip0: gpiochip_generic_request for offset 24: empty list of ranges, proceeding anyway
[    2.388771] pinctrl_gpio_request: 24:
[    2.392441] pinctrl_get_device_gpio_range: for gpio 24
[ 2.397596] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 24
[    2.407192] pinctrl_gpio_request 24: requesting via _request_gpio
[ 2.413302] armada-38x-pinctrl f1018000.pinctrl: pinmux_request_gpio pin 24 gpio 24 [ 2.420985] armada-38x-pinctrl f1018000.pinctrl: request pin 24 (PIN24) for mvebu-gpio:24 [ 2.420989] armada-38x-pinctrl f1018000.pinctrl: pinmux_request_gpio ret 0
[    2.427884]  got 0
[    2.429900] pinctrl_get_device_gpio_range: for gpio 24
[ 2.435055] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 24
[    2.444806] pinctrl_get_device_gpio_range: for gpio 25
[ 2.449964] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 25
[    2.459576] pinctrl_get_device_gpio_range: for gpio 24
[ 2.464736] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 24
[    2.474337] pinctrl_get_device_gpio_range: for gpio 25
[ 2.479489] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 25

(these lines are reported about 200 times...)

[    8.081207] pinctrl_get_device_gpio_range: for gpio 24
[ 8.086362] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 24
[    8.095965] pinctrl_get_device_gpio_range: for gpio 25
[ 8.101117] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 25
[    8.110723] i2c-gpio gpio_i2c: using lines 25 (SDA) and 24 (SCL)

I'm not saying that this is perfect (why is that repeated about 200 times?), but it works. And here's the initial probe along with the in-DTS gpio-hog definitions:

[ 0.050828] armada-38x-pinctrl f1018000.pinctrl: try to register 60 pins ...
[    0.050832] pinctrl core: registered pin 0 (PIN0) on f1018000.pinctrl
...
[    0.050971] pinctrl core: registered pin 59 (PIN59) on f1018000.pinctrl
[    0.050975] armada-38x-pinctrl f1018000.pinctrl: no hogs found
[ 0.051002] armada-38x-pinctrl f1018000.pinctrl: registered pinctrl driver
[    0.051014] armada-38x-pinctrl f1018000.pinctrl: pinctrl_add_gpio_range
[    0.051295] armada-38x-pinctrl f1018000.pinctrl: pinctrl_add_gpio_range
[ 0.051740] gpio gpiochip0: gpiochip_generic_request for offset 19: empty list of ranges, proceeding anyway
[    0.051753] pinctrl_gpio_request: 19:
[    0.051758] pinctrl_get_device_gpio_range: for gpio 19
[ 0.051766] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 19
[    0.051775] pinctrl_gpio_request 19: requesting via _request_gpio
[ 0.051783] armada-38x-pinctrl f1018000.pinctrl: pinmux_request_gpio pin 19 gpio 19 [ 0.051794] armada-38x-pinctrl f1018000.pinctrl: request pin 19 (PIN19) for mvebu-gpio:19 [ 0.051799] armada-38x-pinctrl f1018000.pinctrl: pinmux_request_gpio ret 0
[    0.051805]  got 0
[    0.051813] pinctrl_get_device_gpio_range: for gpio 19
[ 0.051821] armada-38x-pinctrl f1018000.pinctrl: pinctrl_get_device_gpio_range: found a range for GPIO 19
[    0.051833] GPIO line 19 (phy1-reset) hogged as output/low

Unfortunately I'm largely ignorant of the relation between gpio, pinctrl and pinmux, so I'm afraid I cannot dig much further. Should I try to blindly add the "gpio-ranges" into the DTS, for example?

With kind regards,
Jan




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux