diff options
Diffstat (limited to 'arch/arm/mach-omap1/board-osk.c')
-rw-r--r-- | arch/arm/mach-omap1/board-osk.c | 147 |
1 files changed, 94 insertions, 53 deletions
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 1160093e8ef6..e0711d23a6b0 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <linux/mtd/mtd.h> | 34 | #include <linux/mtd/mtd.h> |
35 | #include <linux/mtd/partitions.h> | 35 | #include <linux/mtd/partitions.h> |
36 | #include <linux/input.h> | ||
37 | 36 | ||
38 | #include <asm/hardware.h> | 37 | #include <asm/hardware.h> |
39 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
@@ -45,25 +44,10 @@ | |||
45 | #include <asm/arch/usb.h> | 44 | #include <asm/arch/usb.h> |
46 | #include <asm/arch/mux.h> | 45 | #include <asm/arch/mux.h> |
47 | #include <asm/arch/tc.h> | 46 | #include <asm/arch/tc.h> |
48 | #include <asm/arch/keypad.h> | ||
49 | #include <asm/arch/common.h> | 47 | #include <asm/arch/common.h> |
50 | #include <asm/arch/mcbsp.h> | 48 | #include <asm/arch/mcbsp.h> |
51 | #include <asm/arch/omap-alsa.h> | 49 | #include <asm/arch/omap-alsa.h> |
52 | 50 | ||
53 | static int osk_keymap[] = { | ||
54 | KEY(0, 0, KEY_F1), | ||
55 | KEY(0, 3, KEY_UP), | ||
56 | KEY(1, 1, KEY_LEFTCTRL), | ||
57 | KEY(1, 2, KEY_LEFT), | ||
58 | KEY(2, 0, KEY_SPACE), | ||
59 | KEY(2, 1, KEY_ESC), | ||
60 | KEY(2, 2, KEY_DOWN), | ||
61 | KEY(3, 2, KEY_ENTER), | ||
62 | KEY(3, 3, KEY_RIGHT), | ||
63 | 0 | ||
64 | }; | ||
65 | |||
66 | |||
67 | static struct mtd_partition osk_partitions[] = { | 51 | static struct mtd_partition osk_partitions[] = { |
68 | /* bootloader (U-Boot, etc) in first sector */ | 52 | /* bootloader (U-Boot, etc) in first sector */ |
69 | { | 53 | { |
@@ -181,48 +165,17 @@ static struct omap_alsa_codec_config alsa_config = { | |||
181 | 165 | ||
182 | static struct platform_device osk5912_mcbsp1_device = { | 166 | static struct platform_device osk5912_mcbsp1_device = { |
183 | .name = "omap_alsa_mcbsp", | 167 | .name = "omap_alsa_mcbsp", |
184 | .id = 1, | 168 | .id = 1, |
185 | .dev = { | 169 | .dev = { |
186 | .platform_data = &alsa_config, | 170 | .platform_data = &alsa_config, |
187 | }, | 171 | }, |
188 | }; | 172 | }; |
189 | 173 | ||
190 | static struct resource osk5912_kp_resources[] = { | ||
191 | [0] = { | ||
192 | .start = INT_KEYBOARD, | ||
193 | .end = INT_KEYBOARD, | ||
194 | .flags = IORESOURCE_IRQ, | ||
195 | }, | ||
196 | }; | ||
197 | |||
198 | static struct omap_kp_platform_data osk_kp_data = { | ||
199 | .rows = 8, | ||
200 | .cols = 8, | ||
201 | .keymap = osk_keymap, | ||
202 | }; | ||
203 | |||
204 | static struct platform_device osk5912_kp_device = { | ||
205 | .name = "omap-keypad", | ||
206 | .id = -1, | ||
207 | .dev = { | ||
208 | .platform_data = &osk_kp_data, | ||
209 | }, | ||
210 | .num_resources = ARRAY_SIZE(osk5912_kp_resources), | ||
211 | .resource = osk5912_kp_resources, | ||
212 | }; | ||
213 | |||
214 | static struct platform_device osk5912_lcd_device = { | ||
215 | .name = "lcd_osk", | ||
216 | .id = -1, | ||
217 | }; | ||
218 | |||
219 | static struct platform_device *osk5912_devices[] __initdata = { | 174 | static struct platform_device *osk5912_devices[] __initdata = { |
220 | &osk5912_flash_device, | 175 | &osk5912_flash_device, |
221 | &osk5912_smc91x_device, | 176 | &osk5912_smc91x_device, |
222 | &osk5912_cf_device, | 177 | &osk5912_cf_device, |
223 | &osk5912_mcbsp1_device, | 178 | &osk5912_mcbsp1_device, |
224 | &osk5912_kp_device, | ||
225 | &osk5912_lcd_device, | ||
226 | }; | 179 | }; |
227 | 180 | ||
228 | static void __init osk_init_smc91x(void) | 181 | static void __init osk_init_smc91x(void) |
@@ -276,18 +229,100 @@ static struct omap_uart_config osk_uart_config __initdata = { | |||
276 | .enabled_uarts = (1 << 0), | 229 | .enabled_uarts = (1 << 0), |
277 | }; | 230 | }; |
278 | 231 | ||
232 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
279 | static struct omap_lcd_config osk_lcd_config __initdata = { | 233 | static struct omap_lcd_config osk_lcd_config __initdata = { |
280 | .ctrl_name = "internal", | 234 | .ctrl_name = "internal", |
281 | }; | 235 | }; |
236 | #endif | ||
282 | 237 | ||
283 | static struct omap_board_config_kernel osk_config[] = { | 238 | static struct omap_board_config_kernel osk_config[] = { |
284 | { OMAP_TAG_USB, &osk_usb_config }, | 239 | { OMAP_TAG_USB, &osk_usb_config }, |
285 | { OMAP_TAG_UART, &osk_uart_config }, | 240 | { OMAP_TAG_UART, &osk_uart_config }, |
241 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
286 | { OMAP_TAG_LCD, &osk_lcd_config }, | 242 | { OMAP_TAG_LCD, &osk_lcd_config }, |
243 | #endif | ||
287 | }; | 244 | }; |
288 | 245 | ||
289 | #ifdef CONFIG_OMAP_OSK_MISTRAL | 246 | #ifdef CONFIG_OMAP_OSK_MISTRAL |
290 | 247 | ||
248 | #include <linux/input.h> | ||
249 | #include <linux/spi/spi.h> | ||
250 | #include <linux/spi/ads7846.h> | ||
251 | |||
252 | #include <asm/arch/keypad.h> | ||
253 | |||
254 | static const int osk_keymap[] = { | ||
255 | /* KEY(col, row, code) */ | ||
256 | KEY(0, 0, KEY_F1), /* SW4 */ | ||
257 | KEY(0, 3, KEY_UP), /* (sw2/up) */ | ||
258 | KEY(1, 1, KEY_LEFTCTRL), /* SW5 */ | ||
259 | KEY(1, 2, KEY_LEFT), /* (sw2/left) */ | ||
260 | KEY(2, 0, KEY_SPACE), /* SW3 */ | ||
261 | KEY(2, 1, KEY_ESC), /* SW6 */ | ||
262 | KEY(2, 2, KEY_DOWN), /* (sw2/down) */ | ||
263 | KEY(3, 2, KEY_ENTER), /* (sw2/select) */ | ||
264 | KEY(3, 3, KEY_RIGHT), /* (sw2/right) */ | ||
265 | 0 | ||
266 | }; | ||
267 | |||
268 | static struct omap_kp_platform_data osk_kp_data = { | ||
269 | .rows = 8, | ||
270 | .cols = 8, | ||
271 | .keymap = (int *) osk_keymap, | ||
272 | }; | ||
273 | |||
274 | static struct resource osk5912_kp_resources[] = { | ||
275 | [0] = { | ||
276 | .start = INT_KEYBOARD, | ||
277 | .end = INT_KEYBOARD, | ||
278 | .flags = IORESOURCE_IRQ, | ||
279 | }, | ||
280 | }; | ||
281 | |||
282 | static struct platform_device osk5912_kp_device = { | ||
283 | .name = "omap-keypad", | ||
284 | .id = -1, | ||
285 | .dev = { | ||
286 | .platform_data = &osk_kp_data, | ||
287 | }, | ||
288 | .num_resources = ARRAY_SIZE(osk5912_kp_resources), | ||
289 | .resource = osk5912_kp_resources, | ||
290 | }; | ||
291 | |||
292 | static struct platform_device osk5912_lcd_device = { | ||
293 | .name = "lcd_osk", | ||
294 | .id = -1, | ||
295 | }; | ||
296 | |||
297 | static struct platform_device *mistral_devices[] __initdata = { | ||
298 | &osk5912_kp_device, | ||
299 | &osk5912_lcd_device, | ||
300 | }; | ||
301 | |||
302 | static int mistral_get_pendown_state(void) | ||
303 | { | ||
304 | return !omap_get_gpio_datain(4); | ||
305 | } | ||
306 | |||
307 | static const struct ads7846_platform_data mistral_ts_info = { | ||
308 | .model = 7846, | ||
309 | .vref_delay_usecs = 100, /* internal, no capacitor */ | ||
310 | .x_plate_ohms = 419, | ||
311 | .y_plate_ohms = 486, | ||
312 | .get_pendown_state = mistral_get_pendown_state, | ||
313 | }; | ||
314 | |||
315 | static struct spi_board_info __initdata mistral_boardinfo[] = { { | ||
316 | /* MicroWire (bus 2) CS0 has an ads7846e */ | ||
317 | .modalias = "ads7846", | ||
318 | .platform_data = &mistral_ts_info, | ||
319 | .irq = OMAP_GPIO_IRQ(4), | ||
320 | .max_speed_hz = 120000 /* max sample rate at 3V */ | ||
321 | * 26 /* command + data + overhead */, | ||
322 | .bus_num = 2, | ||
323 | .chip_select = 0, | ||
324 | } }; | ||
325 | |||
291 | #ifdef CONFIG_PM | 326 | #ifdef CONFIG_PM |
292 | static irqreturn_t | 327 | static irqreturn_t |
293 | osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs) | 328 | osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs) |
@@ -298,14 +333,18 @@ osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs) | |||
298 | 333 | ||
299 | static void __init osk_mistral_init(void) | 334 | static void __init osk_mistral_init(void) |
300 | { | 335 | { |
301 | /* FIXME here's where to feed in framebuffer, touchpad, and | 336 | /* NOTE: we could actually tell if there's a Mistral board |
302 | * keyboard setup ... not in the drivers for those devices! | ||
303 | * | ||
304 | * NOTE: we could actually tell if there's a Mistral board | ||
305 | * attached, e.g. by trying to read something from the ads7846. | 337 | * attached, e.g. by trying to read something from the ads7846. |
306 | * But this is too early for that... | 338 | * But this arch_init() code is too early for that, since we |
339 | * can't talk to the ads or even the i2c eeprom. | ||
307 | */ | 340 | */ |
308 | 341 | ||
342 | // omap_cfg_reg(P19_1610_GPIO6); // BUSY | ||
343 | omap_cfg_reg(P20_1610_GPIO4); // PENIRQ | ||
344 | set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); | ||
345 | spi_register_board_info(mistral_boardinfo, | ||
346 | ARRAY_SIZE(mistral_boardinfo)); | ||
347 | |||
309 | /* the sideways button (SW1) is for use as a "wakeup" button */ | 348 | /* the sideways button (SW1) is for use as a "wakeup" button */ |
310 | omap_cfg_reg(N15_1610_MPUIO2); | 349 | omap_cfg_reg(N15_1610_MPUIO2); |
311 | if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { | 350 | if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { |
@@ -329,6 +368,8 @@ static void __init osk_mistral_init(void) | |||
329 | #endif | 368 | #endif |
330 | } else | 369 | } else |
331 | printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); | 370 | printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); |
371 | |||
372 | platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); | ||
332 | } | 373 | } |
333 | #else | 374 | #else |
334 | static void __init osk_mistral_init(void) { } | 375 | static void __init osk_mistral_init(void) { } |