aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYoshii Takashi <takashi.yoshii.zj@renesas.com>2010-11-19 08:15:46 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-24 00:54:34 -0500
commit2d22d486601b2eaedd1c8dd5dc1c4602cab896ef (patch)
tree3059b1c4ccc01c5bbdef9a0b2e78032abf205707 /arch
parent3256c789882281b2eac5978c7d38f6f0bbd16ed6 (diff)
ARM: mach-shmobile: ag5evm: scan keyboard support
This consists of platform device resources/data for the board, and simple clvdev entry for MSTP bit for keysc module. This support only 49 of 80 key-switches on the board. Signed-off-by: Takashi YOSHII <takashi.yoshii.zj@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c64
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c4
2 files changed, 67 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index e0bc0811dc48..4758690ea421 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -30,6 +30,9 @@
30#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
31#include <linux/smsc911x.h> 31#include <linux/smsc911x.h>
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/input.h>
34#include <linux/input/sh_keysc.h>
35
33#include <mach/hardware.h> 36#include <mach/hardware.h>
34#include <mach/sh73a0.h> 37#include <mach/sh73a0.h>
35#include <mach/common.h> 38#include <mach/common.h>
@@ -70,8 +73,49 @@ static struct platform_device eth_device = {
70 .num_resources = ARRAY_SIZE(smsc9220_resources), 73 .num_resources = ARRAY_SIZE(smsc9220_resources),
71}; 74};
72 75
76static struct sh_keysc_info keysc_platdata = {
77 .mode = SH_KEYSC_MODE_6,
78 .scan_timing = 3,
79 .delay = 100,
80 .keycodes = {
81 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
82 KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N,
83 KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U,
84 KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP,
85 KEY_SPACE, KEY_9, KEY_6, KEY_3, KEY_WAKEUP, KEY_RIGHT, \
86 KEY_COFFEE,
87 KEY_0, KEY_8, KEY_5, KEY_2, KEY_DOWN, KEY_ENTER, KEY_UP,
88 KEY_KPASTERISK, KEY_7, KEY_4, KEY_1, KEY_STOP, KEY_LEFT, \
89 KEY_COMPUTER,
90 },
91};
92
93static struct resource keysc_resources[] = {
94 [0] = {
95 .name = "KEYSC",
96 .start = 0xe61b0000,
97 .end = 0xe61b0098 - 1,
98 .flags = IORESOURCE_MEM,
99 },
100 [1] = {
101 .start = gic_spi(71),
102 .flags = IORESOURCE_IRQ,
103 },
104};
105
106static struct platform_device keysc_device = {
107 .name = "sh_keysc",
108 .id = 0,
109 .num_resources = ARRAY_SIZE(keysc_resources),
110 .resource = keysc_resources,
111 .dev = {
112 .platform_data = &keysc_platdata,
113 },
114};
115
73static struct platform_device *ag5evm_devices[] __initdata = { 116static struct platform_device *ag5evm_devices[] __initdata = {
74 &eth_device, 117 &eth_device,
118 &keysc_device,
75}; 119};
76 120
77static struct map_desc ag5evm_io_desc[] __initdata = { 121static struct map_desc ag5evm_io_desc[] __initdata = {
@@ -129,6 +173,26 @@ static void __init ag5evm_init(void)
129 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL); 173 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
130 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL); 174 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
131 175
176 /* enable KEYSC */
177 gpio_request(GPIO_FN_KEYIN0, NULL);
178 gpio_request(GPIO_FN_KEYIN1, NULL);
179 gpio_request(GPIO_FN_KEYIN2, NULL);
180 gpio_request(GPIO_FN_KEYIN3, NULL);
181 gpio_request(GPIO_FN_KEYIN4, NULL);
182 gpio_request(GPIO_FN_KEYIN5, NULL);
183 gpio_request(GPIO_FN_KEYIN6, NULL);
184 gpio_request(GPIO_FN_KEYIN7, NULL);
185 gpio_request(GPIO_FN_KEYOUT0, NULL);
186 gpio_request(GPIO_FN_KEYOUT1, NULL);
187 gpio_request(GPIO_FN_KEYOUT2, NULL);
188 gpio_request(GPIO_FN_KEYOUT3, NULL);
189 gpio_request(GPIO_FN_KEYOUT4, NULL);
190 gpio_request(GPIO_FN_KEYOUT5, NULL);
191 gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
192 gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
193 gpio_request(GPIO_FN_KEYOUT8, NULL);
194 gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL);
195
132 /* enable SMSC911X */ 196 /* enable SMSC911X */
133 gpio_request(GPIO_PORT144, NULL); /* PINTA2 */ 197 gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
134 gpio_direction_input(GPIO_PORT144); 198 gpio_direction_input(GPIO_PORT144);
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index f2390aefefe8..82c72512dc91 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -47,7 +47,7 @@ static struct clk *main_clks[] = {
47 47
48enum { MSTP219, 48enum { MSTP219,
49 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 49 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
50 MSTP331, MSTP329, 50 MSTP331, MSTP329, MSTP403,
51 MSTP_NR }; 51 MSTP_NR };
52 52
53#define MSTP(_parent, _reg, _bit, _flags) \ 53#define MSTP(_parent, _reg, _bit, _flags) \
@@ -64,6 +64,7 @@ static struct clk mstp_clks[MSTP_NR] = {
64 [MSTP200] = MSTP(&sub_clk, SMSTPCR2, 0, 0), /* SCIFA4 */ 64 [MSTP200] = MSTP(&sub_clk, SMSTPCR2, 0, 0), /* SCIFA4 */
65 [MSTP331] = MSTP(&sub_clk, SMSTPCR3, 31, 0), /* SCIFA6 */ 65 [MSTP331] = MSTP(&sub_clk, SMSTPCR3, 31, 0), /* SCIFA6 */
66 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 66 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
67 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 0, 0), /* KEYSC0 */
67}; 68};
68 69
69#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } 70#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
@@ -80,6 +81,7 @@ static struct clk_lookup lookups[] = {
80 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 81 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
81 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 82 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
82 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ 83 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
84 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC0 */
83}; 85};
84 86
85void __init sh73a0_clock_init(void) 87void __init sh73a0_clock_init(void)