Skip to content

Instantly share code, notes, and snippets.

@rklaren
Last active February 21, 2018 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rklaren/09cf8a0a031a857421ae1501ca6d59dc to your computer and use it in GitHub Desktop.
Save rklaren/09cf8a0a031a857421ae1501ca6d59dc to your computer and use it in GitHub Desktop.
Pocket beagle EQEP
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@0 {
target = <&ocp>;
__overlay__ {
P1_31_pinmux { status = "disabled"; }; // EQEP0A_in
P2_34_pinmux { status = "disabled"; }; // EQEP0B_in
// P2_28_pinmux { status = "disabled"; }; // EQEP0_index
// P1_29_pinmux { status = "disabled"; }; // EQEP0_strobe
// TODO/QUESTION: these seem to do nothing?
cape-universal { status = "disabled"; };
cape-universal@1 { status = "disabled"; };
};
};
fragment@1 {
target = <&eqep0>;
__overlay__ {
pinctrl-names = "default";
// TODO: does not work: pinctrl-0 = <&pinctrl_eqep0>
pinctrl-0 = <&P1_31_qep_pin &P2_34_qep_pin>;
count_mode = <0>; // count_mode is not userspace op_mode
// 0 -> Quadrature mode, normal 90 phase offset cha & chb.
// 1 -> Direction mode. cha input = clock, chb input = direction
// 2 -> UP count mode for frequency measurement QDIR=1, ignore direction input
// 3 -> DOWN count mode for frequency measurement QDIR=0, ignore direction input
swap_inputs = <0>; // swap channel A and B? (0 - no, 1 - yes)
invert_qa = <0>; // invert channel A input?
invert_qb = <0>; // invert channel B input?
invert_qi = <0>; // invert index input?
invert_qs = <0>; // invert strobe input?
omit_interrupt = <0>; // 1 -> do not install interrupt handler, 0 -> do install
status = "okay";
};
};
};
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
fragment@0 {
target = <&ocp>;
__overlay__ {
P2_24_pinmux { status = "disabled"; }; // EQEP2A_in
P2_33_pinmux { status = "disabled"; }; // EQEP2B_in
// P2_18_pinmux { status = "disabled"; }; // EQEP2_strobe
// P2_22_pinmux { status = "disabled"; }; // EQEP2_index
cape-universal { status = "disabled"; };
cape-universal@1 { status = "disabled"; };
};
};
fragment@1 {
target = <&eqep2>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&P2_24_qep_pin &P2_33_qep_pin>;
count_mode = <0>; // count_mode is not userspace op_mode
// 0 -> Quadrature mode, normal 90 phase offset cha & chb.
// 1 -> Direction mode. cha input = clock, chb input = direction
// 2 -> UP count mode for frequency measurement QDIR=1, ignore direction input
// 3 -> DOWN count mode for frequency measurement QDIR=0, ignore direction input
swap_inputs = <0>; // swap channel A and B? (0 - no, 1 - yes)
invert_qa = <0>; // invert channel A input?
invert_qb = <0>; // invert channel B input?
invert_qi = <0>; // invert index input?
invert_qs = <0>; // invert strobe input?
omit_interrupt = <0>; // 1 -> do not install interrupt handler, 0 -> do install
status = "okay";
};
};
};
@rklaren
Copy link
Author

rklaren commented Feb 21, 2018

These work with bone-debian-9.3-iot-armhf-2018-01-28-4gb.img (kernel 4.9.78-ti-r94).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment