diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-07-22 12:23:45 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-07-23 00:15:22 -0400 |
commit | 39a6bf1426af4aed2348bb533481027862346a37 (patch) | |
tree | 0c7443a5e3ab1a4dfffd2655c67efa1da2500540 | |
parent | a366aa64f3a51ca3deebe74447f929a5614d9b90 (diff) |
sh: kfr2r09 board support - KEYSC keypad
This patch adds KEYSC keypad support to the kfr2r09 board.
The keys driven by the sh7724 on-chip KEYSC block are
described as a platform device and platform data for
the sh_keysc driver.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/boards/mach-kfr2r09/setup.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index 382bf1884300..bf5f8f8d3b5f 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c | |||
@@ -14,9 +14,11 @@ | |||
14 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/input.h> | ||
17 | #include <asm/clock.h> | 18 | #include <asm/clock.h> |
18 | #include <asm/machvec.h> | 19 | #include <asm/machvec.h> |
19 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/sh_keysc.h> | ||
20 | #include <cpu/sh7724.h> | 22 | #include <cpu/sh7724.h> |
21 | 23 | ||
22 | static struct mtd_partition kfr2r09_nor_flash_partitions[] = | 24 | static struct mtd_partition kfr2r09_nor_flash_partitions[] = |
@@ -58,8 +60,46 @@ static struct platform_device kfr2r09_nor_flash_device = { | |||
58 | }, | 60 | }, |
59 | }; | 61 | }; |
60 | 62 | ||
63 | static struct sh_keysc_info kfr2r09_sh_keysc_info = { | ||
64 | .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */ | ||
65 | .scan_timing = 3, | ||
66 | .delay = 10, | ||
67 | .keycodes = { | ||
68 | KEY_PHONE, KEY_CLEAR, KEY_MAIL, KEY_WWW, KEY_ENTER, | ||
69 | KEY_1, KEY_2, KEY_3, 0, KEY_UP, | ||
70 | KEY_4, KEY_5, KEY_6, 0, KEY_LEFT, | ||
71 | KEY_7, KEY_8, KEY_9, KEY_PROG1, KEY_RIGHT, | ||
72 | KEY_S, KEY_0, KEY_P, KEY_PROG2, KEY_DOWN, | ||
73 | 0, 0, 0, 0, 0 | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | static struct resource kfr2r09_sh_keysc_resources[] = { | ||
78 | [0] = { | ||
79 | .name = "KEYSC", | ||
80 | .start = 0x044b0000, | ||
81 | .end = 0x044b000f, | ||
82 | .flags = IORESOURCE_MEM, | ||
83 | }, | ||
84 | [1] = { | ||
85 | .start = 79, | ||
86 | .flags = IORESOURCE_IRQ, | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | static struct platform_device kfr2r09_sh_keysc_device = { | ||
91 | .name = "sh_keysc", | ||
92 | .id = 0, /* "keysc0" clock */ | ||
93 | .num_resources = ARRAY_SIZE(kfr2r09_sh_keysc_resources), | ||
94 | .resource = kfr2r09_sh_keysc_resources, | ||
95 | .dev = { | ||
96 | .platform_data = &kfr2r09_sh_keysc_info, | ||
97 | }, | ||
98 | }; | ||
99 | |||
61 | static struct platform_device *kfr2r09_devices[] __initdata = { | 100 | static struct platform_device *kfr2r09_devices[] __initdata = { |
62 | &kfr2r09_nor_flash_device, | 101 | &kfr2r09_nor_flash_device, |
102 | &kfr2r09_sh_keysc_device, | ||
63 | }; | 103 | }; |
64 | 104 | ||
65 | #define BSC_CS0BCR 0xfec10004 | 105 | #define BSC_CS0BCR 0xfec10004 |
@@ -75,6 +115,19 @@ static int __init kfr2r09_devices_setup(void) | |||
75 | ctrl_outl(0x36db0400, BSC_CS0BCR); | 115 | ctrl_outl(0x36db0400, BSC_CS0BCR); |
76 | ctrl_outl(0x00000500, BSC_CS0WCR); | 116 | ctrl_outl(0x00000500, BSC_CS0WCR); |
77 | 117 | ||
118 | /* setup KEYSC pins */ | ||
119 | gpio_request(GPIO_FN_KEYOUT0, NULL); | ||
120 | gpio_request(GPIO_FN_KEYOUT1, NULL); | ||
121 | gpio_request(GPIO_FN_KEYOUT2, NULL); | ||
122 | gpio_request(GPIO_FN_KEYOUT3, NULL); | ||
123 | gpio_request(GPIO_FN_KEYOUT4_IN6, NULL); | ||
124 | gpio_request(GPIO_FN_KEYIN0, NULL); | ||
125 | gpio_request(GPIO_FN_KEYIN1, NULL); | ||
126 | gpio_request(GPIO_FN_KEYIN2, NULL); | ||
127 | gpio_request(GPIO_FN_KEYIN3, NULL); | ||
128 | gpio_request(GPIO_FN_KEYIN4, NULL); | ||
129 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); | ||
130 | |||
78 | return platform_add_devices(kfr2r09_devices, | 131 | return platform_add_devices(kfr2r09_devices, |
79 | ARRAY_SIZE(kfr2r09_devices)); | 132 | ARRAY_SIZE(kfr2r09_devices)); |
80 | } | 133 | } |