Does PINCTRL work on BB xM, kernel v. 3.11?

Trying to dump the pinmux states (/sys/kernel/debug/pinctrl/48002030.pinmux/pins) in 3.11 seems to cause a kernel crash:
http://paste.ubuntu.com/6302171/

GPIO access via /sys/class/gpio appears to be nonoperational in 3.11. It looks like a reasonable assumption that GPIOs may not be muxed into the GPIO pins.

I tried to add a devicetree entry to to force-mux GPIOs:

&omap3_pmx_core {
vvv_gpio_pins: pinmux_gpio_pins {
pinctrl-single,pins = <
0x134 (PIN_OUTPUT | MUX_MODE4) /* gpio_137 /
0x135 (PIN_OUTPUT | MUX_MODE4) /
gpio_138 /
0x136 (PIN_OUTPUT | MUX_MODE4) /
gpio_139 */

;
};
};

&ocp {
gpio_helper: helper {
compatible = “ti,omap3-gpio”;
pinctrl-names = “default”;
pinctrl-0 = <&vvv_gpio_pins>;
status = “okay”;
};
};

Doesn’t seem to do anything. The only indication that the kernel is actually trying to parse the fake “helper” device is these lines in the message log:

[    0.369201] omap_gpio helper.26: could not find pctldev for node /ocp/pinmux@48002030/pinmux_gpio_pins, deferring probe
[    0.369232] platform helper.26: Driver omap_gpio requests probe deferral
<...>
[    3.354125] omap_gpio helper.26: Invalid IRQ resource

Obviously, I have no idea what “compatible” driver should I chose, omap3_gpio just sounded like something that could fit. For BBB they reference bone-pinmux-helper, which I assume is BBB-specific?

Thanks!

Well, so I think I understand a bit more about the DTS support for GPIO. I configured the pinctrl for GPIO5 channel, and it seems to have some effect on the GPIO pins. After the kernel starts up the LEDs are being turned off.

&omap3_pmx_core {
vvv_gpio_pins: pinmux_gpio_pins {
pinctrl-single,pins = <
0x136 (PIN_OUTPUT | MUX_MODE4) /* gpio_137 /
0x138 (PIN_OUTPUT | MUX_MODE4) /
gpio_138 /
0x13a (PIN_OUTPUT | MUX_MODE4) /
gpio_139 */

;
};
};

&gpio5 {
pinctrl-names = “default”;
pinctrl-0 = <&vvv_gpio_pins>;
};

