aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-ap4evb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/board-ap4evb.c')
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 46ca4d4abf91..d3260542b943 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -163,11 +163,13 @@ static struct mtd_partition nor_flash_partitions[] = {
163 .name = "loader", 163 .name = "loader",
164 .offset = 0x00000000, 164 .offset = 0x00000000,
165 .size = 512 * 1024, 165 .size = 512 * 1024,
166 .mask_flags = MTD_WRITEABLE,
166 }, 167 },
167 { 168 {
168 .name = "bootenv", 169 .name = "bootenv",
169 .offset = MTDPART_OFS_APPEND, 170 .offset = MTDPART_OFS_APPEND,
170 .size = 512 * 1024, 171 .size = 512 * 1024,
172 .mask_flags = MTD_WRITEABLE,
171 }, 173 },
172 { 174 {
173 .name = "kernel_ro", 175 .name = "kernel_ro",
@@ -565,12 +567,54 @@ static struct platform_device *qhd_devices[] __initdata = {
565 567
566/* FSI */ 568/* FSI */
567#define IRQ_FSI evt2irq(0x1840) 569#define IRQ_FSI evt2irq(0x1840)
570
571static int fsi_set_rate(int is_porta, int rate)
572{
573 struct clk *fsib_clk;
574 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
575 int ret;
576
577 /* set_rate is not needed if port A */
578 if (is_porta)
579 return 0;
580
581 fsib_clk = clk_get(NULL, "fsib_clk");
582 if (IS_ERR(fsib_clk))
583 return -EINVAL;
584
585 switch (rate) {
586 case 44100:
587 clk_set_rate(fsib_clk, clk_round_rate(fsib_clk, 11283000));
588 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
589 break;
590 case 48000:
591 clk_set_rate(fsib_clk, clk_round_rate(fsib_clk, 85428000));
592 clk_set_rate(fdiv_clk, clk_round_rate(fdiv_clk, 12204000));
593 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
594 break;
595 default:
596 pr_err("unsupported rate in FSI2 port B\n");
597 ret = -EINVAL;
598 break;
599 }
600
601 clk_put(fsib_clk);
602
603 return ret;
604}
605
568static struct sh_fsi_platform_info fsi_info = { 606static struct sh_fsi_platform_info fsi_info = {
569 .porta_flags = SH_FSI_BRS_INV | 607 .porta_flags = SH_FSI_BRS_INV |
570 SH_FSI_OUT_SLAVE_MODE | 608 SH_FSI_OUT_SLAVE_MODE |
571 SH_FSI_IN_SLAVE_MODE | 609 SH_FSI_IN_SLAVE_MODE |
572 SH_FSI_OFMT(PCM) | 610 SH_FSI_OFMT(PCM) |
573 SH_FSI_IFMT(PCM), 611 SH_FSI_IFMT(PCM),
612
613 .portb_flags = SH_FSI_BRS_INV |
614 SH_FSI_BRM_INV |
615 SH_FSI_LRS_INV |
616 SH_FSI_OFMT(SPDIF),
617 .set_rate = fsi_set_rate,
574}; 618};
575 619
576static struct resource fsi_resources[] = { 620static struct resource fsi_resources[] = {
@@ -634,6 +678,7 @@ static struct platform_device lcdc1_device = {
634static struct sh_mobile_hdmi_info hdmi_info = { 678static struct sh_mobile_hdmi_info hdmi_info = {
635 .lcd_chan = &sh_mobile_lcdc1_info.ch[0], 679 .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
636 .lcd_dev = &lcdc1_device.dev, 680 .lcd_dev = &lcdc1_device.dev,
681 .flags = HDMI_SND_SRC_SPDIF,
637}; 682};
638 683
639static struct resource hdmi_resources[] = { 684static struct resource hdmi_resources[] = {
@@ -992,6 +1037,7 @@ static void __init ap4evb_map_io(void)
992 1037
993#define GPIO_PORT9CR 0xE6051009 1038#define GPIO_PORT9CR 0xE6051009
994#define GPIO_PORT10CR 0xE605100A 1039#define GPIO_PORT10CR 0xE605100A
1040#define USCCR1 0xE6058144
995static void __init ap4evb_init(void) 1041static void __init ap4evb_init(void)
996{ 1042{
997 u32 srcr4; 1043 u32 srcr4;
@@ -1062,7 +1108,7 @@ static void __init ap4evb_init(void)
1062 /* setup USB phy */ 1108 /* setup USB phy */
1063 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ 1109 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */
1064 1110
1065 /* enable FSI2 */ 1111 /* enable FSI2 port A (ak4643) */
1066 gpio_request(GPIO_FN_FSIAIBT, NULL); 1112 gpio_request(GPIO_FN_FSIAIBT, NULL);
1067 gpio_request(GPIO_FN_FSIAILR, NULL); 1113 gpio_request(GPIO_FN_FSIAILR, NULL);
1068 gpio_request(GPIO_FN_FSIAISLD, NULL); 1114 gpio_request(GPIO_FN_FSIAISLD, NULL);
@@ -1079,6 +1125,10 @@ static void __init ap4evb_init(void)
1079 gpio_request(GPIO_PORT41, NULL); 1125 gpio_request(GPIO_PORT41, NULL);
1080 gpio_direction_input(GPIO_PORT41); 1126 gpio_direction_input(GPIO_PORT41);
1081 1127
1128 /* setup FSI2 port B (HDMI) */
1129 gpio_request(GPIO_FN_FSIBCK, NULL);
1130 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
1131
1082 /* set SPU2 clock to 119.6 MHz */ 1132 /* set SPU2 clock to 119.6 MHz */
1083 clk = clk_get(NULL, "spu_clk"); 1133 clk = clk_get(NULL, "spu_clk");
1084 if (!IS_ERR(clk)) { 1134 if (!IS_ERR(clk)) {