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.c139
1 files changed, 1 insertions, 138 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 790dc68c4312..40657854e3ad 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -658,133 +658,16 @@ static struct platform_device lcdc_device = {
658 658
659/* FSI */ 659/* FSI */
660#define IRQ_FSI evt2irq(0x1840) 660#define IRQ_FSI evt2irq(0x1840)
661static int __fsi_set_rate(struct clk *clk, long rate, int enable)
662{
663 int ret = 0;
664
665 if (rate <= 0)
666 return ret;
667
668 if (enable) {
669 ret = clk_set_rate(clk, rate);
670 if (0 == ret)
671 ret = clk_enable(clk);
672 } else {
673 clk_disable(clk);
674 }
675
676 return ret;
677}
678
679static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
680{
681 return __fsi_set_rate(clk, clk_round_rate(clk, rate), enable);
682}
683
684static int fsi_ak4642_set_rate(struct device *dev, int rate, int enable)
685{
686 struct clk *fsia_ick;
687 struct clk *fsiack;
688 int ret = -EIO;
689
690 fsia_ick = clk_get(dev, "icka");
691 if (IS_ERR(fsia_ick))
692 return PTR_ERR(fsia_ick);
693
694 /*
695 * FSIACK is connected to AK4642,
696 * and use external clock pin from it.
697 * it is parent of fsia_ick now.
698 */
699 fsiack = clk_get_parent(fsia_ick);
700 if (!fsiack)
701 goto fsia_ick_out;
702
703 /*
704 * we get 1/1 divided clock by setting same rate to fsiack and fsia_ick
705 *
706 ** FIXME **
707 * Because the freq_table of external clk (fsiack) are all 0,
708 * the return value of clk_round_rate became 0.
709 * So, it use __fsi_set_rate here.
710 */
711 ret = __fsi_set_rate(fsiack, rate, enable);
712 if (ret < 0)
713 goto fsiack_out;
714
715 ret = __fsi_set_round_rate(fsia_ick, rate, enable);
716 if ((ret < 0) && enable)
717 __fsi_set_round_rate(fsiack, rate, 0); /* disable FSI ACK */
718
719fsiack_out:
720 clk_put(fsiack);
721
722fsia_ick_out:
723 clk_put(fsia_ick);
724
725 return 0;
726}
727
728static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
729{
730 struct clk *fsib_clk;
731 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
732 long fsib_rate = 0;
733 long fdiv_rate = 0;
734 int ackmd_bpfmd;
735 int ret;
736
737 switch (rate) {
738 case 44100:
739 fsib_rate = rate * 256;
740 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
741 break;
742 case 48000:
743 fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
744 fdiv_rate = rate * 256;
745 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
746 break;
747 default:
748 pr_err("unsupported rate in FSI2 port B\n");
749 return -EINVAL;
750 }
751
752 /* FSI B setting */
753 fsib_clk = clk_get(dev, "ickb");
754 if (IS_ERR(fsib_clk))
755 return -EIO;
756
757 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
758 if (ret < 0)
759 goto fsi_set_rate_end;
760
761 /* FSI DIV setting */
762 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
763 if (ret < 0) {
764 /* disable FSI B */
765 if (enable)
766 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
767 goto fsi_set_rate_end;
768 }
769
770 ret = ackmd_bpfmd;
771
772fsi_set_rate_end:
773 clk_put(fsib_clk);
774 return ret;
775}
776
777static struct sh_fsi_platform_info fsi_info = { 661static struct sh_fsi_platform_info fsi_info = {
778 .port_a = { 662 .port_a = {
779 .flags = SH_FSI_BRS_INV, 663 .flags = SH_FSI_BRS_INV,
780 .set_rate = fsi_ak4642_set_rate,
781 }, 664 },
782 .port_b = { 665 .port_b = {
783 .flags = SH_FSI_BRS_INV | 666 .flags = SH_FSI_BRS_INV |
784 SH_FSI_BRM_INV | 667 SH_FSI_BRM_INV |
785 SH_FSI_LRS_INV | 668 SH_FSI_LRS_INV |
669 SH_FSI_CLK_CPG |
786 SH_FSI_FMT_SPDIF, 670 SH_FSI_FMT_SPDIF,
787 .set_rate = fsi_hdmi_set_rate,
788 }, 671 },
789}; 672};
790 673
@@ -1144,25 +1027,6 @@ out:
1144 clk_put(hdmi_ick); 1027 clk_put(hdmi_ick);
1145} 1028}
1146 1029
1147static void __init fsi_init_pm_clock(void)
1148{
1149 struct clk *fsia_ick;
1150 int ret;
1151
1152 fsia_ick = clk_get(&fsi_device.dev, "icka");
1153 if (IS_ERR(fsia_ick)) {
1154 ret = PTR_ERR(fsia_ick);
1155 pr_err("Cannot get FSI ICK: %d\n", ret);
1156 return;
1157 }
1158
1159 ret = clk_set_parent(fsia_ick, &sh7372_fsiack_clk);
1160 if (ret < 0)
1161 pr_err("Cannot set FSI-A parent: %d\n", ret);
1162
1163 clk_put(fsia_ick);
1164}
1165
1166/* TouchScreen */ 1030/* TouchScreen */
1167#ifdef CONFIG_AP4EVB_QHD 1031#ifdef CONFIG_AP4EVB_QHD
1168# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123 1032# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
@@ -1476,7 +1340,6 @@ static void __init ap4evb_init(void)
1476 ARRAY_SIZE(domain_devices)); 1340 ARRAY_SIZE(domain_devices));
1477 1341
1478 hdmi_init_pm_clock(); 1342 hdmi_init_pm_clock();
1479 fsi_init_pm_clock();
1480 sh7372_pm_init(); 1343 sh7372_pm_init();
1481 pm_clk_add(&fsi_device.dev, "spu2"); 1344 pm_clk_add(&fsi_device.dev, "spu2");
1482 pm_clk_add(&lcdc1_device.dev, "hdmi"); 1345 pm_clk_add(&lcdc1_device.dev, "hdmi");