diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-13 14:00:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-13 14:00:00 -0500 |
commit | fe504c5c745aeb767d978fbedeb94775fd4cb69c (patch) | |
tree | 5ebb384972aabf676d8137d95362333193c89f66 /arch/arm/mach-shmobile | |
parent | 698d601224824bc1a5bf17f3d86be902e2aabff0 (diff) | |
parent | d7460f4a3d75469deb1c6c028961da69608d02d9 (diff) |
Merge tag 'boards2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC board updates, take 2 from Olof Johansson:
"This branch contains board updates for shmobile that had dependencies
on earlier branches past the first driver branch, and thus are merged
separately.
Most of these are to enable audio and USB on shmobile. They contain a
dependent ASoC branch that has been coordinated with Mark Brown."
* tag 'boards2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
ARM: shmobile: mackerel: Add FLCTL IRQ resource
ARM: shmobile: use FSI driver's audio clock on ap4evb
ARM: shmobile: use FSI driver's audio clock on mackerel
ARM: shmobile: use FSI driver's audio clock on armadillo800eva
ARM: shmobile: mackerel: enable DMAEngine on USB Host
ARM: shmobile: marzen: add USB OHCI driver support
ARM: shmobile: marzen: add USB EHCI driver support
ARM: shmobile: marzen: add USB phy support
ASoC: fsi: add master clock control functions
ASoC: fsi: care fsi_hw_start/stop() return value
ASoC: fsi: fsi_set_master_clk() was called from fsi_hw_xxx() only
ASoC: fsi: use devm_request_irq()
ASoC: fsi: fixup channels_min/max
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-ap4evb.c | 139 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-armadillo800eva.c | 38 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-marzen.c | 186 |
5 files changed, 199 insertions, 246 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 4eddca14ae07..9255546e7bf6 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -29,6 +29,8 @@ config ARCH_R8A7779 | |||
29 | select ARM_GIC | 29 | select ARM_GIC |
30 | select CPU_V7 | 30 | select CPU_V7 |
31 | select SH_CLK_CPG | 31 | select SH_CLK_CPG |
32 | select USB_ARCH_HAS_EHCI | ||
33 | select USB_ARCH_HAS_OHCI | ||
32 | 34 | ||
33 | config ARCH_EMEV2 | 35 | config ARCH_EMEV2 |
34 | bool "Emma Mobile EV2" | 36 | bool "Emma Mobile EV2" |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index cefdd030361d..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) |
661 | static 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 | |||
679 | static 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 | |||
684 | static 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 | |||
719 | fsiack_out: | ||
720 | clk_put(fsiack); | ||
721 | |||
722 | fsia_ick_out: | ||
723 | clk_put(fsia_ick); | ||
724 | |||
725 | return 0; | ||
726 | } | ||
727 | |||
728 | static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable) | ||
729 | { | ||
730 | struct clk *fsib_clk; | ||
731 | struct clk *fdiv_clk = clk_get(NULL, "fsidivb"); | ||
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 | |||
772 | fsi_set_rate_end: | ||
773 | clk_put(fsib_clk); | ||
774 | return ret; | ||
775 | } | ||
776 | |||
777 | static struct sh_fsi_platform_info fsi_info = { | 661 | static 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 | ||
1147 | static 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"); |
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 499e6e376666..5353adf6b828 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -768,32 +768,6 @@ static struct platform_device ceu0_device = { | |||
768 | }; | 768 | }; |
769 | 769 | ||
770 | /* FSI */ | 770 | /* FSI */ |
771 | static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable) | ||
772 | { | ||
773 | struct clk *fsib; | ||
774 | int ret; | ||
775 | |||
776 | /* it support 48KHz only */ | ||
777 | if (48000 != rate) | ||
778 | return -EINVAL; | ||
779 | |||
780 | fsib = clk_get(dev, "ickb"); | ||
781 | if (IS_ERR(fsib)) | ||
782 | return -EINVAL; | ||
783 | |||
784 | if (enable) { | ||
785 | ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64; | ||
786 | clk_enable(fsib); | ||
787 | } else { | ||
788 | ret = 0; | ||
789 | clk_disable(fsib); | ||
790 | } | ||
791 | |||
792 | clk_put(fsib); | ||
793 | |||
794 | return ret; | ||
795 | } | ||
796 | |||
797 | static struct sh_fsi_platform_info fsi_info = { | 771 | static struct sh_fsi_platform_info fsi_info = { |
798 | /* FSI-WM8978 */ | 772 | /* FSI-WM8978 */ |
799 | .port_a = { | 773 | .port_a = { |
@@ -802,8 +776,8 @@ static struct sh_fsi_platform_info fsi_info = { | |||
802 | /* FSI-HDMI */ | 776 | /* FSI-HDMI */ |
803 | .port_b = { | 777 | .port_b = { |
804 | .flags = SH_FSI_FMT_SPDIF | | 778 | .flags = SH_FSI_FMT_SPDIF | |
805 | SH_FSI_ENABLE_STREAM_MODE, | 779 | SH_FSI_ENABLE_STREAM_MODE | |
806 | .set_rate = fsi_hdmi_set_rate, | 780 | SH_FSI_CLK_CPG, |
807 | .tx_id = SHDMA_SLAVE_FSIB_TX, | 781 | .tx_id = SHDMA_SLAVE_FSIB_TX, |
808 | } | 782 | } |
809 | }; | 783 | }; |
@@ -938,13 +912,11 @@ static void __init eva_clock_init(void) | |||
938 | struct clk *xtal1 = clk_get(NULL, "extal1"); | 912 | struct clk *xtal1 = clk_get(NULL, "extal1"); |
939 | struct clk *usb24s = clk_get(NULL, "usb24s"); | 913 | struct clk *usb24s = clk_get(NULL, "usb24s"); |
940 | struct clk *fsibck = clk_get(NULL, "fsibck"); | 914 | struct clk *fsibck = clk_get(NULL, "fsibck"); |
941 | struct clk *fsib = clk_get(&fsi_device.dev, "ickb"); | ||
942 | 915 | ||
943 | if (IS_ERR(system) || | 916 | if (IS_ERR(system) || |
944 | IS_ERR(xtal1) || | 917 | IS_ERR(xtal1) || |
945 | IS_ERR(usb24s) || | 918 | IS_ERR(usb24s) || |
946 | IS_ERR(fsibck) || | 919 | IS_ERR(fsibck)) { |
947 | IS_ERR(fsib)) { | ||
948 | pr_err("armadillo800eva board clock init failed\n"); | 920 | pr_err("armadillo800eva board clock init failed\n"); |
949 | goto clock_error; | 921 | goto clock_error; |
950 | } | 922 | } |
@@ -956,9 +928,7 @@ static void __init eva_clock_init(void) | |||
956 | clk_set_parent(usb24s, system); | 928 | clk_set_parent(usb24s, system); |
957 | 929 | ||
958 | /* FSIBCK is 12.288MHz, and it is parent of FSI-B */ | 930 | /* FSIBCK is 12.288MHz, and it is parent of FSI-B */ |
959 | clk_set_parent(fsib, fsibck); | ||
960 | clk_set_rate(fsibck, 12288000); | 931 | clk_set_rate(fsibck, 12288000); |
961 | clk_set_rate(fsib, 12288000); | ||
962 | 932 | ||
963 | clock_error: | 933 | clock_error: |
964 | if (!IS_ERR(system)) | 934 | if (!IS_ERR(system)) |
@@ -969,8 +939,6 @@ clock_error: | |||
969 | clk_put(usb24s); | 939 | clk_put(usb24s); |
970 | if (!IS_ERR(fsibck)) | 940 | if (!IS_ERR(fsibck)) |
971 | clk_put(fsibck); | 941 | clk_put(fsibck); |
972 | if (!IS_ERR(fsib)) | ||
973 | clk_put(fsib); | ||
974 | } | 942 | } |
975 | 943 | ||
976 | /* | 944 | /* |
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) |
863 | static 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 | |||
882 | static 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 | |||
928 | fsi_set_rate_end: | ||
929 | clk_put(fsib_clk); | ||
930 | return ret; | ||
931 | } | ||
932 | |||
933 | static struct sh_fsi_platform_info fsi_info = { | 865 | static 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 | ||
1024 | static struct sh_flctl_platform_data nand_flash_data = { | 960 | static struct sh_flctl_platform_data nand_flash_data = { |
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index 69f7f464eff8..449f9289567d 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c | |||
@@ -34,6 +34,10 @@ | |||
34 | #include <linux/spi/sh_hspi.h> | 34 | #include <linux/spi/sh_hspi.h> |
35 | #include <linux/mmc/sh_mobile_sdhi.h> | 35 | #include <linux/mmc/sh_mobile_sdhi.h> |
36 | #include <linux/mfd/tmio.h> | 36 | #include <linux/mfd/tmio.h> |
37 | #include <linux/usb/otg.h> | ||
38 | #include <linux/usb/ehci_pdriver.h> | ||
39 | #include <linux/usb/ohci_pdriver.h> | ||
40 | #include <linux/pm_runtime.h> | ||
37 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
38 | #include <mach/r8a7779.h> | 42 | #include <mach/r8a7779.h> |
39 | #include <mach/common.h> | 43 | #include <mach/common.h> |
@@ -144,13 +148,185 @@ static struct platform_device hspi_device = { | |||
144 | .num_resources = ARRAY_SIZE(hspi_resources), | 148 | .num_resources = ARRAY_SIZE(hspi_resources), |
145 | }; | 149 | }; |
146 | 150 | ||
151 | /* USB PHY */ | ||
152 | static struct resource usb_phy_resources[] = { | ||
153 | [0] = { | ||
154 | .start = 0xffe70000, | ||
155 | .end = 0xffe70900 - 1, | ||
156 | .flags = IORESOURCE_MEM, | ||
157 | }, | ||
158 | [1] = { | ||
159 | .start = 0xfff70000, | ||
160 | .end = 0xfff70900 - 1, | ||
161 | .flags = IORESOURCE_MEM, | ||
162 | }, | ||
163 | }; | ||
164 | |||
165 | static struct platform_device usb_phy_device = { | ||
166 | .name = "rcar_usb_phy", | ||
167 | .resource = usb_phy_resources, | ||
168 | .num_resources = ARRAY_SIZE(usb_phy_resources), | ||
169 | }; | ||
170 | |||
147 | static struct platform_device *marzen_devices[] __initdata = { | 171 | static struct platform_device *marzen_devices[] __initdata = { |
148 | ð_device, | 172 | ð_device, |
149 | &sdhi0_device, | 173 | &sdhi0_device, |
150 | &thermal_device, | 174 | &thermal_device, |
151 | &hspi_device, | 175 | &hspi_device, |
176 | &usb_phy_device, | ||
177 | }; | ||
178 | |||
179 | /* USB */ | ||
180 | static struct usb_phy *phy; | ||
181 | static int usb_power_on(struct platform_device *pdev) | ||
182 | { | ||
183 | if (!phy) | ||
184 | return -EIO; | ||
185 | |||
186 | pm_runtime_enable(&pdev->dev); | ||
187 | pm_runtime_get_sync(&pdev->dev); | ||
188 | |||
189 | usb_phy_init(phy); | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static void usb_power_off(struct platform_device *pdev) | ||
195 | { | ||
196 | if (!phy) | ||
197 | return; | ||
198 | |||
199 | usb_phy_shutdown(phy); | ||
200 | |||
201 | pm_runtime_put_sync(&pdev->dev); | ||
202 | pm_runtime_disable(&pdev->dev); | ||
203 | } | ||
204 | |||
205 | static struct usb_ehci_pdata ehcix_pdata = { | ||
206 | .power_on = usb_power_on, | ||
207 | .power_off = usb_power_off, | ||
208 | .power_suspend = usb_power_off, | ||
209 | }; | ||
210 | |||
211 | static struct resource ehci0_resources[] = { | ||
212 | [0] = { | ||
213 | .start = 0xffe70000, | ||
214 | .end = 0xffe70400 - 1, | ||
215 | .flags = IORESOURCE_MEM, | ||
216 | }, | ||
217 | [1] = { | ||
218 | .start = gic_spi(44), | ||
219 | .flags = IORESOURCE_IRQ, | ||
220 | }, | ||
221 | }; | ||
222 | |||
223 | static struct platform_device ehci0_device = { | ||
224 | .name = "ehci-platform", | ||
225 | .id = 0, | ||
226 | .dev = { | ||
227 | .dma_mask = &ehci0_device.dev.coherent_dma_mask, | ||
228 | .coherent_dma_mask = 0xffffffff, | ||
229 | .platform_data = &ehcix_pdata, | ||
230 | }, | ||
231 | .num_resources = ARRAY_SIZE(ehci0_resources), | ||
232 | .resource = ehci0_resources, | ||
152 | }; | 233 | }; |
153 | 234 | ||
235 | static struct resource ehci1_resources[] = { | ||
236 | [0] = { | ||
237 | .start = 0xfff70000, | ||
238 | .end = 0xfff70400 - 1, | ||
239 | .flags = IORESOURCE_MEM, | ||
240 | }, | ||
241 | [1] = { | ||
242 | .start = gic_spi(45), | ||
243 | .flags = IORESOURCE_IRQ, | ||
244 | }, | ||
245 | }; | ||
246 | |||
247 | static struct platform_device ehci1_device = { | ||
248 | .name = "ehci-platform", | ||
249 | .id = 1, | ||
250 | .dev = { | ||
251 | .dma_mask = &ehci1_device.dev.coherent_dma_mask, | ||
252 | .coherent_dma_mask = 0xffffffff, | ||
253 | .platform_data = &ehcix_pdata, | ||
254 | }, | ||
255 | .num_resources = ARRAY_SIZE(ehci1_resources), | ||
256 | .resource = ehci1_resources, | ||
257 | }; | ||
258 | |||
259 | static struct usb_ohci_pdata ohcix_pdata = { | ||
260 | .power_on = usb_power_on, | ||
261 | .power_off = usb_power_off, | ||
262 | .power_suspend = usb_power_off, | ||
263 | }; | ||
264 | |||
265 | static struct resource ohci0_resources[] = { | ||
266 | [0] = { | ||
267 | .start = 0xffe70400, | ||
268 | .end = 0xffe70800 - 1, | ||
269 | .flags = IORESOURCE_MEM, | ||
270 | }, | ||
271 | [1] = { | ||
272 | .start = gic_spi(44), | ||
273 | .flags = IORESOURCE_IRQ, | ||
274 | }, | ||
275 | }; | ||
276 | |||
277 | static struct platform_device ohci0_device = { | ||
278 | .name = "ohci-platform", | ||
279 | .id = 0, | ||
280 | .dev = { | ||
281 | .dma_mask = &ohci0_device.dev.coherent_dma_mask, | ||
282 | .coherent_dma_mask = 0xffffffff, | ||
283 | .platform_data = &ohcix_pdata, | ||
284 | }, | ||
285 | .num_resources = ARRAY_SIZE(ohci0_resources), | ||
286 | .resource = ohci0_resources, | ||
287 | }; | ||
288 | |||
289 | static struct resource ohci1_resources[] = { | ||
290 | [0] = { | ||
291 | .start = 0xfff70400, | ||
292 | .end = 0xfff70800 - 1, | ||
293 | .flags = IORESOURCE_MEM, | ||
294 | }, | ||
295 | [1] = { | ||
296 | .start = gic_spi(45), | ||
297 | .flags = IORESOURCE_IRQ, | ||
298 | }, | ||
299 | }; | ||
300 | |||
301 | static struct platform_device ohci1_device = { | ||
302 | .name = "ohci-platform", | ||
303 | .id = 1, | ||
304 | .dev = { | ||
305 | .dma_mask = &ohci1_device.dev.coherent_dma_mask, | ||
306 | .coherent_dma_mask = 0xffffffff, | ||
307 | .platform_data = &ohcix_pdata, | ||
308 | }, | ||
309 | .num_resources = ARRAY_SIZE(ohci1_resources), | ||
310 | .resource = ohci1_resources, | ||
311 | }; | ||
312 | |||
313 | static struct platform_device *marzen_late_devices[] __initdata = { | ||
314 | &ehci0_device, | ||
315 | &ehci1_device, | ||
316 | &ohci0_device, | ||
317 | &ohci1_device, | ||
318 | }; | ||
319 | |||
320 | void __init marzen_init_late(void) | ||
321 | { | ||
322 | /* get usb phy */ | ||
323 | phy = usb_get_phy(USB_PHY_TYPE_USB2); | ||
324 | |||
325 | shmobile_init_late(); | ||
326 | platform_add_devices(marzen_late_devices, | ||
327 | ARRAY_SIZE(marzen_late_devices)); | ||
328 | } | ||
329 | |||
154 | static void __init marzen_init(void) | 330 | static void __init marzen_init(void) |
155 | { | 331 | { |
156 | regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, | 332 | regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, |
@@ -188,6 +364,14 @@ static void __init marzen_init(void) | |||
188 | gpio_request(GPIO_FN_HSPI_TX0, NULL); | 364 | gpio_request(GPIO_FN_HSPI_TX0, NULL); |
189 | gpio_request(GPIO_FN_HSPI_RX0, NULL); | 365 | gpio_request(GPIO_FN_HSPI_RX0, NULL); |
190 | 366 | ||
367 | /* USB (CN21) */ | ||
368 | gpio_request(GPIO_FN_USB_OVC0, NULL); | ||
369 | gpio_request(GPIO_FN_USB_OVC1, NULL); | ||
370 | gpio_request(GPIO_FN_USB_OVC2, NULL); | ||
371 | |||
372 | /* USB (CN22) */ | ||
373 | gpio_request(GPIO_FN_USB_PENC2, NULL); | ||
374 | |||
191 | r8a7779_add_standard_devices(); | 375 | r8a7779_add_standard_devices(); |
192 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); | 376 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); |
193 | } | 377 | } |
@@ -200,6 +384,6 @@ MACHINE_START(MARZEN, "marzen") | |||
200 | .init_irq = r8a7779_init_irq, | 384 | .init_irq = r8a7779_init_irq, |
201 | .handle_irq = gic_handle_irq, | 385 | .handle_irq = gic_handle_irq, |
202 | .init_machine = marzen_init, | 386 | .init_machine = marzen_init, |
203 | .init_late = shmobile_init_late, | 387 | .init_late = marzen_init_late, |
204 | .timer = &shmobile_timer, | 388 | .timer = &shmobile_timer, |
205 | MACHINE_END | 389 | MACHINE_END |