diff options
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 237 |
1 files changed, 138 insertions, 99 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 08d08f4a3836..ee8d6038ce82 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/spi/ads7846.h> | 24 | #include <linux/spi/ads7846.h> |
25 | #include <linux/spi/corgi_lcd.h> | 25 | #include <linux/spi/corgi_lcd.h> |
26 | #include <linux/mtd/sharpsl.h> | 26 | #include <linux/mtd/sharpsl.h> |
27 | #include <linux/input/matrix_keypad.h> | ||
27 | 28 | ||
28 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
@@ -111,6 +112,26 @@ static unsigned long spitz_pin_config[] __initdata = { | |||
111 | GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */ | 112 | GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */ |
112 | GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */ | 113 | GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */ |
113 | 114 | ||
115 | /* GPIO matrix keypad */ | ||
116 | GPIO88_GPIO, /* column 0 */ | ||
117 | GPIO23_GPIO, /* column 1 */ | ||
118 | GPIO24_GPIO, /* column 2 */ | ||
119 | GPIO25_GPIO, /* column 3 */ | ||
120 | GPIO26_GPIO, /* column 4 */ | ||
121 | GPIO27_GPIO, /* column 5 */ | ||
122 | GPIO52_GPIO, /* column 6 */ | ||
123 | GPIO103_GPIO, /* column 7 */ | ||
124 | GPIO107_GPIO, /* column 8 */ | ||
125 | GPIO108_GPIO, /* column 9 */ | ||
126 | GPIO114_GPIO, /* column 10 */ | ||
127 | GPIO12_GPIO, /* row 0 */ | ||
128 | GPIO17_GPIO, /* row 1 */ | ||
129 | GPIO91_GPIO, /* row 2 */ | ||
130 | GPIO34_GPIO, /* row 3 */ | ||
131 | GPIO36_GPIO, /* row 4 */ | ||
132 | GPIO38_GPIO, /* row 5 */ | ||
133 | GPIO39_GPIO, /* row 6 */ | ||
134 | |||
114 | /* I2C */ | 135 | /* I2C */ |
115 | GPIO117_I2C_SCL, | 136 | GPIO117_I2C_SCL, |
116 | GPIO118_I2C_SDA, | 137 | GPIO118_I2C_SDA, |
@@ -242,9 +263,115 @@ EXPORT_SYMBOL(spitzscoop2_device); | |||
242 | /* | 263 | /* |
243 | * Spitz Keyboard Device | 264 | * Spitz Keyboard Device |
244 | */ | 265 | */ |
266 | #define SPITZ_KEY_CALENDAR KEY_F1 | ||
267 | #define SPITZ_KEY_ADDRESS KEY_F2 | ||
268 | #define SPITZ_KEY_FN KEY_F3 | ||
269 | #define SPITZ_KEY_CANCEL KEY_F4 | ||
270 | #define SPITZ_KEY_EXOK KEY_F5 | ||
271 | #define SPITZ_KEY_EXCANCEL KEY_F6 | ||
272 | #define SPITZ_KEY_EXJOGDOWN KEY_F7 | ||
273 | #define SPITZ_KEY_EXJOGUP KEY_F8 | ||
274 | #define SPITZ_KEY_JAP1 KEY_LEFTALT | ||
275 | #define SPITZ_KEY_JAP2 KEY_RIGHTCTRL | ||
276 | #define SPITZ_KEY_SYNC KEY_F9 | ||
277 | #define SPITZ_KEY_MAIL KEY_F10 | ||
278 | #define SPITZ_KEY_OK KEY_F11 | ||
279 | #define SPITZ_KEY_MENU KEY_F12 | ||
280 | |||
281 | static const uint32_t spitzkbd_keymap[] = { | ||
282 | KEY(0, 0, KEY_LEFTCTRL), | ||
283 | KEY(0, 1, KEY_1), | ||
284 | KEY(0, 2, KEY_3), | ||
285 | KEY(0, 3, KEY_5), | ||
286 | KEY(0, 4, KEY_6), | ||
287 | KEY(0, 5, KEY_7), | ||
288 | KEY(0, 6, KEY_9), | ||
289 | KEY(0, 7, KEY_0), | ||
290 | KEY(0, 8, KEY_BACKSPACE), | ||
291 | KEY(0, 9, SPITZ_KEY_EXOK), /* EXOK */ | ||
292 | KEY(0, 10, SPITZ_KEY_EXCANCEL), /* EXCANCEL */ | ||
293 | KEY(1, 1, KEY_2), | ||
294 | KEY(1, 2, KEY_4), | ||
295 | KEY(1, 3, KEY_R), | ||
296 | KEY(1, 4, KEY_Y), | ||
297 | KEY(1, 5, KEY_8), | ||
298 | KEY(1, 6, KEY_I), | ||
299 | KEY(1, 7, KEY_O), | ||
300 | KEY(1, 8, KEY_P), | ||
301 | KEY(1, 9, SPITZ_KEY_EXJOGDOWN), /* EXJOGDOWN */ | ||
302 | KEY(1, 10, SPITZ_KEY_EXJOGUP), /* EXJOGUP */ | ||
303 | KEY(2, 0, KEY_TAB), | ||
304 | KEY(2, 1, KEY_Q), | ||
305 | KEY(2, 2, KEY_E), | ||
306 | KEY(2, 3, KEY_T), | ||
307 | KEY(2, 4, KEY_G), | ||
308 | KEY(2, 5, KEY_U), | ||
309 | KEY(2, 6, KEY_J), | ||
310 | KEY(2, 7, KEY_K), | ||
311 | KEY(3, 0, SPITZ_KEY_ADDRESS), /* ADDRESS */ | ||
312 | KEY(3, 1, KEY_W), | ||
313 | KEY(3, 2, KEY_S), | ||
314 | KEY(3, 3, KEY_F), | ||
315 | KEY(3, 4, KEY_V), | ||
316 | KEY(3, 5, KEY_H), | ||
317 | KEY(3, 6, KEY_M), | ||
318 | KEY(3, 7, KEY_L), | ||
319 | KEY(3, 9, KEY_RIGHTSHIFT), | ||
320 | KEY(4, 0, SPITZ_KEY_CALENDAR), /* CALENDAR */ | ||
321 | KEY(4, 1, KEY_A), | ||
322 | KEY(4, 2, KEY_D), | ||
323 | KEY(4, 3, KEY_C), | ||
324 | KEY(4, 4, KEY_B), | ||
325 | KEY(4, 5, KEY_N), | ||
326 | KEY(4, 6, KEY_DOT), | ||
327 | KEY(4, 8, KEY_ENTER), | ||
328 | KEY(4, 9, KEY_LEFTSHIFT), | ||
329 | KEY(5, 0, SPITZ_KEY_MAIL), /* MAIL */ | ||
330 | KEY(5, 1, KEY_Z), | ||
331 | KEY(5, 2, KEY_X), | ||
332 | KEY(5, 3, KEY_MINUS), | ||
333 | KEY(5, 4, KEY_SPACE), | ||
334 | KEY(5, 5, KEY_COMMA), | ||
335 | KEY(5, 7, KEY_UP), | ||
336 | KEY(5, 10, SPITZ_KEY_FN), /* FN */ | ||
337 | KEY(6, 0, KEY_SYSRQ), | ||
338 | KEY(6, 1, SPITZ_KEY_JAP1), /* JAP1 */ | ||
339 | KEY(6, 2, SPITZ_KEY_JAP2), /* JAP2 */ | ||
340 | KEY(6, 3, SPITZ_KEY_CANCEL), /* CANCEL */ | ||
341 | KEY(6, 4, SPITZ_KEY_OK), /* OK */ | ||
342 | KEY(6, 5, SPITZ_KEY_MENU), /* MENU */ | ||
343 | KEY(6, 6, KEY_LEFT), | ||
344 | KEY(6, 7, KEY_DOWN), | ||
345 | KEY(6, 8, KEY_RIGHT), | ||
346 | }; | ||
347 | |||
348 | static const struct matrix_keymap_data spitzkbd_keymap_data = { | ||
349 | .keymap = spitzkbd_keymap, | ||
350 | .keymap_size = ARRAY_SIZE(spitzkbd_keymap), | ||
351 | }; | ||
352 | |||
353 | static const uint32_t spitzkbd_row_gpios[] = | ||
354 | { 12, 17, 91, 34, 36, 38, 39 }; | ||
355 | static const uint32_t spitzkbd_col_gpios[] = | ||
356 | { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 }; | ||
357 | |||
358 | static struct matrix_keypad_platform_data spitzkbd_pdata = { | ||
359 | .keymap_data = &spitzkbd_keymap_data, | ||
360 | .row_gpios = spitzkbd_row_gpios, | ||
361 | .col_gpios = spitzkbd_col_gpios, | ||
362 | .num_row_gpios = ARRAY_SIZE(spitzkbd_row_gpios), | ||
363 | .num_col_gpios = ARRAY_SIZE(spitzkbd_col_gpios), | ||
364 | .col_scan_delay_us = 10, | ||
365 | .debounce_ms = 10, | ||
366 | .wakeup = 1, | ||
367 | }; | ||
368 | |||
245 | static struct platform_device spitzkbd_device = { | 369 | static struct platform_device spitzkbd_device = { |
246 | .name = "spitz-keyboard", | 370 | .name = "matrix-keypad", |
247 | .id = -1, | 371 | .id = -1, |
372 | .dev = { | ||
373 | .platform_data = &spitzkbd_pdata, | ||
374 | }, | ||
248 | }; | 375 | }; |
249 | 376 | ||
250 | 377 | ||
@@ -379,45 +506,6 @@ static inline void spitz_init_spi(void) {} | |||
379 | * The card detect interrupt isn't debounced so we delay it by 250ms | 506 | * The card detect interrupt isn't debounced so we delay it by 250ms |
380 | * to give the card a chance to fully insert/eject. | 507 | * to give the card a chance to fully insert/eject. |
381 | */ | 508 | */ |
382 | |||
383 | static struct pxamci_platform_data spitz_mci_platform_data; | ||
384 | |||
385 | static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data) | ||
386 | { | ||
387 | int err; | ||
388 | |||
389 | err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT"); | ||
390 | if (err) | ||
391 | goto err_out; | ||
392 | |||
393 | err = gpio_request(SPITZ_GPIO_nSD_WP, "nSD_WP"); | ||
394 | if (err) | ||
395 | goto err_free_1; | ||
396 | |||
397 | gpio_direction_input(SPITZ_GPIO_nSD_DETECT); | ||
398 | gpio_direction_input(SPITZ_GPIO_nSD_WP); | ||
399 | |||
400 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
401 | |||
402 | err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, | ||
403 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
404 | IRQF_TRIGGER_FALLING, | ||
405 | "MMC card detect", data); | ||
406 | if (err) { | ||
407 | pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n", | ||
408 | __func__); | ||
409 | goto err_free_2; | ||
410 | } | ||
411 | return 0; | ||
412 | |||
413 | err_free_2: | ||
414 | gpio_free(SPITZ_GPIO_nSD_WP); | ||
415 | err_free_1: | ||
416 | gpio_free(SPITZ_GPIO_nSD_DETECT); | ||
417 | err_out: | ||
418 | return err; | ||
419 | } | ||
420 | |||
421 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) | 509 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
422 | { | 510 | { |
423 | struct pxamci_platform_data* p_d = dev->platform_data; | 511 | struct pxamci_platform_data* p_d = dev->platform_data; |
@@ -428,24 +516,12 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd) | |||
428 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); | 516 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); |
429 | } | 517 | } |
430 | 518 | ||
431 | static int spitz_mci_get_ro(struct device *dev) | ||
432 | { | ||
433 | return gpio_get_value(SPITZ_GPIO_nSD_WP); | ||
434 | } | ||
435 | |||
436 | static void spitz_mci_exit(struct device *dev, void *data) | ||
437 | { | ||
438 | free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data); | ||
439 | gpio_free(SPITZ_GPIO_nSD_WP); | ||
440 | gpio_free(SPITZ_GPIO_nSD_DETECT); | ||
441 | } | ||
442 | |||
443 | static struct pxamci_platform_data spitz_mci_platform_data = { | 519 | static struct pxamci_platform_data spitz_mci_platform_data = { |
444 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 520 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
445 | .init = spitz_mci_init, | 521 | .setpower = spitz_mci_setpower, |
446 | .get_ro = spitz_mci_get_ro, | 522 | .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, |
447 | .setpower = spitz_mci_setpower, | 523 | .gpio_card_ro = SPITZ_GPIO_nSD_WP, |
448 | .exit = spitz_mci_exit, | 524 | .gpio_power = -1, |
449 | }; | 525 | }; |
450 | 526 | ||
451 | 527 | ||
@@ -485,50 +561,10 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = { | |||
485 | /* | 561 | /* |
486 | * Irda | 562 | * Irda |
487 | */ | 563 | */ |
488 | static int spitz_irda_startup(struct device *dev) | ||
489 | { | ||
490 | int rc; | ||
491 | |||
492 | rc = gpio_request(SPITZ_GPIO_IR_ON, "IrDA on"); | ||
493 | if (rc) | ||
494 | goto err; | ||
495 | |||
496 | rc = gpio_direction_output(SPITZ_GPIO_IR_ON, 1); | ||
497 | if (rc) | ||
498 | goto err_dir; | ||
499 | |||
500 | return 0; | ||
501 | |||
502 | err_dir: | ||
503 | gpio_free(SPITZ_GPIO_IR_ON); | ||
504 | err: | ||
505 | return rc; | ||
506 | } | ||
507 | |||
508 | static void spitz_irda_shutdown(struct device *dev) | ||
509 | { | ||
510 | gpio_free(SPITZ_GPIO_IR_ON); | ||
511 | } | ||
512 | |||
513 | static void spitz_irda_transceiver_mode(struct device *dev, int mode) | ||
514 | { | ||
515 | gpio_set_value(SPITZ_GPIO_IR_ON, mode & IR_OFF); | ||
516 | pxa2xx_transceiver_mode(dev, mode); | ||
517 | } | ||
518 | |||
519 | #ifdef CONFIG_MACH_AKITA | ||
520 | static void akita_irda_transceiver_mode(struct device *dev, int mode) | ||
521 | { | ||
522 | gpio_set_value(AKITA_GPIO_IR_ON, mode & IR_OFF); | ||
523 | pxa2xx_transceiver_mode(dev, mode); | ||
524 | } | ||
525 | #endif | ||
526 | 564 | ||
527 | static struct pxaficp_platform_data spitz_ficp_platform_data = { | 565 | static struct pxaficp_platform_data spitz_ficp_platform_data = { |
566 | /* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */ | ||
528 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 567 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
529 | .transceiver_mode = spitz_irda_transceiver_mode, | ||
530 | .startup = spitz_irda_startup, | ||
531 | .shutdown = spitz_irda_shutdown, | ||
532 | }; | 568 | }; |
533 | 569 | ||
534 | 570 | ||
@@ -696,6 +732,7 @@ static void __init common_init(void) | |||
696 | spitz_init_spi(); | 732 | spitz_init_spi(); |
697 | 733 | ||
698 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 734 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
735 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
699 | pxa_set_mci_info(&spitz_mci_platform_data); | 736 | pxa_set_mci_info(&spitz_mci_platform_data); |
700 | pxa_set_ohci_info(&spitz_ohci_platform_data); | 737 | pxa_set_ohci_info(&spitz_ohci_platform_data); |
701 | pxa_set_ficp_info(&spitz_ficp_platform_data); | 738 | pxa_set_ficp_info(&spitz_ficp_platform_data); |
@@ -706,6 +743,8 @@ static void __init common_init(void) | |||
706 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) | 743 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) |
707 | static void __init spitz_init(void) | 744 | static void __init spitz_init(void) |
708 | { | 745 | { |
746 | spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON; | ||
747 | |||
709 | platform_scoop_config = &spitz_pcmcia_config; | 748 | platform_scoop_config = &spitz_pcmcia_config; |
710 | 749 | ||
711 | common_init(); | 750 | common_init(); |
@@ -748,7 +787,7 @@ static struct nand_ecclayout akita_oobinfo = { | |||
748 | 787 | ||
749 | static void __init akita_init(void) | 788 | static void __init akita_init(void) |
750 | { | 789 | { |
751 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; | 790 | spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON; |
752 | 791 | ||
753 | sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; | 792 | sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; |
754 | sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; | 793 | sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; |