Initial import
[experiments/bbb-eqep2b-ao2.git] / bbb-eqep2b-ao2-00A0.dts
1 /*
2  * Set up eQEP in a way that does not conflict with HDMI.
3  *
4  * Copyright (C) 2013  Nathaniel R. Lewis - http://nathanielrlewis.com/
5  * Copyright (C) 2018  Antonio Ospite <ao2@ao2.it>
6  *
7  * This program is free softwarejc you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 /dts-v1/;
22 /plugin/;
23
24 #include <dt-bindings/board/am335x-bbw-bbb-base.h>
25 #include <dt-bindings/gpio/gpio.h>
26 #include <dt-bindings/pinctrl/am33xx.h>
27
28 / {
29         compatible = "ti,beaglebone", "ti,beaglebone-black";
30
31         // Identification.
32         part-number = "bbb-eqep2b-ao2";
33         version     = "00A0";
34
35         // Resources this cape uses.
36         exclusive-use =
37                 "P8.12",        // EQEP2A_in
38                 "P8.11",        // EQEP2B_in
39                 "P8.16",        // EQEP2_index
40                 "P8.15",        // EQEP2_strobe
41
42                 "eqep2";        // hardware ip used
43
44         fragment@0 {
45                 target = <&am33xx_pinmux>;
46                 __overlay__ {
47                         pinctrl_eqep2: pinctrl_eqep2_pins {
48                                 pinctrl-single,pins = <
49                                         BONE_P8_12 (PIN_INPUT | MUX_MODE4)      // GPIO1_12 = EQEP2A_in
50                                         BONE_P8_11 (PIN_INPUT | MUX_MODE4)      // GPIO1_13 = EQEP2B_in
51                                         BONE_P8_16 (PIN_INPUT | MUX_MODE4)      // GPIO1_14 = EQEP2_index
52                                         BONE_P8_15 (PIN_INPUT | MUX_MODE4)      // GPIO1_15 = EQEP2_strobe
53                                         // From: https://groups.google.com/forum/#!searchin/beagleboard/eQep/beagleboard/Orp3tFcNgCc/mYacP_GkCQQJ
54                                 >;
55                         };
56                 };
57         };
58
59         fragment@1 {
60                 target = <&epwmss2>;
61                 __overlay__ {
62                         status = "okay";
63                 };
64         };
65
66         fragment@2 {
67                 target = <&eqep2>;
68                 __overlay__ {
69                         pinctrl-names = "default";
70                         pinctrl-0 = <&pinctrl_eqep2>;
71
72                         count_mode = <0>;       // count_mode is not userspace op_mode
73                         // 0 -> Quadrature mode, normal 90 phase offset cha & chb.
74                         // 1 -> Direction mode.  cha input = clock, chb input = direction
75                         // 2 -> UP count mode for frequency measurement QDIR=1, ignore direction input
76                         // 3 -> DOWN count mode for frequency measurement QDIR=0, ignore direction input
77
78                         swap_inputs = <0>;      // swap channel A and B? (0 - no, 1 - yes)
79                         invert_qa = <1>;        // invert channel A input?
80                         invert_qb = <1>;        // invert channel B input?
81                         invert_qi = <0>;        // invert index input?
82                         invert_qs = <0>;        // invert strobe input?
83                         omit_interrupt = <0>;   // 1 -> do not install interrupt handler, 0 -> do install
84
85                         status = "okay";
86                 };
87         };
88 };