Closed pdp7 closed 7 years ago
Tests OK to read rotary encoder position with this patch applied:
root@beaglebone:~# uname -a
Linux beaglebone 4.9.6-ti-r18 #1 SMP PREEMPT Thu Feb 2 06:21:39 CST 2017 armv7l GNU/Linux
root@beaglebone:~# config-pin p8.11 qep && config-pin p8.12 qep
root@beaglebone:~# cat /sys/devices/platform/ocp/48304000.epwmss/48304180.eqep/position
0
root@beaglebone:~# cat /sys/devices/platform/ocp/48304000.epwmss/48304180.eqep/position
178
Thanks! @pdp7 merged!
@RobertCNelson Thanks, I've just built and tested 4.9.7-ti-r19
OK:
root@beaglebone:~# uname -r
4.9.7-ti-r19
root@beaglebone:~# config-pin p8.11 qep && config-pin p8.12 qep
root@beaglebone:~# cat /sys/devices/platform/ocp/48304000.epwmss/48304180.eqep/position
1
root@beaglebone:~# cat /sys/devices/platform/ocp/48304000.epwmss/48304180.eqep/position
97
This patch adds a fix for the tieqep driver to avoid unhandled fault when reading or writing to memory mapped eQEP registers.
The fix is to call
pm_runtime_get_sync()
at the beginning of any functions that will read from or write to eQEP registers. This should ensure that the eQEP peripheral is running and its clock is enabled.Before this patch, an attempt to read the position file via sysfs would results in a segmentation fault. The kernel log would contain this error:
Details: https://gist.github.com/pdp7/fe07082d23f2bfbc362c733a7b0aea72
BeagleBoard mailing list thread: https://groups.google.com/d/msg/beagleboard/_TdTH7oPEXE/MNvU-mY6DgAJ