diff options
Diffstat (limited to 'arch/sh/boards/mach-migor/setup.c')
-rw-r--r-- | arch/sh/boards/mach-migor/setup.c | 195 |
1 files changed, 125 insertions, 70 deletions
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index 714dce91cc9b..769d63043424 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c | |||
@@ -17,14 +17,16 @@ | |||
17 | #include <linux/smc91x.h> | 17 | #include <linux/smc91x.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/gpio.h> | ||
20 | #include <media/soc_camera_platform.h> | 21 | #include <media/soc_camera_platform.h> |
21 | #include <media/sh_mobile_ceu.h> | 22 | #include <media/sh_mobile_ceu.h> |
23 | #include <video/sh_mobile_lcdc.h> | ||
22 | #include <asm/clock.h> | 24 | #include <asm/clock.h> |
23 | #include <asm/machvec.h> | 25 | #include <asm/machvec.h> |
24 | #include <asm/io.h> | 26 | #include <asm/io.h> |
25 | #include <asm/sh_keysc.h> | 27 | #include <asm/sh_keysc.h> |
26 | #include <asm/sh_mobile_lcdc.h> | 28 | #include <mach/migor.h> |
27 | #include <asm/migor.h> | 29 | #include <cpu/sh7722.h> |
28 | 30 | ||
29 | /* Address IRQ Size Bus Description | 31 | /* Address IRQ Size Bus Description |
30 | * 0x00000000 64MB 16 NOR Flash (SP29PL256N) | 32 | * 0x00000000 64MB 16 NOR Flash (SP29PL256N) |
@@ -35,7 +37,7 @@ | |||
35 | */ | 37 | */ |
36 | 38 | ||
37 | static struct smc91x_platdata smc91x_info = { | 39 | static struct smc91x_platdata smc91x_info = { |
38 | .flags = SMC91X_USE_16BIT, | 40 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
39 | }; | 41 | }; |
40 | 42 | ||
41 | static struct resource smc91x_eth_resources[] = { | 43 | static struct resource smc91x_eth_resources[] = { |
@@ -169,7 +171,7 @@ static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd, | |||
169 | 171 | ||
170 | static int migor_nand_flash_ready(struct mtd_info *mtd) | 172 | static int migor_nand_flash_ready(struct mtd_info *mtd) |
171 | { | 173 | { |
172 | return ctrl_inb(PORT_PADR) & 0x02; /* PTA1 */ | 174 | return gpio_get_value(GPIO_PTA1); /* NAND_RBn */ |
173 | } | 175 | } |
174 | 176 | ||
175 | struct platform_nand_data migor_nand_flash_data = { | 177 | struct platform_nand_data migor_nand_flash_data = { |
@@ -286,22 +288,15 @@ static struct clk *camera_clk; | |||
286 | 288 | ||
287 | static void camera_power_on(void) | 289 | static void camera_power_on(void) |
288 | { | 290 | { |
289 | unsigned char value; | ||
290 | |||
291 | camera_clk = clk_get(NULL, "video_clk"); | 291 | camera_clk = clk_get(NULL, "video_clk"); |
292 | clk_set_rate(camera_clk, 24000000); | 292 | clk_set_rate(camera_clk, 24000000); |
293 | clk_enable(camera_clk); /* start VIO_CKO */ | 293 | clk_enable(camera_clk); /* start VIO_CKO */ |
294 | 294 | ||
295 | /* use VIO_RST to take camera out of reset */ | ||
295 | mdelay(10); | 296 | mdelay(10); |
296 | value = ctrl_inb(PORT_PTDR); | 297 | gpio_set_value(GPIO_PTT3, 0); |
297 | value &= ~0x09; | ||
298 | #ifndef CONFIG_SH_MIGOR_RTA_WVGA | ||
299 | value |= 0x01; | ||
300 | #endif | ||
301 | ctrl_outb(value, PORT_PTDR); | ||
302 | mdelay(10); | 298 | mdelay(10); |
303 | 299 | gpio_set_value(GPIO_PTT3, 1); | |
304 | ctrl_outb(value | 8, PORT_PTDR); | ||
305 | } | 300 | } |
306 | 301 | ||
307 | static void camera_power_off(void) | 302 | static void camera_power_off(void) |
@@ -309,7 +304,7 @@ static void camera_power_off(void) | |||
309 | clk_disable(camera_clk); /* stop VIO_CKO */ | 304 | clk_disable(camera_clk); /* stop VIO_CKO */ |
310 | clk_put(camera_clk); | 305 | clk_put(camera_clk); |
311 | 306 | ||
312 | ctrl_outb(ctrl_inb(PORT_PTDR) & ~0x08, PORT_PTDR); | 307 | gpio_set_value(GPIO_PTT3, 0); |
313 | } | 308 | } |
314 | 309 | ||
315 | #ifdef CONFIG_I2C | 310 | #ifdef CONFIG_I2C |
@@ -458,75 +453,135 @@ static struct i2c_board_info migor_i2c_devices[] = { | |||
458 | 453 | ||
459 | static int __init migor_devices_setup(void) | 454 | static int __init migor_devices_setup(void) |
460 | { | 455 | { |
456 | /* Lit D11 LED */ | ||
457 | gpio_request(GPIO_PTJ7, NULL); | ||
458 | gpio_direction_output(GPIO_PTJ7, 1); | ||
459 | gpio_export(GPIO_PTJ7, 0); | ||
460 | |||
461 | /* Lit D12 LED */ | ||
462 | gpio_request(GPIO_PTJ5, NULL); | ||
463 | gpio_direction_output(GPIO_PTJ5, 1); | ||
464 | gpio_export(GPIO_PTJ5, 0); | ||
465 | |||
466 | /* SMC91C111 - Enable IRQ0, Setup CS4 for 16-bit fast access */ | ||
467 | gpio_request(GPIO_FN_IRQ0, NULL); | ||
468 | ctrl_outl(0x00003400, BSC_CS4BCR); | ||
469 | ctrl_outl(0x00110080, BSC_CS4WCR); | ||
470 | |||
471 | /* KEYSC */ | ||
461 | clk_always_enable("mstp214"); /* KEYSC */ | 472 | clk_always_enable("mstp214"); /* KEYSC */ |
473 | gpio_request(GPIO_FN_KEYOUT0, NULL); | ||
474 | gpio_request(GPIO_FN_KEYOUT1, NULL); | ||
475 | gpio_request(GPIO_FN_KEYOUT2, NULL); | ||
476 | gpio_request(GPIO_FN_KEYOUT3, NULL); | ||
477 | gpio_request(GPIO_FN_KEYOUT4_IN6, NULL); | ||
478 | gpio_request(GPIO_FN_KEYIN1, NULL); | ||
479 | gpio_request(GPIO_FN_KEYIN2, NULL); | ||
480 | gpio_request(GPIO_FN_KEYIN3, NULL); | ||
481 | gpio_request(GPIO_FN_KEYIN4, NULL); | ||
482 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); | ||
483 | |||
484 | /* NAND Flash */ | ||
485 | gpio_request(GPIO_FN_CS6A_CE2B, NULL); | ||
486 | ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR); | ||
487 | gpio_request(GPIO_PTA1, NULL); | ||
488 | gpio_direction_input(GPIO_PTA1); | ||
489 | |||
490 | /* Touch Panel */ | ||
491 | gpio_request(GPIO_FN_IRQ6, NULL); | ||
492 | |||
493 | /* LCD Panel */ | ||
462 | clk_always_enable("mstp200"); /* LCDC */ | 494 | clk_always_enable("mstp200"); /* LCDC */ |
495 | #ifdef CONFIG_SH_MIGOR_QVGA /* LCDC - QVGA - Enable SYS Interface signals */ | ||
496 | gpio_request(GPIO_FN_LCDD17, NULL); | ||
497 | gpio_request(GPIO_FN_LCDD16, NULL); | ||
498 | gpio_request(GPIO_FN_LCDD15, NULL); | ||
499 | gpio_request(GPIO_FN_LCDD14, NULL); | ||
500 | gpio_request(GPIO_FN_LCDD13, NULL); | ||
501 | gpio_request(GPIO_FN_LCDD12, NULL); | ||
502 | gpio_request(GPIO_FN_LCDD11, NULL); | ||
503 | gpio_request(GPIO_FN_LCDD10, NULL); | ||
504 | gpio_request(GPIO_FN_LCDD8, NULL); | ||
505 | gpio_request(GPIO_FN_LCDD7, NULL); | ||
506 | gpio_request(GPIO_FN_LCDD6, NULL); | ||
507 | gpio_request(GPIO_FN_LCDD5, NULL); | ||
508 | gpio_request(GPIO_FN_LCDD4, NULL); | ||
509 | gpio_request(GPIO_FN_LCDD3, NULL); | ||
510 | gpio_request(GPIO_FN_LCDD2, NULL); | ||
511 | gpio_request(GPIO_FN_LCDD1, NULL); | ||
512 | gpio_request(GPIO_FN_LCDRS, NULL); | ||
513 | gpio_request(GPIO_FN_LCDCS, NULL); | ||
514 | gpio_request(GPIO_FN_LCDRD, NULL); | ||
515 | gpio_request(GPIO_FN_LCDWR, NULL); | ||
516 | gpio_request(GPIO_PTH2, NULL); /* LCD_DON */ | ||
517 | gpio_direction_output(GPIO_PTH2, 1); | ||
518 | #endif | ||
519 | #ifdef CONFIG_SH_MIGOR_RTA_WVGA /* LCDC - WVGA - Enable RGB Interface signals */ | ||
520 | gpio_request(GPIO_FN_LCDD15, NULL); | ||
521 | gpio_request(GPIO_FN_LCDD14, NULL); | ||
522 | gpio_request(GPIO_FN_LCDD13, NULL); | ||
523 | gpio_request(GPIO_FN_LCDD12, NULL); | ||
524 | gpio_request(GPIO_FN_LCDD11, NULL); | ||
525 | gpio_request(GPIO_FN_LCDD10, NULL); | ||
526 | gpio_request(GPIO_FN_LCDD9, NULL); | ||
527 | gpio_request(GPIO_FN_LCDD8, NULL); | ||
528 | gpio_request(GPIO_FN_LCDD7, NULL); | ||
529 | gpio_request(GPIO_FN_LCDD6, NULL); | ||
530 | gpio_request(GPIO_FN_LCDD5, NULL); | ||
531 | gpio_request(GPIO_FN_LCDD4, NULL); | ||
532 | gpio_request(GPIO_FN_LCDD3, NULL); | ||
533 | gpio_request(GPIO_FN_LCDD2, NULL); | ||
534 | gpio_request(GPIO_FN_LCDD1, NULL); | ||
535 | gpio_request(GPIO_FN_LCDD0, NULL); | ||
536 | gpio_request(GPIO_FN_LCDLCLK, NULL); | ||
537 | gpio_request(GPIO_FN_LCDDCK, NULL); | ||
538 | gpio_request(GPIO_FN_LCDVEPWC, NULL); | ||
539 | gpio_request(GPIO_FN_LCDVCPWC, NULL); | ||
540 | gpio_request(GPIO_FN_LCDVSYN, NULL); | ||
541 | gpio_request(GPIO_FN_LCDHSYN, NULL); | ||
542 | gpio_request(GPIO_FN_LCDDISP, NULL); | ||
543 | gpio_request(GPIO_FN_LCDDON, NULL); | ||
544 | #endif | ||
545 | |||
546 | /* CEU */ | ||
463 | clk_always_enable("mstp203"); /* CEU */ | 547 | clk_always_enable("mstp203"); /* CEU */ |
548 | gpio_request(GPIO_FN_VIO_CLK2, NULL); | ||
549 | gpio_request(GPIO_FN_VIO_VD2, NULL); | ||
550 | gpio_request(GPIO_FN_VIO_HD2, NULL); | ||
551 | gpio_request(GPIO_FN_VIO_FLD, NULL); | ||
552 | gpio_request(GPIO_FN_VIO_CKO, NULL); | ||
553 | gpio_request(GPIO_FN_VIO_D15, NULL); | ||
554 | gpio_request(GPIO_FN_VIO_D14, NULL); | ||
555 | gpio_request(GPIO_FN_VIO_D13, NULL); | ||
556 | gpio_request(GPIO_FN_VIO_D12, NULL); | ||
557 | gpio_request(GPIO_FN_VIO_D11, NULL); | ||
558 | gpio_request(GPIO_FN_VIO_D10, NULL); | ||
559 | gpio_request(GPIO_FN_VIO_D9, NULL); | ||
560 | gpio_request(GPIO_FN_VIO_D8, NULL); | ||
561 | |||
562 | gpio_request(GPIO_PTT3, NULL); /* VIO_RST */ | ||
563 | gpio_direction_output(GPIO_PTT3, 0); | ||
564 | gpio_request(GPIO_PTT2, NULL); /* TV_IN_EN */ | ||
565 | gpio_direction_output(GPIO_PTT2, 1); | ||
566 | gpio_request(GPIO_PTT0, NULL); /* CAM_EN */ | ||
567 | #ifdef CONFIG_SH_MIGOR_RTA_WVGA | ||
568 | gpio_direction_output(GPIO_PTT0, 0); | ||
569 | #else | ||
570 | gpio_direction_output(GPIO_PTT0, 1); | ||
571 | #endif | ||
572 | ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x2000, PORT_MSELCRB); /* D15->D8 */ | ||
464 | 573 | ||
465 | platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20); | 574 | platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20); |
466 | 575 | ||
467 | i2c_register_board_info(0, migor_i2c_devices, | 576 | i2c_register_board_info(0, migor_i2c_devices, |
468 | ARRAY_SIZE(migor_i2c_devices)); | 577 | ARRAY_SIZE(migor_i2c_devices)); |
469 | 578 | ||
470 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); | 579 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); |
471 | } | 580 | } |
472 | __initcall(migor_devices_setup); | 581 | __initcall(migor_devices_setup); |
473 | 582 | ||
474 | static void __init migor_setup(char **cmdline_p) | 583 | static void __init migor_setup(char **cmdline_p) |
475 | { | 584 | { |
476 | /* SMC91C111 - Enable IRQ0 */ | ||
477 | ctrl_outw(ctrl_inw(PORT_PJCR) & ~0x0003, PORT_PJCR); | ||
478 | |||
479 | /* KEYSC */ | ||
480 | ctrl_outw(ctrl_inw(PORT_PYCR) & ~0x0fff, PORT_PYCR); | ||
481 | ctrl_outw(ctrl_inw(PORT_PZCR) & ~0x0ff0, PORT_PZCR); | ||
482 | ctrl_outw(ctrl_inw(PORT_PSELA) & ~0x4100, PORT_PSELA); | ||
483 | ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA); | ||
484 | ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC); | ||
485 | |||
486 | /* NAND Flash */ | ||
487 | ctrl_outw(ctrl_inw(PORT_PXCR) & 0x0fff, PORT_PXCR); | ||
488 | ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x00000600) | 0x00000200, | ||
489 | BSC_CS6ABCR); | ||
490 | |||
491 | /* Touch Panel - Enable IRQ6 */ | ||
492 | ctrl_outw(ctrl_inw(PORT_PZCR) & ~0xc, PORT_PZCR); | ||
493 | ctrl_outw((ctrl_inw(PORT_PSELA) | 0x8000), PORT_PSELA); | ||
494 | ctrl_outw((ctrl_inw(PORT_HIZCRC) & ~0x4000), PORT_HIZCRC); | ||
495 | |||
496 | #ifdef CONFIG_SH_MIGOR_RTA_WVGA | ||
497 | /* LCDC - WVGA - Enable RGB Interface signals */ | ||
498 | ctrl_outw(ctrl_inw(PORT_PACR) & ~0x0003, PORT_PACR); | ||
499 | ctrl_outw(0x0000, PORT_PHCR); | ||
500 | ctrl_outw(0x0000, PORT_PLCR); | ||
501 | ctrl_outw(0x0000, PORT_PMCR); | ||
502 | ctrl_outw(ctrl_inw(PORT_PRCR) & ~0x000f, PORT_PRCR); | ||
503 | ctrl_outw((ctrl_inw(PORT_PSELD) & ~0x000d) | 0x0400, PORT_PSELD); | ||
504 | ctrl_outw(ctrl_inw(PORT_MSELCRB) & ~0x0100, PORT_MSELCRB); | ||
505 | ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x01e0, PORT_HIZCRA); | ||
506 | #endif | ||
507 | #ifdef CONFIG_SH_MIGOR_QVGA | ||
508 | /* LCDC - QVGA - Enable SYS Interface signals */ | ||
509 | ctrl_outw(ctrl_inw(PORT_PACR) & ~0x0003, PORT_PACR); | ||
510 | ctrl_outw((ctrl_inw(PORT_PHCR) & ~0xcfff) | 0x0010, PORT_PHCR); | ||
511 | ctrl_outw(0x0000, PORT_PLCR); | ||
512 | ctrl_outw(0x0000, PORT_PMCR); | ||
513 | ctrl_outw(ctrl_inw(PORT_PRCR) & ~0x030f, PORT_PRCR); | ||
514 | ctrl_outw((ctrl_inw(PORT_PSELD) & ~0x0001) | 0x0420, PORT_PSELD); | ||
515 | ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x0100, PORT_MSELCRB); | ||
516 | ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x01e0, PORT_HIZCRA); | ||
517 | #endif | ||
518 | |||
519 | /* CEU */ | ||
520 | ctrl_outw((ctrl_inw(PORT_PTCR) & ~0x03c3) | 0x0051, PORT_PTCR); | ||
521 | ctrl_outw(ctrl_inw(PORT_PUCR) & ~0x03ff, PORT_PUCR); | ||
522 | ctrl_outw(ctrl_inw(PORT_PVCR) & ~0x03ff, PORT_PVCR); | ||
523 | ctrl_outw(ctrl_inw(PORT_PWCR) & ~0x3c00, PORT_PWCR); | ||
524 | ctrl_outw(ctrl_inw(PORT_PSELC) | 0x0001, PORT_PSELC); | ||
525 | ctrl_outw(ctrl_inw(PORT_PSELD) & ~0x2000, PORT_PSELD); | ||
526 | ctrl_outw(ctrl_inw(PORT_PSELE) | 0x000f, PORT_PSELE); | ||
527 | ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x2200, PORT_MSELCRB); | ||
528 | ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x0a00, PORT_HIZCRA); | ||
529 | ctrl_outw(ctrl_inw(PORT_HIZCRB) & ~0x0003, PORT_HIZCRB); | ||
530 | } | 585 | } |
531 | 586 | ||
532 | static struct sh_machine_vector mv_migor __initmv = { | 587 | static struct sh_machine_vector mv_migor __initmv = { |