diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2010-05-24 02:50:44 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-31 00:24:23 -0400 |
commit | cb9215e1fa13860fa8fbe9941a59fcbc45781373 (patch) | |
tree | 3cc7aadf0ba24e6083187e9e29c5462935f2bd79 /arch/arm/mach-shmobile/board-ap4evb.c | |
parent | 69bf6f451febe8dd07ccedf0ba3279c0f3f7fc3a (diff) |
ARM: mach-shmobile: ap4evb: Add FSI2 support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-ap4evb.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-ap4evb.c | 135 |
1 files changed, 132 insertions, 3 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 5c41b958e022..8fb51f5157f9 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -32,11 +32,15 @@ | |||
32 | #include <linux/i2c/tsc2007.h> | 32 | #include <linux/i2c/tsc2007.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/smsc911x.h> | 34 | #include <linux/smsc911x.h> |
35 | #include <linux/sh_intc.h> | ||
36 | #include <linux/sh_clk.h> | ||
35 | #include <linux/gpio.h> | 37 | #include <linux/gpio.h> |
36 | #include <linux/input.h> | 38 | #include <linux/input.h> |
37 | #include <linux/input/sh_keysc.h> | 39 | #include <linux/input/sh_keysc.h> |
38 | #include <linux/usb/r8a66597.h> | 40 | #include <linux/usb/r8a66597.h> |
39 | 41 | ||
42 | #include <sound/sh_fsi.h> | ||
43 | |||
40 | #include <video/sh_mobile_lcdc.h> | 44 | #include <video/sh_mobile_lcdc.h> |
41 | #include <video/sh_mipi_dsi.h> | 45 | #include <video/sh_mipi_dsi.h> |
42 | 46 | ||
@@ -113,6 +117,13 @@ | |||
113 | * S39: bit2: off | 117 | * S39: bit2: off |
114 | */ | 118 | */ |
115 | 119 | ||
120 | /* | ||
121 | * FSI/FSMI | ||
122 | * | ||
123 | * SW41 : ON : SH-Mobile AP4 Audio Mode | ||
124 | * : OFF : Bluetooth Audio Mode | ||
125 | */ | ||
126 | |||
116 | /* MTD */ | 127 | /* MTD */ |
117 | static struct mtd_partition nor_flash_partitions[] = { | 128 | static struct mtd_partition nor_flash_partitions[] = { |
118 | { | 129 | { |
@@ -373,6 +384,60 @@ static struct platform_device mipidsi0_device = { | |||
373 | }, | 384 | }, |
374 | }; | 385 | }; |
375 | 386 | ||
387 | /* FSI */ | ||
388 | #define IRQ_FSI evt2irq(0x1840) | ||
389 | #define FSIACKCR 0xE6150018 | ||
390 | static void fsiackcr_init(struct clk *clk) | ||
391 | { | ||
392 | u32 status = __raw_readl(clk->enable_reg); | ||
393 | |||
394 | /* use external clock */ | ||
395 | status &= ~0x000000ff; | ||
396 | status |= 0x00000080; | ||
397 | __raw_writel(status, clk->enable_reg); | ||
398 | } | ||
399 | |||
400 | static struct clk_ops fsiackcr_clk_ops = { | ||
401 | .init = fsiackcr_init, | ||
402 | }; | ||
403 | |||
404 | static struct clk fsiackcr_clk = { | ||
405 | .ops = &fsiackcr_clk_ops, | ||
406 | .enable_reg = (void __iomem *)FSIACKCR, | ||
407 | .rate = 0, /* unknown */ | ||
408 | }; | ||
409 | |||
410 | struct sh_fsi_platform_info fsi_info = { | ||
411 | .porta_flags = SH_FSI_BRS_INV | | ||
412 | SH_FSI_OUT_SLAVE_MODE | | ||
413 | SH_FSI_IN_SLAVE_MODE | | ||
414 | SH_FSI_OFMT(PCM) | | ||
415 | SH_FSI_IFMT(PCM), | ||
416 | }; | ||
417 | |||
418 | static struct resource fsi_resources[] = { | ||
419 | [0] = { | ||
420 | .name = "FSI", | ||
421 | .start = 0xFE3C0000, | ||
422 | .end = 0xFE3C0400 - 1, | ||
423 | .flags = IORESOURCE_MEM, | ||
424 | }, | ||
425 | [1] = { | ||
426 | .start = IRQ_FSI, | ||
427 | .flags = IORESOURCE_IRQ, | ||
428 | }, | ||
429 | }; | ||
430 | |||
431 | static struct platform_device fsi_device = { | ||
432 | .name = "sh_fsi2", | ||
433 | .id = 0, | ||
434 | .num_resources = ARRAY_SIZE(fsi_resources), | ||
435 | .resource = fsi_resources, | ||
436 | .dev = { | ||
437 | .platform_data = &fsi_info, | ||
438 | }, | ||
439 | }; | ||
440 | |||
376 | static struct platform_device *ap4evb_devices[] __initdata = { | 441 | static struct platform_device *ap4evb_devices[] __initdata = { |
377 | &nor_flash_device, | 442 | &nor_flash_device, |
378 | &smc911x_device, | 443 | &smc911x_device, |
@@ -381,6 +446,7 @@ static struct platform_device *ap4evb_devices[] __initdata = { | |||
381 | &usb1_host_device, | 446 | &usb1_host_device, |
382 | &lcdc_device, | 447 | &lcdc_device, |
383 | &mipidsi0_device, | 448 | &mipidsi0_device, |
449 | &fsi_device, | ||
384 | }; | 450 | }; |
385 | 451 | ||
386 | /* TouchScreen (Needs SW3 set to OFF) */ | 452 | /* TouchScreen (Needs SW3 set to OFF) */ |
@@ -391,6 +457,12 @@ struct tsc2007_platform_data tsc2007_info = { | |||
391 | }; | 457 | }; |
392 | 458 | ||
393 | /* I2C */ | 459 | /* I2C */ |
460 | static struct i2c_board_info i2c0_devices[] = { | ||
461 | { | ||
462 | I2C_BOARD_INFO("ak4643", 0x13), | ||
463 | }, | ||
464 | }; | ||
465 | |||
394 | static struct i2c_board_info i2c1_devices[] = { | 466 | static struct i2c_board_info i2c1_devices[] = { |
395 | { | 467 | { |
396 | I2C_BOARD_INFO("r2025sd", 0x32), | 468 | I2C_BOARD_INFO("r2025sd", 0x32), |
@@ -463,8 +535,27 @@ eclkdsitxget: | |||
463 | 535 | ||
464 | device_initcall(ap4evb_init_display_clk); | 536 | device_initcall(ap4evb_init_display_clk); |
465 | 537 | ||
538 | /* | ||
539 | * FIXME !! | ||
540 | * | ||
541 | * gpio_no_direction is quick_hack. | ||
542 | * | ||
543 | * current gpio frame work doesn't have | ||
544 | * the method to control only pull up/down/free. | ||
545 | * this function should be replaced by correct gpio function | ||
546 | */ | ||
547 | static void __init gpio_no_direction(u32 addr) | ||
548 | { | ||
549 | __raw_writeb(0x00, addr); | ||
550 | } | ||
551 | |||
552 | #define GPIO_PORT9CR 0xE6051009 | ||
553 | #define GPIO_PORT10CR 0xE605100A | ||
554 | |||
466 | static void __init ap4evb_init(void) | 555 | static void __init ap4evb_init(void) |
467 | { | 556 | { |
557 | struct clk *clk; | ||
558 | |||
468 | sh7372_pinmux_init(); | 559 | sh7372_pinmux_init(); |
469 | 560 | ||
470 | /* enable SCIFA0 */ | 561 | /* enable SCIFA0 */ |
@@ -529,9 +620,6 @@ static void __init ap4evb_init(void) | |||
529 | gpio_request(GPIO_FN_IRQ28_123, NULL); | 620 | gpio_request(GPIO_FN_IRQ28_123, NULL); |
530 | set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW); | 621 | set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW); |
531 | 622 | ||
532 | i2c_register_board_info(1, i2c1_devices, | ||
533 | ARRAY_SIZE(i2c1_devices)); | ||
534 | |||
535 | /* USB enable */ | 623 | /* USB enable */ |
536 | gpio_request(GPIO_FN_VBUS0_1, NULL); | 624 | gpio_request(GPIO_FN_VBUS0_1, NULL); |
537 | gpio_request(GPIO_FN_IDIN_1_18, NULL); | 625 | gpio_request(GPIO_FN_IDIN_1_18, NULL); |
@@ -543,6 +631,47 @@ static void __init ap4evb_init(void) | |||
543 | /* setup USB phy */ | 631 | /* setup USB phy */ |
544 | __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ | 632 | __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ |
545 | 633 | ||
634 | /* enable FSI2 */ | ||
635 | gpio_request(GPIO_FN_FSIAIBT, NULL); | ||
636 | gpio_request(GPIO_FN_FSIAILR, NULL); | ||
637 | gpio_request(GPIO_FN_FSIAISLD, NULL); | ||
638 | gpio_request(GPIO_FN_FSIAOSLD, NULL); | ||
639 | gpio_request(GPIO_PORT161, NULL); | ||
640 | gpio_direction_output(GPIO_PORT161, 0); /* slave */ | ||
641 | |||
642 | gpio_request(GPIO_PORT9, NULL); | ||
643 | gpio_request(GPIO_PORT10, NULL); | ||
644 | gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ | ||
645 | gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ | ||
646 | |||
647 | /* set SPU2 clock to 119.6 MHz */ | ||
648 | clk = clk_get(NULL, "spu_clk"); | ||
649 | if (!IS_ERR_VALUE(clk)) { | ||
650 | clk_set_rate(clk, clk_round_rate(clk, 119600000)); | ||
651 | clk_put(clk); | ||
652 | } | ||
653 | |||
654 | /* change parent of FSI A */ | ||
655 | clk = clk_get(NULL, "fsia_clk"); | ||
656 | if (!IS_ERR_VALUE(clk)) { | ||
657 | clk_register(&fsiackcr_clk); | ||
658 | clk_set_parent(clk, &fsiackcr_clk); | ||
659 | clk_put(clk); | ||
660 | } | ||
661 | |||
662 | /* | ||
663 | * set irq priority, to avoid sound chopping | ||
664 | * when NFS rootfs is used | ||
665 | * FSI(3) > SMSC911X(2) | ||
666 | */ | ||
667 | intc_set_priority(IRQ_FSI, 3); | ||
668 | |||
669 | i2c_register_board_info(0, i2c0_devices, | ||
670 | ARRAY_SIZE(i2c0_devices)); | ||
671 | |||
672 | i2c_register_board_info(1, i2c1_devices, | ||
673 | ARRAY_SIZE(i2c1_devices)); | ||
674 | |||
546 | sh7372_add_standard_devices(); | 675 | sh7372_add_standard_devices(); |
547 | 676 | ||
548 | platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); | 677 | platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); |