diff options
-rw-r--r-- | arch/arm/mach-omap2/board-overo.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index d3ceed398e0b..782268c91942 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -57,6 +57,65 @@ | |||
57 | #define GPMC_CS0_BASE 0x60 | 57 | #define GPMC_CS0_BASE 0x60 |
58 | #define GPMC_CS_SIZE 0x30 | 58 | #define GPMC_CS_SIZE 0x30 |
59 | 59 | ||
60 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ | ||
61 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
62 | |||
63 | #include <mach/mcspi.h> | ||
64 | #include <linux/spi/spi.h> | ||
65 | #include <linux/spi/ads7846.h> | ||
66 | |||
67 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
68 | .turbo_mode = 0, | ||
69 | .single_channel = 1, /* 0: slave, 1: master */ | ||
70 | }; | ||
71 | |||
72 | static int ads7846_get_pendown_state(void) | ||
73 | { | ||
74 | return !gpio_get_value(OVERO_GPIO_PENDOWN); | ||
75 | } | ||
76 | |||
77 | static struct ads7846_platform_data ads7846_config = { | ||
78 | .x_max = 0x0fff, | ||
79 | .y_max = 0x0fff, | ||
80 | .x_plate_ohms = 180, | ||
81 | .pressure_max = 255, | ||
82 | .debounce_max = 10, | ||
83 | .debounce_tol = 3, | ||
84 | .debounce_rep = 1, | ||
85 | .get_pendown_state = ads7846_get_pendown_state, | ||
86 | .keep_vref_on = 1, | ||
87 | }; | ||
88 | |||
89 | static struct spi_board_info overo_spi_board_info[] __initdata = { | ||
90 | { | ||
91 | .modalias = "ads7846", | ||
92 | .bus_num = 1, | ||
93 | .chip_select = 0, | ||
94 | .max_speed_hz = 1500000, | ||
95 | .controller_data = &ads7846_mcspi_config, | ||
96 | .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN), | ||
97 | .platform_data = &ads7846_config, | ||
98 | } | ||
99 | }; | ||
100 | |||
101 | static void __init overo_ads7846_init(void) | ||
102 | { | ||
103 | if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && | ||
104 | (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) { | ||
105 | gpio_export(OVERO_GPIO_PENDOWN, 0); | ||
106 | } else { | ||
107 | printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n"); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | spi_register_board_info(overo_spi_board_info, | ||
112 | ARRAY_SIZE(overo_spi_board_info)); | ||
113 | } | ||
114 | |||
115 | #else | ||
116 | static inline void __init overo_ads7846_init(void) { return; } | ||
117 | #endif | ||
118 | |||
60 | static struct mtd_partition overo_nand_partitions[] = { | 119 | static struct mtd_partition overo_nand_partitions[] = { |
61 | { | 120 | { |
62 | .name = "xloader", | 121 | .name = "xloader", |
@@ -230,6 +289,7 @@ static void __init overo_init(void) | |||
230 | twl4030_mmc_init(mmc); | 289 | twl4030_mmc_init(mmc); |
231 | overo_flash_init(); | 290 | overo_flash_init(); |
232 | usb_musb_init(); | 291 | usb_musb_init(); |
292 | overo_ads7846_init(); | ||
233 | 293 | ||
234 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, | 294 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, |
235 | "OVERO_GPIO_W2W_NRESET") == 0) && | 295 | "OVERO_GPIO_W2W_NRESET") == 0) && |