aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-mackerel.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/board-mackerel.c')
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c80
1 files changed, 8 insertions, 72 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index f274252e4705..3f56e70795b7 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -816,6 +816,8 @@ static struct platform_device usbhs1_device = {
816 .id = 1, 816 .id = 1,
817 .dev = { 817 .dev = {
818 .platform_data = &usbhs1_private.info, 818 .platform_data = &usbhs1_private.info,
819 .dma_mask = &usbhs1_device.dev.coherent_dma_mask,
820 .coherent_dma_mask = DMA_BIT_MASK(32),
819 }, 821 },
820 .num_resources = ARRAY_SIZE(usbhs1_resources), 822 .num_resources = ARRAY_SIZE(usbhs1_resources),
821 .resource = usbhs1_resources, 823 .resource = usbhs1_resources,
@@ -860,76 +862,6 @@ static struct platform_device leds_device = {
860 862
861/* FSI */ 863/* FSI */
862#define IRQ_FSI evt2irq(0x1840) 864#define IRQ_FSI evt2irq(0x1840)
863static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
864{
865 int ret;
866
867 if (rate <= 0)
868 return 0;
869
870 if (!enable) {
871 clk_disable(clk);
872 return 0;
873 }
874
875 ret = clk_set_rate(clk, clk_round_rate(clk, rate));
876 if (ret < 0)
877 return ret;
878
879 return clk_enable(clk);
880}
881
882static int fsi_b_set_rate(struct device *dev, int rate, int enable)
883{
884 struct clk *fsib_clk;
885 struct clk *fdiv_clk = clk_get(NULL, "fsidivb");
886 long fsib_rate = 0;
887 long fdiv_rate = 0;
888 int ackmd_bpfmd;
889 int ret;
890
891 /* clock start */
892 switch (rate) {
893 case 44100:
894 fsib_rate = rate * 256;
895 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
896 break;
897 case 48000:
898 fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
899 fdiv_rate = rate * 256;
900 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
901 break;
902 default:
903 pr_err("unsupported rate in FSI2 port B\n");
904 return -EINVAL;
905 }
906
907 /* FSI B setting */
908 fsib_clk = clk_get(dev, "ickb");
909 if (IS_ERR(fsib_clk))
910 return -EIO;
911
912 /* fsib */
913 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
914 if (ret < 0)
915 goto fsi_set_rate_end;
916
917 /* FSI DIV */
918 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
919 if (ret < 0) {
920 /* disable FSI B */
921 if (enable)
922 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
923 goto fsi_set_rate_end;
924 }
925
926 ret = ackmd_bpfmd;
927
928fsi_set_rate_end:
929 clk_put(fsib_clk);
930 return ret;
931}
932
933static struct sh_fsi_platform_info fsi_info = { 865static struct sh_fsi_platform_info fsi_info = {
934 .port_a = { 866 .port_a = {
935 .flags = SH_FSI_BRS_INV, 867 .flags = SH_FSI_BRS_INV,
@@ -940,8 +872,8 @@ static struct sh_fsi_platform_info fsi_info = {
940 .flags = SH_FSI_BRS_INV | 872 .flags = SH_FSI_BRS_INV |
941 SH_FSI_BRM_INV | 873 SH_FSI_BRM_INV |
942 SH_FSI_LRS_INV | 874 SH_FSI_LRS_INV |
875 SH_FSI_CLK_CPG |
943 SH_FSI_FMT_SPDIF, 876 SH_FSI_FMT_SPDIF,
944 .set_rate = fsi_b_set_rate,
945 } 877 }
946}; 878};
947 879
@@ -1018,7 +950,11 @@ static struct resource nand_flash_resources[] = {
1018 .start = 0xe6a30000, 950 .start = 0xe6a30000,
1019 .end = 0xe6a3009b, 951 .end = 0xe6a3009b,
1020 .flags = IORESOURCE_MEM, 952 .flags = IORESOURCE_MEM,
1021 } 953 },
954 [1] = {
955 .start = evt2irq(0x0d80), /* flstei: status error irq */
956 .flags = IORESOURCE_IRQ,
957 },
1022}; 958};
1023 959
1024static struct sh_flctl_platform_data nand_flash_data = { 960static struct sh_flctl_platform_data nand_flash_data = {