diff options
author | Dinh Nguyen <Dinh.Nguyen@freescale.com> | 2010-10-23 10:12:47 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-26 10:24:05 -0400 |
commit | f2d36ecbca2f7a4cde2821a8a70f6f799442e33f (patch) | |
tree | 5ba7258948b160dc167b38aa9857979a1dbd3d49 /arch | |
parent | 47c5382287c863473ac2c11d18d6f4100e9dd5b8 (diff) |
ARM: mx5: Add gpio-keys to mx51 babbage board
Add functionality for the power button on MX51 Babbage board.
Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/configs/mx51_defconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-mx51_babbage.c | 24 | ||||
-rw-r--r-- | arch/arm/mach-mx5/devices-imx51.h | 2 |
3 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig index 163cfee7644c..5c7a87260fab 100644 --- a/arch/arm/configs/mx51_defconfig +++ b/arch/arm/configs/mx51_defconfig | |||
@@ -82,6 +82,7 @@ CONFIG_FEC=y | |||
82 | CONFIG_INPUT_FF_MEMLESS=m | 82 | CONFIG_INPUT_FF_MEMLESS=m |
83 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 83 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
84 | CONFIG_INPUT_EVDEV=y | 84 | CONFIG_INPUT_EVDEV=y |
85 | CONFIG_KEYBOARD_GPIO=y | ||
85 | CONFIG_INPUT_EVBUG=m | 86 | CONFIG_INPUT_EVBUG=m |
86 | CONFIG_MOUSE_PS2=m | 87 | CONFIG_MOUSE_PS2=m |
87 | CONFIG_MOUSE_PS2_ELANTECH=y | 88 | CONFIG_MOUSE_PS2_ELANTECH=y |
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c index cbf07ff34d2b..1ea54e992774 100644 --- a/arch/arm/mach-mx5/board-mx51_babbage.c +++ b/arch/arm/mach-mx5/board-mx51_babbage.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/fsl_devices.h> | 19 | #include <linux/fsl_devices.h> |
20 | #include <linux/fec.h> | 20 | #include <linux/fec.h> |
21 | #include <linux/gpio_keys.h> | ||
22 | #include <linux/input.h> | ||
21 | 23 | ||
22 | #include <mach/common.h> | 24 | #include <mach/common.h> |
23 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
@@ -38,6 +40,7 @@ | |||
38 | #define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ | 40 | #define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ |
39 | #define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */ | 41 | #define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */ |
40 | #define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */ | 42 | #define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */ |
43 | #define BABBAGE_POWER_KEY (1*32 + 21) /* GPIO_2_21 */ | ||
41 | 44 | ||
42 | /* USB_CTRL_1 */ | 45 | /* USB_CTRL_1 */ |
43 | #define MX51_USB_CTRL_1_OFFSET 0x10 | 46 | #define MX51_USB_CTRL_1_OFFSET 0x10 |
@@ -47,6 +50,21 @@ | |||
47 | #define MX51_USB_PLL_DIV_19_2_MHZ 0x01 | 50 | #define MX51_USB_PLL_DIV_19_2_MHZ 0x01 |
48 | #define MX51_USB_PLL_DIV_24_MHZ 0x02 | 51 | #define MX51_USB_PLL_DIV_24_MHZ 0x02 |
49 | 52 | ||
53 | static struct gpio_keys_button babbage_buttons[] = { | ||
54 | { | ||
55 | .gpio = BABBAGE_POWER_KEY, | ||
56 | .code = BTN_0, | ||
57 | .desc = "PWR", | ||
58 | .active_low = 1, | ||
59 | .wakeup = 1, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | static const struct gpio_keys_platform_data imx_button_data __initconst = { | ||
64 | .buttons = babbage_buttons, | ||
65 | .nbuttons = ARRAY_SIZE(babbage_buttons), | ||
66 | }; | ||
67 | |||
50 | static struct pad_desc mx51babbage_pads[] = { | 68 | static struct pad_desc mx51babbage_pads[] = { |
51 | /* UART1 */ | 69 | /* UART1 */ |
52 | MX51_PAD_UART1_RXD__UART1_RXD, | 70 | MX51_PAD_UART1_RXD__UART1_RXD, |
@@ -298,6 +316,7 @@ __setup("otg_mode=", babbage_otg_mode); | |||
298 | static void __init mxc_board_init(void) | 316 | static void __init mxc_board_init(void) |
299 | { | 317 | { |
300 | struct pad_desc usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; | 318 | struct pad_desc usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; |
319 | struct pad_desc power_key = MX51_PAD_EIM_A27__GPIO_2_21; | ||
301 | 320 | ||
302 | #if defined(CONFIG_CPU_FREQ_IMX) | 321 | #if defined(CONFIG_CPU_FREQ_IMX) |
303 | get_cpu_op = mx51_get_cpu_op; | 322 | get_cpu_op = mx51_get_cpu_op; |
@@ -308,6 +327,11 @@ static void __init mxc_board_init(void) | |||
308 | babbage_fec_reset(); | 327 | babbage_fec_reset(); |
309 | imx51_add_fec(NULL); | 328 | imx51_add_fec(NULL); |
310 | 329 | ||
330 | /* Set the PAD settings for the pwr key. */ | ||
331 | power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2; | ||
332 | mxc_iomux_v3_setup_pad(&power_key); | ||
333 | imx51_add_gpio_keys(&imx_button_data); | ||
334 | |||
311 | imx51_add_imx_i2c(0, &babbage_i2c_data); | 335 | imx51_add_imx_i2c(0, &babbage_i2c_data); |
312 | imx51_add_imx_i2c(1, &babbage_i2c_data); | 336 | imx51_add_imx_i2c(1, &babbage_i2c_data); |
313 | mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); | 337 | mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); |
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index 5cc910e60538..8c50cb5d05f5 100644 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h | |||
@@ -13,6 +13,8 @@ extern const struct imx_fec_data imx51_fec_data __initconst; | |||
13 | #define imx51_add_fec(pdata) \ | 13 | #define imx51_add_fec(pdata) \ |
14 | imx_add_fec(&imx51_fec_data, pdata) | 14 | imx_add_fec(&imx51_fec_data, pdata) |
15 | 15 | ||
16 | #define imx51_add_gpio_keys(pdata) imx_add_gpio_keys(pdata) | ||
17 | |||
16 | extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; | 18 | extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; |
17 | #define imx51_add_imx_i2c(id, pdata) \ | 19 | #define imx51_add_imx_i2c(id, pdata) \ |
18 | imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) | 20 | imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) |