aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2007-05-02 13:00:45 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-05-03 09:10:26 -0400
commit7c73628f24ea73479232d1b608359aa7d8d2c95d (patch)
tree36d289e388d589f8e580730e8f61598232ff6392 /arch/arm/mach-at91
parent235227285b3e4bae616be5720e6dedb49b914e9d (diff)
[ARM] 4354/1: AT91: Support ADS7846 touchsceen on SAM9263-EK board
Add support for the ADS7846 Touchscreen found on the Atmel AT91SAM9263-EK board. Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 8fdce11a880c..81d3d6a0a86a 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -25,6 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h>
28 29
29#include <asm/hardware.h> 30#include <asm/hardware.h>
30#include <asm/setup.h> 31#include <asm/setup.h>
@@ -86,6 +87,40 @@ static struct at91_udc_data __initdata ek_udc_data = {
86 87
87 88
88/* 89/*
90 * ADS7846 Touchscreen
91 */
92#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
93static int ads7843_pendown_state(void)
94{
95 return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */
96}
97
98static struct ads7846_platform_data ads_info = {
99 .model = 7843,
100 .x_min = 150,
101 .x_max = 3830,
102 .y_min = 190,
103 .y_max = 3830,
104 .vref_delay_usecs = 100,
105 .x_plate_ohms = 450,
106 .y_plate_ohms = 250,
107 .pressure_max = 15000,
108 .debounce_max = 1,
109 .debounce_rep = 0,
110 .debounce_tol = (~0),
111 .get_pendown_state = ads7843_pendown_state,
112};
113
114static void __init ek_add_device_ts(void)
115{
116 at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */
117 at91_set_gpio_input(AT91_PIN_PA31, 1); /* Touchscreen BUSY signal */
118}
119#else
120static void __init ek_add_device_ts(void) {}
121#endif
122
123/*
89 * SPI devices. 124 * SPI devices.
90 */ 125 */
91static struct spi_board_info ek_spi_devices[] = { 126static struct spi_board_info ek_spi_devices[] = {
@@ -97,6 +132,16 @@ static struct spi_board_info ek_spi_devices[] = {
97 .bus_num = 0, 132 .bus_num = 0,
98 }, 133 },
99#endif 134#endif
135#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
136 {
137 .modalias = "ads7846",
138 .chip_select = 3,
139 .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
140 .bus_num = 0,
141 .platform_data = &ads_info,
142 .irq = AT91SAM9263_ID_IRQ1,
143 },
144#endif
100}; 145};
101 146
102 147
@@ -157,7 +202,10 @@ static void __init ek_board_init(void)
157 /* USB Device */ 202 /* USB Device */
158 at91_add_device_udc(&ek_udc_data); 203 at91_add_device_udc(&ek_udc_data);
159 /* SPI */ 204 /* SPI */
205 at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */
160 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 206 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
207 /* Touchscreen */
208 ek_add_device_ts();
161 /* MMC */ 209 /* MMC */
162 at91_add_device_mmc(1, &ek_mmc_data); 210 at91_add_device_mmc(1, &ek_mmc_data);
163 /* NAND */ 211 /* NAND */