1 >From 9c5fa914202d20756c56e0c4fd76035ed8f8ced8 Mon Sep 17 00:00:00 2001
2 From: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
3 Date: Mon, 6 Aug 2007 08:31:14 +0200
4 Subject: [PATCH 1/1] Add gpio_mouse board setup to atstk1000 board
6 This patch adds a gpio_mouse_platform_data to the atstk1000 board code and
7 registers a gpio_mouse platform_device. This will enable a GPIO mouse on header
8 J1 on GPIO of the ATSTK1000 development kit. The board code is enabled/disabled
11 By connecting J1 (GPIO) to J25 (SWITCH) you can use the following keys to
22 Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
24 arch/avr32/boards/atstk1000/Kconfig | 16 ++++++++++
25 arch/avr32/boards/atstk1000/atstk1002.c | 48 +++++++++++++++++++++++++++++++
26 2 files changed, 64 insertions(+), 0 deletions(-)
28 diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig
29 index 718578f..d99d4bd 100644
30 --- a/arch/avr32/boards/atstk1000/Kconfig
31 +++ b/arch/avr32/boards/atstk1000/Kconfig
32 @@ -52,6 +52,22 @@ config BOARD_ATSTK100X_SPI1
33 GPIO lines and accessed through the J1 jumper block. Say "y"
34 here to configure that SPI controller.
36 +config BOARD_ATSTK1002_GPIO_MOUSE
37 + bool "Configure gpio_mouse on GPIO J1 header"
38 + depends on !BOARD_ATSTK1002_SW4_CUSTOM
40 + Enable gpio_mouse board configuration on GPIO 0 to 7. Connecting a
41 + 10-pin flat cable from J1 (GPIO) to J25 (SWITCH) will let a user give
42 + mouse inputs using the the switches SW0 to SW7.
52 config BOARD_ATSTK1000_J2_LED
54 default BOARD_ATSTK1000_J2_LED8 || BOARD_ATSTK1000_J2_RGB
55 diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
56 index c958fd4..c7560e5 100644
57 --- a/arch/avr32/boards/atstk1000/atstk1002.c
58 +++ b/arch/avr32/boards/atstk1000/atstk1002.c
60 #include <linux/types.h>
61 #include <linux/spi/spi.h>
62 #include <linux/spi/at73c213.h>
63 +#include <linux/gpio_mouse.h>
65 #include <video/atmel_lcdc.h>
67 @@ -100,6 +101,49 @@ static struct mci_platform_data __initdata mci0_data = {
71 +#ifdef CONFIG_BOARD_ATSTK1002_GPIO_MOUSE
72 +static struct gpio_mouse_platform_data gpio_mouse0_data = {
73 + .polarity = GPIO_MOUSE_POLARITY_ACT_LOW,
76 + .up = GPIO_PIN_PB(2),
77 + .down = GPIO_PIN_PB(1),
78 + .left = GPIO_PIN_PB(3),
79 + .right = GPIO_PIN_PB(0),
80 + .bleft = GPIO_PIN_PB(7),
81 + .bmiddle = GPIO_PIN_PB(6),
82 + .bright = GPIO_PIN_PB(5),
88 +static struct platform_device gpio_mouse0_device = {
89 + .name = "gpio_mouse",
92 + .platform_data = &gpio_mouse0_data,
96 +static void __init add_device_gpio_mouse0(void)
98 + struct platform_device *pdev = &gpio_mouse0_device;
99 + struct gpio_mouse_platform_data *data = pdev->dev.platform_data;
101 + at32_select_gpio(data->up, 0);
102 + at32_select_gpio(data->down, 0);
103 + at32_select_gpio(data->left, 0);
104 + at32_select_gpio(data->right, 0);
106 + at32_select_gpio(data->bleft, 0);
107 + at32_select_gpio(data->bmiddle, 0);
108 + at32_select_gpio(data->bright, 0);
110 + platform_device_register(pdev);
115 * The next two functions should go away as the boot loader is
116 * supposed to initialize the macb address registers with a valid
117 @@ -269,6 +313,10 @@ static int __init atstk1002_init(void)
118 atstk1000_setup_j2_leds();
119 atstk1002_setup_extdac();
121 +#ifdef CONFIG_BOARD_ATSTK1002_GPIO_MOUSE
122 + add_device_gpio_mouse0();
127 postcore_initcall(atstk1002_init);