aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorShiraz Hashim <shiraz.hashim@st.com>2012-07-07 21:00:36 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-07-07 21:01:47 -0400
commite99191f0391973326dd4de5cee5a72bf5aeb7040 (patch)
tree2547691a69efa42cf0474817578309a82430d399 /drivers
parent5bdea83565e8b290410521d0dd64b7d3cc41603b (diff)
Input: spear_keyboard - use correct io accessors
All SPEAr keyboard registers are 32 bit wide and are word aligned. This patch aligns all io access to be word size using relaxed version of readl/writel. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/keyboard/spear-keyboard.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 45dd02cbcaa0..10dda9f8e706 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -27,9 +27,9 @@
27#include <plat/keyboard.h> 27#include <plat/keyboard.h>
28 28
29/* Keyboard Registers */ 29/* Keyboard Registers */
30#define MODE_REG 0x00 /* 16 bit reg */ 30#define MODE_REG 0x00
31#define STATUS_REG 0x0C /* 2 bit reg */ 31#define STATUS_REG 0x0C
32#define DATA_REG 0x10 /* 8 bit reg */ 32#define DATA_REG 0x10
33#define INTR_MASK 0x54 33#define INTR_MASK 0x54
34 34
35/* Register Values */ 35/* Register Values */
@@ -72,9 +72,9 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
72 struct spear_kbd *kbd = dev_id; 72 struct spear_kbd *kbd = dev_id;
73 struct input_dev *input = kbd->input; 73 struct input_dev *input = kbd->input;
74 unsigned int key; 74 unsigned int key;
75 u8 sts, val; 75 u32 sts, val;
76 76
77 sts = readb(kbd->io_base + STATUS_REG); 77 sts = readl_relaxed(kbd->io_base + STATUS_REG);
78 if (!(sts & DATA_AVAIL)) 78 if (!(sts & DATA_AVAIL))
79 return IRQ_NONE; 79 return IRQ_NONE;
80 80
@@ -84,7 +84,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
84 } 84 }
85 85
86 /* following reads active (row, col) pair */ 86 /* following reads active (row, col) pair */
87 val = readb(kbd->io_base + DATA_REG); 87 val = readl_relaxed(kbd->io_base + DATA_REG);
88 key = kbd->keycodes[val]; 88 key = kbd->keycodes[val];
89 89
90 input_event(input, EV_MSC, MSC_SCAN, val); 90 input_event(input, EV_MSC, MSC_SCAN, val);
@@ -94,7 +94,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
94 kbd->last_key = key; 94 kbd->last_key = key;
95 95
96 /* clear interrupt */ 96 /* clear interrupt */
97 writeb(0, kbd->io_base + STATUS_REG); 97 writel_relaxed(0, kbd->io_base + STATUS_REG);
98 98
99 return IRQ_HANDLED; 99 return IRQ_HANDLED;
100} 100}
@@ -103,7 +103,7 @@ static int spear_kbd_open(struct input_dev *dev)
103{ 103{
104 struct spear_kbd *kbd = input_get_drvdata(dev); 104 struct spear_kbd *kbd = input_get_drvdata(dev);
105 int error; 105 int error;
106 u16 val; 106 u32 val;
107 107
108 kbd->last_key = KEY_RESERVED; 108 kbd->last_key = KEY_RESERVED;
109 109
@@ -114,13 +114,13 @@ static int spear_kbd_open(struct input_dev *dev)
114 /* program keyboard */ 114 /* program keyboard */
115 val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK | 115 val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK |
116 (kbd->mode << KEY_MATRIX_SHIFT); 116 (kbd->mode << KEY_MATRIX_SHIFT);
117 writew(val, kbd->io_base + MODE_REG); 117 writel_relaxed(val, kbd->io_base + MODE_REG);
118 writeb(1, kbd->io_base + STATUS_REG); 118 writel_relaxed(1, kbd->io_base + STATUS_REG);
119 119
120 /* start key scan */ 120 /* start key scan */
121 val = readw(kbd->io_base + MODE_REG); 121 val = readl_relaxed(kbd->io_base + MODE_REG);
122 val |= START_SCAN; 122 val |= START_SCAN;
123 writew(val, kbd->io_base + MODE_REG); 123 writel_relaxed(val, kbd->io_base + MODE_REG);
124 124
125 return 0; 125 return 0;
126} 126}
@@ -128,12 +128,12 @@ static int spear_kbd_open(struct input_dev *dev)
128static void spear_kbd_close(struct input_dev *dev) 128static void spear_kbd_close(struct input_dev *dev)
129{ 129{
130 struct spear_kbd *kbd = input_get_drvdata(dev); 130 struct spear_kbd *kbd = input_get_drvdata(dev);
131 u16 val; 131 u32 val;
132 132
133 /* stop key scan */ 133 /* stop key scan */
134 val = readw(kbd->io_base + MODE_REG); 134 val = readl_relaxed(kbd->io_base + MODE_REG);
135 val &= ~START_SCAN; 135 val &= ~START_SCAN;
136 writew(val, kbd->io_base + MODE_REG); 136 writel_relaxed(val, kbd->io_base + MODE_REG);
137 137
138 clk_disable(kbd->clk); 138 clk_disable(kbd->clk);
139 139