aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/include/asm/bfin_rotary.h116
-rw-r--r--arch/blackfin/mach-bf527/boards/ad7160eval.c15
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c15
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c7
-rw-r--r--arch/blackfin/mach-bf609/boards/ezkit.c7
5 files changed, 40 insertions, 120 deletions
diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/arch/blackfin/include/asm/bfin_rotary.h
deleted file mode 100644
index 8895a750c70c..000000000000
--- a/arch/blackfin/include/asm/bfin_rotary.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * board initialization should put one of these structures into platform_data
3 * and place the bfin-rotary onto platform_bus named "bfin-rotary".
4 *
5 * Copyright 2008-2010 Analog Devices Inc.
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef _BFIN_ROTARY_H
11#define _BFIN_ROTARY_H
12
13/* mode bitmasks */
14#define ROT_QUAD_ENC CNTMODE_QUADENC /* quadrature/grey code encoder mode */
15#define ROT_BIN_ENC CNTMODE_BINENC /* binary encoder mode */
16#define ROT_UD_CNT CNTMODE_UDCNT /* rotary counter mode */
17#define ROT_DIR_CNT CNTMODE_DIRCNT /* direction counter mode */
18
19#define ROT_DEBE DEBE /* Debounce Enable */
20
21#define ROT_CDGINV CDGINV /* CDG Pin Polarity Invert */
22#define ROT_CUDINV CUDINV /* CUD Pin Polarity Invert */
23#define ROT_CZMINV CZMINV /* CZM Pin Polarity Invert */
24
25struct bfin_rotary_platform_data {
26 /* set rotary UP KEY_### or BTN_### in case you prefer
27 * bfin-rotary to send EV_KEY otherwise set 0
28 */
29 unsigned int rotary_up_key;
30 /* set rotary DOWN KEY_### or BTN_### in case you prefer
31 * bfin-rotary to send EV_KEY otherwise set 0
32 */
33 unsigned int rotary_down_key;
34 /* set rotary BUTTON KEY_### or BTN_### */
35 unsigned int rotary_button_key;
36 /* set rotary Relative Axis REL_### in case you prefer
37 * bfin-rotary to send EV_REL otherwise set 0
38 */
39 unsigned int rotary_rel_code;
40 unsigned short debounce; /* 0..17 */
41 unsigned short mode;
42 unsigned short pm_wakeup;
43};
44
45/* CNT_CONFIG bitmasks */
46#define CNTE (1 << 0) /* Counter Enable */
47#define DEBE (1 << 1) /* Debounce Enable */
48#define CDGINV (1 << 4) /* CDG Pin Polarity Invert */
49#define CUDINV (1 << 5) /* CUD Pin Polarity Invert */
50#define CZMINV (1 << 6) /* CZM Pin Polarity Invert */
51#define CNTMODE_SHIFT 8
52#define CNTMODE (0x7 << CNTMODE_SHIFT) /* Counter Operating Mode */
53#define ZMZC (1 << 1) /* CZM Zeroes Counter Enable */
54#define BNDMODE_SHIFT 12
55#define BNDMODE (0x3 << BNDMODE_SHIFT) /* Boundary register Mode */
56#define INPDIS (1 << 15) /* CUG and CDG Input Disable */
57
58#define CNTMODE_QUADENC (0 << CNTMODE_SHIFT) /* quadrature encoder mode */
59#define CNTMODE_BINENC (1 << CNTMODE_SHIFT) /* binary encoder mode */
60#define CNTMODE_UDCNT (2 << CNTMODE_SHIFT) /* up/down counter mode */
61#define CNTMODE_DIRCNT (4 << CNTMODE_SHIFT) /* direction counter mode */
62#define CNTMODE_DIRTMR (5 << CNTMODE_SHIFT) /* direction timer mode */
63
64#define BNDMODE_COMP (0 << BNDMODE_SHIFT) /* boundary compare mode */
65#define BNDMODE_ZERO (1 << BNDMODE_SHIFT) /* boundary compare and zero mode */
66#define BNDMODE_CAPT (2 << BNDMODE_SHIFT) /* boundary capture mode */
67#define BNDMODE_AEXT (3 << BNDMODE_SHIFT) /* boundary auto-extend mode */
68
69/* CNT_IMASK bitmasks */
70#define ICIE (1 << 0) /* Illegal Gray/Binary Code Interrupt Enable */
71#define UCIE (1 << 1) /* Up count Interrupt Enable */
72#define DCIE (1 << 2) /* Down count Interrupt Enable */
73#define MINCIE (1 << 3) /* Min Count Interrupt Enable */
74#define MAXCIE (1 << 4) /* Max Count Interrupt Enable */
75#define COV31IE (1 << 5) /* Bit 31 Overflow Interrupt Enable */
76#define COV15IE (1 << 6) /* Bit 15 Overflow Interrupt Enable */
77#define CZEROIE (1 << 7) /* Count to Zero Interrupt Enable */
78#define CZMIE (1 << 8) /* CZM Pin Interrupt Enable */
79#define CZMEIE (1 << 9) /* CZM Error Interrupt Enable */
80#define CZMZIE (1 << 10) /* CZM Zeroes Counter Interrupt Enable */
81
82/* CNT_STATUS bitmasks */
83#define ICII (1 << 0) /* Illegal Gray/Binary Code Interrupt Identifier */
84#define UCII (1 << 1) /* Up count Interrupt Identifier */
85#define DCII (1 << 2) /* Down count Interrupt Identifier */
86#define MINCII (1 << 3) /* Min Count Interrupt Identifier */
87#define MAXCII (1 << 4) /* Max Count Interrupt Identifier */
88#define COV31II (1 << 5) /* Bit 31 Overflow Interrupt Identifier */
89#define COV15II (1 << 6) /* Bit 15 Overflow Interrupt Identifier */
90#define CZEROII (1 << 7) /* Count to Zero Interrupt Identifier */
91#define CZMII (1 << 8) /* CZM Pin Interrupt Identifier */
92#define CZMEII (1 << 9) /* CZM Error Interrupt Identifier */
93#define CZMZII (1 << 10) /* CZM Zeroes Counter Interrupt Identifier */
94
95/* CNT_COMMAND bitmasks */
96#define W1LCNT 0xf /* Load Counter Register */
97#define W1LMIN 0xf0 /* Load Min Register */
98#define W1LMAX 0xf00 /* Load Max Register */
99#define W1ZMONCE (1 << 12) /* Enable CZM Clear Counter Once */
100
101#define W1LCNT_ZERO (1 << 0) /* write 1 to load CNT_COUNTER with zero */
102#define W1LCNT_MIN (1 << 2) /* write 1 to load CNT_COUNTER from CNT_MIN */
103#define W1LCNT_MAX (1 << 3) /* write 1 to load CNT_COUNTER from CNT_MAX */
104
105#define W1LMIN_ZERO (1 << 4) /* write 1 to load CNT_MIN with zero */
106#define W1LMIN_CNT (1 << 5) /* write 1 to load CNT_MIN from CNT_COUNTER */
107#define W1LMIN_MAX (1 << 7) /* write 1 to load CNT_MIN from CNT_MAX */
108
109#define W1LMAX_ZERO (1 << 8) /* write 1 to load CNT_MAX with zero */
110#define W1LMAX_CNT (1 << 9) /* write 1 to load CNT_MAX from CNT_COUNTER */
111#define W1LMAX_MIN (1 << 10) /* write 1 to load CNT_MAX from CNT_MIN */
112
113/* CNT_DEBOUNCE bitmasks */
114#define DPRESCALE 0xf /* Load Counter Register */
115
116#endif
diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c
index 9501bd8d9cd1..68f2a8a806ea 100644
--- a/arch/blackfin/mach-bf527/boards/ad7160eval.c
+++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c
@@ -666,7 +666,14 @@ static struct platform_device bfin_sport1_uart_device = {
666#endif 666#endif
667 667
668#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 668#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
669#include <asm/bfin_rotary.h> 669#include <linux/platform_data/bfin_rotary.h>
670
671static const u16 per_cnt[] = {
672 P_CNT_CUD,
673 P_CNT_CDG,
674 P_CNT_CZM,
675 0
676};
670 677
671static struct bfin_rotary_platform_data bfin_rotary_data = { 678static struct bfin_rotary_platform_data bfin_rotary_data = {
672 /*.rotary_up_key = KEY_UP,*/ 679 /*.rotary_up_key = KEY_UP,*/
@@ -676,10 +683,16 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
676 .debounce = 10, /* 0..17 */ 683 .debounce = 10, /* 0..17 */
677 .mode = ROT_QUAD_ENC | ROT_DEBE, 684 .mode = ROT_QUAD_ENC | ROT_DEBE,
678 .pm_wakeup = 1, 685 .pm_wakeup = 1,
686 .pin_list = per_cnt,
679}; 687};
680 688
681static struct resource bfin_rotary_resources[] = { 689static struct resource bfin_rotary_resources[] = {
682 { 690 {
691 .start = CNT_CONFIG,
692 .end = CNT_CONFIG + 0xff,
693 .flags = IORESOURCE_MEM,
694 },
695 {
683 .start = IRQ_CNT, 696 .start = IRQ_CNT,
684 .end = IRQ_CNT, 697 .end = IRQ_CNT,
685 .flags = IORESOURCE_IRQ, 698 .flags = IORESOURCE_IRQ,
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index d64f565dc2a0..d4219e8e5ab8 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -1092,7 +1092,14 @@ static struct platform_device bfin_device_gpiokeys = {
1092#endif 1092#endif
1093 1093
1094#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 1094#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
1095#include <asm/bfin_rotary.h> 1095#include <linux/platform_data/bfin_rotary.h>
1096
1097static const u16 per_cnt[] = {
1098 P_CNT_CUD,
1099 P_CNT_CDG,
1100 P_CNT_CZM,
1101 0
1102};
1096 1103
1097static struct bfin_rotary_platform_data bfin_rotary_data = { 1104static struct bfin_rotary_platform_data bfin_rotary_data = {
1098 /*.rotary_up_key = KEY_UP,*/ 1105 /*.rotary_up_key = KEY_UP,*/
@@ -1102,10 +1109,16 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
1102 .debounce = 10, /* 0..17 */ 1109 .debounce = 10, /* 0..17 */
1103 .mode = ROT_QUAD_ENC | ROT_DEBE, 1110 .mode = ROT_QUAD_ENC | ROT_DEBE,
1104 .pm_wakeup = 1, 1111 .pm_wakeup = 1,
1112 .pin_list = per_cnt,
1105}; 1113};
1106 1114
1107static struct resource bfin_rotary_resources[] = { 1115static struct resource bfin_rotary_resources[] = {
1108 { 1116 {
1117 .start = CNT_CONFIG,
1118 .end = CNT_CONFIG + 0xff,
1119 .flags = IORESOURCE_MEM,
1120 },
1121 {
1109 .start = IRQ_CNT, 1122 .start = IRQ_CNT,
1110 .end = IRQ_CNT, 1123 .end = IRQ_CNT,
1111 .flags = IORESOURCE_IRQ, 1124 .flags = IORESOURCE_IRQ,
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 1fe7ff286619..4204b9842532 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = {
159#endif 159#endif
160 160
161#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 161#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
162#include <asm/bfin_rotary.h> 162#include <linux/platform_data/bfin_rotary.h>
163 163
164static struct bfin_rotary_platform_data bfin_rotary_data = { 164static struct bfin_rotary_platform_data bfin_rotary_data = {
165 /*.rotary_up_key = KEY_UP,*/ 165 /*.rotary_up_key = KEY_UP,*/
@@ -173,6 +173,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
173 173
174static struct resource bfin_rotary_resources[] = { 174static struct resource bfin_rotary_resources[] = {
175 { 175 {
176 .start = CNT_CONFIG,
177 .end = CNT_CONFIG + 0xff,
178 .flags = IORESOURCE_MEM,
179 },
180 {
176 .start = IRQ_CNT, 181 .start = IRQ_CNT,
177 .end = IRQ_CNT, 182 .end = IRQ_CNT,
178 .flags = IORESOURCE_IRQ, 183 .flags = IORESOURCE_IRQ,
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
index e2c0b024ce88..7f9fc272ec30 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = {
75#endif 75#endif
76 76
77#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 77#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
78#include <asm/bfin_rotary.h> 78#include <linux/platform_data/bfin_rotary.h>
79 79
80static struct bfin_rotary_platform_data bfin_rotary_data = { 80static struct bfin_rotary_platform_data bfin_rotary_data = {
81 /*.rotary_up_key = KEY_UP,*/ 81 /*.rotary_up_key = KEY_UP,*/
@@ -88,6 +88,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
88 88
89static struct resource bfin_rotary_resources[] = { 89static struct resource bfin_rotary_resources[] = {
90 { 90 {
91 .start = CNT_CONFIG,
92 .end = CNT_CONFIG + 0xff,
93 .flags = IORESOURCE_MEM,
94 },
95 {
91 .start = IRQ_CNT, 96 .start = IRQ_CNT,
92 .end = IRQ_CNT, 97 .end = IRQ_CNT,
93 .flags = IORESOURCE_IRQ, 98 .flags = IORESOURCE_IRQ,