aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-04-23 02:54:14 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-05-12 16:34:18 -0400
commit1e35464125a71cb6a46a20862dcbcd196e779921 (patch)
tree767333a068b94990f69f3bee712fa6f4a178be43 /arch/arm/mach-shmobile
parent7775a93363e0bacb8a29b357429562063b42796b (diff)
ARM: mach-shmobile: kzm9g: add PCF8757 gpio-key
This patch adds extra GPIO via PCF8757 chip, and use it as gpio-key. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Simon Horman <horms@verge.net.au> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 657ba6473c65..78e9850967eb 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -19,9 +19,12 @@
19 19
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/gpio_keys.h>
22#include <linux/io.h> 23#include <linux/io.h>
23#include <linux/irq.h> 24#include <linux/irq.h>
24#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/i2c/pcf857x.h>
27#include <linux/input.h>
25#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
26#include <linux/mmc/sh_mmcif.h> 29#include <linux/mmc/sh_mmcif.h>
27#include <linux/mmc/sh_mobile_sdhi.h> 30#include <linux/mmc/sh_mobile_sdhi.h>
@@ -39,6 +42,18 @@
39#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
40#include <video/sh_mobile_lcdc.h> 43#include <video/sh_mobile_lcdc.h>
41 44
45/*
46 * external GPIO
47 */
48#define GPIO_PCF8575_BASE (GPIO_NR)
49#define GPIO_PCF8575_PORT10 (GPIO_NR + 8)
50#define GPIO_PCF8575_PORT11 (GPIO_NR + 9)
51#define GPIO_PCF8575_PORT12 (GPIO_NR + 10)
52#define GPIO_PCF8575_PORT13 (GPIO_NR + 11)
53#define GPIO_PCF8575_PORT14 (GPIO_NR + 12)
54#define GPIO_PCF8575_PORT15 (GPIO_NR + 13)
55#define GPIO_PCF8575_PORT16 (GPIO_NR + 14)
56
42/* SMSC 9221 */ 57/* SMSC 9221 */
43static struct resource smsc9221_resources[] = { 58static struct resource smsc9221_resources[] = {
44 [0] = { 59 [0] = {
@@ -225,7 +240,38 @@ static struct platform_device sdhi0_device = {
225 }, 240 },
226}; 241};
227 242
243/* KEY */
244#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
245
246static struct gpio_keys_button gpio_buttons[] = {
247 GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
248 GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
249 GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
250 GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
251 GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
252 GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
253 GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
254};
255
256static struct gpio_keys_platform_data gpio_key_info = {
257 .buttons = gpio_buttons,
258 .nbuttons = ARRAY_SIZE(gpio_buttons),
259 .poll_interval = 250, /* poling at this point */
260};
261
262static struct platform_device gpio_keys_device = {
263 /* gpio-pcf857x.c driver doesn't support gpio_to_irq() */
264 .name = "gpio-keys-polled",
265 .dev = {
266 .platform_data = &gpio_key_info,
267 },
268};
269
228/* I2C */ 270/* I2C */
271static struct pcf857x_platform_data pcf8575_pdata = {
272 .gpio_base = GPIO_PCF8575_BASE,
273};
274
229static struct i2c_board_info i2c1_devices[] = { 275static struct i2c_board_info i2c1_devices[] = {
230 { 276 {
231 I2C_BOARD_INFO("st1232-ts", 0x55), 277 I2C_BOARD_INFO("st1232-ts", 0x55),
@@ -233,12 +279,20 @@ static struct i2c_board_info i2c1_devices[] = {
233 }, 279 },
234}; 280};
235 281
282static struct i2c_board_info i2c3_devices[] = {
283 {
284 I2C_BOARD_INFO("pcf8575", 0x20),
285 .platform_data = &pcf8575_pdata,
286 },
287};
288
236static struct platform_device *kzm_devices[] __initdata = { 289static struct platform_device *kzm_devices[] __initdata = {
237 &smsc_device, 290 &smsc_device,
238 &usb_host_device, 291 &usb_host_device,
239 &lcdc_device, 292 &lcdc_device,
240 &mmc_device, 293 &mmc_device,
241 &sdhi0_device, 294 &sdhi0_device,
295 &gpio_keys_device,
242}; 296};
243 297
244/* 298/*
@@ -373,12 +427,17 @@ static void __init kzm_init(void)
373 gpio_request(GPIO_PORT15, NULL); 427 gpio_request(GPIO_PORT15, NULL);
374 gpio_direction_output(GPIO_PORT15, 1); /* power */ 428 gpio_direction_output(GPIO_PORT15, 1); /* power */
375 429
430 /* I2C 3 */
431 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
432 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
433
376#ifdef CONFIG_CACHE_L2X0 434#ifdef CONFIG_CACHE_L2X0
377 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 435 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
378 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); 436 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
379#endif 437#endif
380 438
381 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices)); 439 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
440 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
382 441
383 sh73a0_add_standard_devices(); 442 sh73a0_add_standard_devices();
384 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices)); 443 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));