Commit e99191f0 authored by Shiraz Hashim's avatar Shiraz Hashim Committed by Dmitry Torokhov

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: default avatarShiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 5bdea835
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include <plat/keyboard.h> #include <plat/keyboard.h>
/* Keyboard Registers */ /* Keyboard Registers */
#define MODE_REG 0x00 /* 16 bit reg */ #define MODE_REG 0x00
#define STATUS_REG 0x0C /* 2 bit reg */ #define STATUS_REG 0x0C
#define DATA_REG 0x10 /* 8 bit reg */ #define DATA_REG 0x10
#define INTR_MASK 0x54 #define INTR_MASK 0x54
/* Register Values */ /* Register Values */
...@@ -72,9 +72,9 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) ...@@ -72,9 +72,9 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
struct spear_kbd *kbd = dev_id; struct spear_kbd *kbd = dev_id;
struct input_dev *input = kbd->input; struct input_dev *input = kbd->input;
unsigned int key; unsigned int key;
u8 sts, val; u32 sts, val;
sts = readb(kbd->io_base + STATUS_REG); sts = readl_relaxed(kbd->io_base + STATUS_REG);
if (!(sts & DATA_AVAIL)) if (!(sts & DATA_AVAIL))
return IRQ_NONE; return IRQ_NONE;
...@@ -84,7 +84,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) ...@@ -84,7 +84,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
} }
/* following reads active (row, col) pair */ /* following reads active (row, col) pair */
val = readb(kbd->io_base + DATA_REG); val = readl_relaxed(kbd->io_base + DATA_REG);
key = kbd->keycodes[val]; key = kbd->keycodes[val];
input_event(input, EV_MSC, MSC_SCAN, val); input_event(input, EV_MSC, MSC_SCAN, val);
...@@ -94,7 +94,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) ...@@ -94,7 +94,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
kbd->last_key = key; kbd->last_key = key;
/* clear interrupt */ /* clear interrupt */
writeb(0, kbd->io_base + STATUS_REG); writel_relaxed(0, kbd->io_base + STATUS_REG);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -103,7 +103,7 @@ static int spear_kbd_open(struct input_dev *dev) ...@@ -103,7 +103,7 @@ static int spear_kbd_open(struct input_dev *dev)
{ {
struct spear_kbd *kbd = input_get_drvdata(dev); struct spear_kbd *kbd = input_get_drvdata(dev);
int error; int error;
u16 val; u32 val;
kbd->last_key = KEY_RESERVED; kbd->last_key = KEY_RESERVED;
...@@ -114,13 +114,13 @@ static int spear_kbd_open(struct input_dev *dev) ...@@ -114,13 +114,13 @@ static int spear_kbd_open(struct input_dev *dev)
/* program keyboard */ /* program keyboard */
val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK | val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK |
(kbd->mode << KEY_MATRIX_SHIFT); (kbd->mode << KEY_MATRIX_SHIFT);
writew(val, kbd->io_base + MODE_REG); writel_relaxed(val, kbd->io_base + MODE_REG);
writeb(1, kbd->io_base + STATUS_REG); writel_relaxed(1, kbd->io_base + STATUS_REG);
/* start key scan */ /* start key scan */
val = readw(kbd->io_base + MODE_REG); val = readl_relaxed(kbd->io_base + MODE_REG);
val |= START_SCAN; val |= START_SCAN;
writew(val, kbd->io_base + MODE_REG); writel_relaxed(val, kbd->io_base + MODE_REG);
return 0; return 0;
} }
...@@ -128,12 +128,12 @@ static int spear_kbd_open(struct input_dev *dev) ...@@ -128,12 +128,12 @@ static int spear_kbd_open(struct input_dev *dev)
static void spear_kbd_close(struct input_dev *dev) static void spear_kbd_close(struct input_dev *dev)
{ {
struct spear_kbd *kbd = input_get_drvdata(dev); struct spear_kbd *kbd = input_get_drvdata(dev);
u16 val; u32 val;
/* stop key scan */ /* stop key scan */
val = readw(kbd->io_base + MODE_REG); val = readl_relaxed(kbd->io_base + MODE_REG);
val &= ~START_SCAN; val &= ~START_SCAN;
writew(val, kbd->io_base + MODE_REG); writel_relaxed(val, kbd->io_base + MODE_REG);
clk_disable(kbd->clk); clk_disable(kbd->clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment