Charles,
Thank you very much for the suggestion. Checking /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins showed that indeed, the pinmuxes were not set up correctly (but they were removed from the set of pins universal cape can control).
After RTFSing the universal cape overlay I figured out the names of the pins to change (two of the BBB pins used by QEP0 have two processor pins attached), and now I set the muxes using config-pin. Querying the pins using config-pin shows correct configuration, but the muxes in /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins still don't look right. The pins used by QEP0 are P9_25 (117), P9_27 (115), P9_91 (116) and P9_92 (114). The numbers in parentheses are GPIO numbers.
Here are the pin modes reported by config-pin after setting them up:
$ for p in P9_25 P9_27 P9_91 P9_92; do config-pin -q $p;done
P9_25 Mode: qep
P9_27 Mode: qep
P9_91 Mode: qep
P9_92 Mode: qep
Here are the muxes read from the kernel debug interface:
pin 114 (PIN114) 44e109c8 00000028 pinctrl-single
pin 115 (PIN115) 44e109cc 00000028 pinctrl-single
pin 116 (PIN116) 44e109d0 00000030 pinctrl-single
pin 117 (PIN117) 44e109d4 00000030 pinctrl-single
All modes (the last 3 bits) are set to 0, while they shouldn't be. I noticed that early in the boot process kernel throws an exception, which seems to come from the initialization code, probably processing the device tree. Full boot log is in the attachment:
[ 0.281700] ------------[ cut here ]------------
[ 0.281731] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:828 clk_core_disable_lock+0x15/0x1c
[ 0.281774] l4_per_cm:clk:00d4:0 already disabled
[ 0.281781] Modules linked in:
[ 0.281798] CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.106-bone-rt-r49 #1stretch
[ 0.281805] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 0.281844] [<c010ce9d>] (unwind_backtrace) from [<c010a81d>] (show_stack+0x11/0x14)
[ 0.281861] [<c010a81d>] (show_stack) from [<c01256bf>] (__warn+0xb3/0xc4)
[ 0.281874] [<c01256bf>] (__warn) from [<c0125703>] (warn_slowpath_fmt+0x33/0x48)
[ 0.281888] [<c0125703>] (warn_slowpath_fmt) from [<c057e319>] (clk_core_disable_lock+0x15/0x1c)
[ 0.281908] [<c057e319>] (clk_core_disable_lock) from [<c011a39f>] (_disable_clocks+0x23/0x7c)
[ 0.281925] [<c011a39f>] (_disable_clocks) from [<c011bfe1>] (omap_hwmod_deassert_hardreset+0x81/0xf0)
[ 0.281940] [<c011bfe1>] (omap_hwmod_deassert_hardreset) from [<c011c803>] (_omap_device_notifier_call+0x1ff/0x340)
[ 0.281956] [<c011c803>] (_omap_device_notifier_call) from [<c013d9b3>] (notifier_call_chain+0x4b/0x60)
[ 0.281970] [<c013d9b3>] (notifier_call_chain) from [<c013dc15>] (__blocking_notifier_call_chain+0x2d/0x3c)
[ 0.281983] [<c013dc15>] (__blocking_notifier_call_chain) from [<c013dc3b>] (blocking_notifier_call_chain+0x17/0x1c)
[ 0.281998] [<c013dc3b>] (blocking_notifier_call_chain) from [<c0600543>] (device_add+0x2a3/0x498)
[ 0.282021] [<c0600543>] (device_add) from [<c0732653>] (of_platform_device_create_pdata+0x73/0xa0)
[ 0.282038] [<c0732653>] (of_platform_device_create_pdata) from [<c07327b9>] (of_platform_bus_create+0x12d/0x27c)
[ 0.282051] [<c07327b9>] (of_platform_bus_create) from [<c0732803>] (of_platform_bus_create+0x177/0x27c)
[ 0.282064] [<c0732803>] (of_platform_bus_create) from [<c0732a57>] (of_platform_populate+0x67/0xe4)
[ 0.282087] [<c0732a57>] (of_platform_populate) from [<c0d09549>] (pdata_quirks_init+0x5d/0x6c)
[ 0.282102] [<c0d09549>] (pdata_quirks_init) from [<c0d094e3>] (omap_generic_init+0x15/0x1e)
[ 0.282126] [<c0d094e3>] (omap_generic_init) from [<c0d02499>] (customize_machine+0x19/0x1c)
[ 0.282145] [<c0d02499>] (customize_machine) from [<c0102929>] (do_one_initcall+0x45/0x17c)
[ 0.282160] [<c0102929>] (do_one_initcall) from [<c0d00e39>] (kernel_init_freeable+0x1a7/0x242)
[ 0.282182] [<c0d00e39>] (kernel_init_freeable) from [<c08a3805>] (kernel_init+0xd/0xdc)
[ 0.282197] [<c08a3805>] (kernel_init) from [<c0101101>] (ret_from_fork+0x11/0x30)
[ 0.282205] Exception stack(0xdc115fb0 to 0xdc115ff8)
[ 0.282215] 5fa0: 00000000 00000000 00000000 00000000
[ 0.282228] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 0.282238] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 0.282246] ---[ end trace 0000000000000001 ]---
All of this with the board running the stock kernel from the image:
Linux machinekit 4.19.106-bone-rt-r49 #1stretch PREEMPT RT Wed Mar 11 10:50:28 UTC 2020 armv7l GNU/Linux
And I still get bus errors when loading the module.
Does it look like something you've encountered in the past?
Thank you,
Jacek.