aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-07-29 01:53:33 -0400
committerMike Frysinger <vapier@gentoo.org>2010-08-06 12:55:56 -0400
commit39750324053c2aa4314e460b5ce1767f4dfbeff1 (patch)
treefecee75496cdc5b3ab05dcb8f0c441b6ef8d408f /arch/blackfin/include
parentc385acceb4db55a492cb16b24b6102af90348440 (diff)
Blackfin: unify rotary encoder bitmasks
Avoid duplication and ugly global namespace pollution. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r--arch/blackfin/include/asm/bfin_rotary.h74
1 files changed, 73 insertions, 1 deletions
diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/arch/blackfin/include/asm/bfin_rotary.h
index abdb2af52902..0b6910bdc57f 100644
--- a/arch/blackfin/include/asm/bfin_rotary.h
+++ b/arch/blackfin/include/asm/bfin_rotary.h
@@ -2,7 +2,7 @@
2 * board initialization should put one of these structures into platform_data 2 * board initialization should put one of these structures into platform_data
3 * and place the bfin-rotary onto platform_bus named "bfin-rotary". 3 * and place the bfin-rotary onto platform_bus named "bfin-rotary".
4 * 4 *
5 * Copyright 2008 Analog Devices Inc. 5 * Copyright 2008-2010 Analog Devices Inc.
6 * 6 *
7 * Licensed under the GPL-2 or later. 7 * Licensed under the GPL-2 or later.
8 */ 8 */
@@ -40,4 +40,76 @@ struct bfin_rotary_platform_data {
40 unsigned short debounce; /* 0..17 */ 40 unsigned short debounce; /* 0..17 */
41 unsigned short mode; 41 unsigned short mode;
42}; 42};
43
44/* CNT_CONFIG bitmasks */
45#define CNTE (1 << 0) /* Counter Enable */
46#define DEBE (1 << 1) /* Debounce Enable */
47#define CDGINV (1 << 4) /* CDG Pin Polarity Invert */
48#define CUDINV (1 << 5) /* CUD Pin Polarity Invert */
49#define CZMINV (1 << 6) /* CZM Pin Polarity Invert */
50#define CNTMODE_SHIFT 8
51#define CNTMODE (0x7 << CNTMODE_SHIFT) /* Counter Operating Mode */
52#define ZMZC (1 << 1) /* CZM Zeroes Counter Enable */
53#define BNDMODE_SHIFT 12
54#define BNDMODE (0x3 << BNDMODE_SHIFT) /* Boundary register Mode */
55#define INPDIS (1 << 15) /* CUG and CDG Input Disable */
56
57#define CNTMODE_QUADENC (0 << CNTMODE_SHIFT) /* quadrature encoder mode */
58#define CNTMODE_BINENC (1 << CNTMODE_SHIFT) /* binary encoder mode */
59#define CNTMODE_UDCNT (2 << CNTMODE_SHIFT) /* up/down counter mode */
60#define CNTMODE_DIRCNT (4 << CNTMODE_SHIFT) /* direction counter mode */
61#define CNTMODE_DIRTMR (5 << CNTMODE_SHIFT) /* direction timer mode */
62
63#define BNDMODE_COMP (0 << BNDMODE_SHIFT) /* boundary compare mode */
64#define BNDMODE_ZERO (1 << BNDMODE_SHIFT) /* boundary compare and zero mode */
65#define BNDMODE_CAPT (2 << BNDMODE_SHIFT) /* boundary capture mode */
66#define BNDMODE_AEXT (3 << BNDMODE_SHIFT) /* boundary auto-extend mode */
67
68/* CNT_IMASK bitmasks */
69#define ICIE (1 << 0) /* Illegal Gray/Binary Code Interrupt Enable */
70#define UCIE (1 << 1) /* Up count Interrupt Enable */
71#define DCIE (1 << 2) /* Down count Interrupt Enable */
72#define MINCIE (1 << 3) /* Min Count Interrupt Enable */
73#define MAXCIE (1 << 4) /* Max Count Interrupt Enable */
74#define COV31IE (1 << 5) /* Bit 31 Overflow Interrupt Enable */
75#define COV15IE (1 << 6) /* Bit 15 Overflow Interrupt Enable */
76#define CZEROIE (1 << 7) /* Count to Zero Interrupt Enable */
77#define CZMIE (1 << 8) /* CZM Pin Interrupt Enable */
78#define CZMEIE (1 << 9) /* CZM Error Interrupt Enable */
79#define CZMZIE (1 << 10) /* CZM Zeroes Counter Interrupt Enable */
80
81/* CNT_STATUS bitmasks */
82#define ICII (1 << 0) /* Illegal Gray/Binary Code Interrupt Identifier */
83#define UCII (1 << 1) /* Up count Interrupt Identifier */
84#define DCII (1 << 2) /* Down count Interrupt Identifier */
85#define MINCII (1 << 3) /* Min Count Interrupt Identifier */
86#define MAXCII (1 << 4) /* Max Count Interrupt Identifier */
87#define COV31II (1 << 5) /* Bit 31 Overflow Interrupt Identifier */
88#define COV15II (1 << 6) /* Bit 15 Overflow Interrupt Identifier */
89#define CZEROII (1 << 7) /* Count to Zero Interrupt Identifier */
90#define CZMII (1 << 8) /* CZM Pin Interrupt Identifier */
91#define CZMEII (1 << 9) /* CZM Error Interrupt Identifier */
92#define CZMZII (1 << 10) /* CZM Zeroes Counter Interrupt Identifier */
93
94/* CNT_COMMAND bitmasks */
95#define W1LCNT 0xf /* Load Counter Register */
96#define W1LMIN 0xf0 /* Load Min Register */
97#define W1LMAX 0xf00 /* Load Max Register */
98#define W1ZMONCE (1 << 12) /* Enable CZM Clear Counter Once */
99
100#define W1LCNT_ZERO (1 << 0) /* write 1 to load CNT_COUNTER with zero */
101#define W1LCNT_MIN (1 << 2) /* write 1 to load CNT_COUNTER from CNT_MIN */
102#define W1LCNT_MAX (1 << 3) /* write 1 to load CNT_COUNTER from CNT_MAX */
103
104#define W1LMIN_ZERO (1 << 4) /* write 1 to load CNT_MIN with zero */
105#define W1LMIN_CNT (1 << 5) /* write 1 to load CNT_MIN from CNT_COUNTER */
106#define W1LMIN_MAX (1 << 7) /* write 1 to load CNT_MIN from CNT_MAX */
107
108#define W1LMAX_ZERO (1 << 8) /* write 1 to load CNT_MAX with zero */
109#define W1LMAX_CNT (1 << 9) /* write 1 to load CNT_MAX from CNT_COUNTER */
110#define W1LMAX_MIN (1 << 10) /* write 1 to load CNT_MAX from CNT_MIN */
111
112/* CNT_DEBOUNCE bitmasks */
113#define DPRESCALE 0xf /* Load Counter Register */
114
43#endif 115#endif