However the GPIO export mechanism from userspace is still not working. Basically, no matter what value you try to set gpio137-139, they stay low (although the value in the /sys/class/gpio/gpioXXX/value file is being changed appropriately. It’s as if gpiochip128 is not really associated with gpio5.

I am also worried about not being able to dump /sys/kernel/debug/pinctrl/48002030.pinmux/pins . The kernel hiccup occurs on the base 3.11 DTB file, so it’s not my change that’s causing it.

Well, at least part of the mystery seems to have been solved. For some reason the GPIO numbers for export are offset by 32. So, gpio_138 is actually gpio-170 in the 3.11 kernel.

root@arm:~# echo 170 > /sys/class/gpio/export

root@arm:~# cat /sys/kernel/debug/gpio
GPIOs 0-31, gpio:

GPIOs 32-63, gpio:

GPIOs 64-95, gpio:

GPIOs 96-127, gpio:

GPIOs 128-159, gpio:
gpio-132 (user ) in lo

GPIOs 160-191, gpio:
gpio-170 (sysfs ) in lo
gpio-179 (hsusb2_phy.25 ) out hi

GPIOs 492-511, platform/gpio.38, twl4030, can sleep:
gpio-510 (hsusb2_vbus ) out hi

root@arm:~# echo “high” > /sys/class/gpio/gpio170/direction - the LED lights up!

root@arm:~# cat /sys/kernel/debug/gpio
GPIOs 0-31, gpio:

GPIOs 32-63, gpio:

GPIOs 64-95, gpio:

GPIOs 96-127, gpio:

GPIOs 128-159, gpio:
gpio-132 (user ) in lo

GPIOs 160-191, gpio:
gpio-170 (sysfs ) out hi
gpio-179 (hsusb2_phy.25 ) out hi

GPIOs 492-511, platform/gpio.38, twl4030, can sleep:
gpio-510 (hsusb2_vbus ) out hi

I don’t understand where this offset is coming from (unless somehow the first 32 GPIOs are counted twice - once on the CORE Control Module, and once on the Wkup Control Module?).

Also, it is very strange that the Core pinmux register value display crashes, so we cannot verify the pins are muxed the way we need them to.

On 3.12 an attempt to dump /sys/kernel/debug/pinctrl/48002030.pinmux/pins continues to cause a kernel crash (not a complete crash, but bad enough):

root@arm:~# cat /sys/kernel/debug/pinctrl/48002030.pinmux/pins
Segmentation fault

http://paste.ubuntu.com/6421695/

[63418.031249] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa002268
[63418.039337] Internal error: : 1028 [#1] SMP ARM
[63418.044128] Modules linked in: ftdi_sio smsc95xx usbnet usbserial joydev leds_pwm rtc_twl uio_pdrv_genirq gpio_keys phy_generic uio
[63418.056762] CPU: 0 PID: 1798 Comm: cat Not tainted 3.12.0-armv7-x8 #2
[63418.063537] task: de739600 ti: df082000 task.ti: df082000
[63418.069244] PC is at pcs_readw+0x0/0x10
[63418.073303] LR is at pcs_pin_dbg_show+0x2c/0x4c
[63418.078094] pc : [] lr : [] psr: a0000013
[63418.078094] sp : df083ee0 ip : 00000000 fp : c0961fb5
[63418.090209] r10: de16088c r9 : c077a5e8 r8 : de1608b8
[63418.095703] r7 : 0000011c r6 : df566a00 r5 : 0000011c r4 : df566a00
[63418.102600] r3 : c0393d40 r2 : fa002030 r1 : df566a00 r0 : fa002268
[63418.109466] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[63418.117004] Control: 10c5387d Table: 9db08019 DAC: 00000015
[63418.123046] Process cat (pid: 1798, stack limit = 0xdf082248)
[63418.129119] Stack: (0xdf083ee0 to 0xdf084000)
[63418.133728] 3ee0: de160880 0000011c df566a00 c038ef24 c038ee88 00000000 df083f20 df566a00
[63418.142364] 3f00: 00000001 00010000 000cf000 df083f80 dd9f1e40 c0139e58 00000000 df566a28
[63418.151000] 3f20: 00000000 00000000 00000000 dd9f1e40 df083f80 dd9f1e40 000cf000 dd9f1e40
[63418.159606] 3f40: df082018 df083f80 00010000 00000000 00000000 c011c1f8 dd9f1e40 000cf000
[63418.168243] 3f60: 00000000 00000000 dd9f1e40 00000000 000cf000 00010000 00000000 c011c914
[63418.176879] 3f80: 00000000 00000000 00010000 00010000 000171c4 000cf000 00000003 c000da64
[63418.185516] 3fa0: df082000 c000d8e0 00010000 000171c4 00000003 000cf000 00010000 000cf000
[63418.194122] 3fc0: 00010000 000171c4 000cf000 00000003 7fffe000 00000000 00010000 00000000
[63418.202758] 3fe0: 00000000 bead0574 0000b581 b6ef6f2c 40000010 00000003 ffffffeb ff7fdfbf
[63418.211395] [] (pcs_readw+0x0/0x10) from [] (pcs_pin_dbg_show+0x2c/0x4c)
[63418.220336] [] (pcs_pin_dbg_show+0x2c/0x4c) from [] (pinctrl_pins_show+0x9c/0xd0)
[63418.230072] [] (pinctrl_pins_show+0x9c/0xd0) from [] (seq_read+0x1b0/0x404)
[63418.239257] [] (seq_read+0x1b0/0x404) from [] (vfs_read+0xa4/0x168)
[63418.247711] [] (vfs_read+0xa4/0x168) from [] (SyS_read+0x38/0x68)
[63418.256011] [] (SyS_read+0x38/0x68) from [] (ret_fast_syscall+0x0/0x30)
[63418.264831] Code: e5d03000 e6ef0073 f57ff04f e12fff1e (e1d030b0)
[63418.307189] —[ end trace 12432e5fbd2a5e32 ]—
[63418.312133] In-band Error seen by MPU at address 0
[63418.317260] ------------[ cut here ]------------
[63418.322174] WARNING: CPU: 0 PID: 1798 at drivers/bus/omap_l3_smx.c:162 omap3_l3_app_irq+0xcc/0x110()
[63418.331787] Modules linked in: ftdi_sio smsc95xx usbnet usbserial joydev leds_pwm rtc_twl uio_pdrv_genirq gpio_keys phy_generic uio
[63418.344390] CPU: 0 PID: 1798 Comm: cat Tainted: G D 3.12.0-armv7-x8 #2
[63418.352233] [] (unwind_backtrace+0x0/0xdc) from [] (show_stack+0x10/0x14)
[63418.361236] [] (show_stack+0x10/0x14) from [] (dump_stack+0x70/0x8c)
[63418.369781] [] (dump_stack+0x70/0x8c) from [] (warn_slowpath_common+0x64/0x88)
[63418.379241] [] (warn_slowpath_common+0x64/0x88) from [] (warn_slowpath_null+0x18/0x20)
[63418.389434] [] (warn_slowpath_null+0x18/0x20) from [] (omap3_l3_app_irq+0xcc/0x110)
[63418.399353] [] (omap3_l3_app_irq+0xcc/0x110) from [] (handle_irq_event_percpu+0x6c/0x1fc)
[63418.409851] [] (handle_irq_event_percpu+0x6c/0x1fc) from [] (handle_irq_event+0x40/0x60)
[63418.420227] [] (handle_irq_event+0x40/0x60) from [] (handle_level_irq+0xd4/0xfc)
[63418.429840] [] (handle_level_irq+0xd4/0xfc) from [] (generic_handle_irq+0x20/0x30)
[63418.439666] [] (generic_handle_irq+0x20/0x30) from [] (handle_IRQ+0x68/0x90)
[63418.448944] [] (handle_IRQ+0x68/0x90) from [] (omap3_intc_handle_irq+0x60/0x74)
[63418.458496] [] (omap3_intc_handle_irq+0x60/0x74) from [] (__irq_svc+0x40/0x50)
[63418.467956] Exception stack(0xdf083cd8 to 0xdf083d20)
[63418.473266] 3cc0: df5ca9c4 00003572
[63418.481903] 3ce0: df5ca4c0 00000504 df6cedc0 df082000 00000b58 00000001 df082000 0000000b
[63418.490539] 3d00: c0ac97b0 c0393d40 00000000 df083d20 c0095a4c c0095b54 40000113 ffffffff
[63418.499176] [] (__irq_svc+0x40/0x50) from [] (acct_collect+0x19c/0x1a0)
[63418.507995] [] (acct_collect+0x19c/0x1a0) from [] (do_exit+0x1d0/0x940)
[63418.516815] [] (do_exit+0x1d0/0x940) from [] (die+0x2a8/0x3a0)
[63418.524810] [] (die+0x2a8/0x3a0) from [] (do_DataAbort+0x84/0x98)
[63418.533081] [] (do_DataAbort+0x84/0x98) from [] (__dabt_svc+0x38/0x60)
[63418.541778] Exception stack(0xdf083e98 to 0xdf083ee0)
[63418.547119] 3e80: fa002268 df566a00
[63418.555755] 3ea0: fa002030 c0393d40 df566a00 0000011c df566a00 0000011c de1608b8 c077a5e8
[63418.564361] 3ec0: de16088c c0961fb5 00000000 df083ee0 c0394a14 c0393d40 a0000013 ffffffff
[63418.573028] [] (__dabt_svc+0x38/0x60) from [] (pcs_readw+0x0/0x10)
[63418.581359] [] (pcs_readw+0x0/0x10) from [] (pcs_pin_dbg_show+0x2c/0x4c)
[63418.590270] [] (pcs_pin_dbg_show+0x2c/0x4c) from [] (pinctrl_pins_show+0x9c/0xd0)
[63418.600036] [] (pinctrl_pins_show+0x9c/0xd0) from [] (seq_read+0x1b0/0x404)
[63418.609222] [] (seq_read+0x1b0/0x404) from [] (vfs_read+0xa4/0x168)
[63418.617675] [] (vfs_read+0xa4/0x168) from [] (SyS_read+0x38/0x68)
[63418.625946] [] (SyS_read+0x38/0x68) from [] (ret_fast_syscall+0x0/0x30)
[63418.634735] —[ end trace 12432e5fbd2a5e33 ]—

Hello, Vladimir. I am a student of computer engineering with some problems to multiplex my BeagleBoard xM. How did you edit your device tree? I feel like I’m at the very beginning of what I need to know to make my GPIO work, but I’d be grateful for any help your experience might bring me.

Thank you.

Hi, I just posted a guide on this topic on this group that I think that it will help you. Read it and let me know if you have a question.

Τη Παρασκευή, 9 Ιουνίου 2017 - 2:09:33 μ.μ. UTC+3, ο χρήστης karolf...@gmail.com έγραψε: