diff options
author | Olof Johansson <olof@lixom.net> | 2013-10-07 14:35:54 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-10-07 14:35:54 -0400 |
commit | 586eeb01e723c80ea53a2897123642e68304d70c (patch) | |
tree | 58921e074fc6063262069bbf5c8c217c00f8e97f | |
parent | 4a10c2ac2f368583138b774ca41fac4207911983 (diff) | |
parent | b77c6bcef2082a7cd96124daf15df8da5b670ebe (diff) |
Merge tag 'renesas-boards-for-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/boards
From Simon Horman:
Renesas ARM based SoC board updates for v3.13
* Display Unit support for lager and marzen boards
* Update regulators for MMC0, SDHI0 and SDHI1 on ape6evm board
* Enable use of FPGA on bockw board
* Add sounds support to bockw board
* Add USB function support to bockw board
* Add Koelsch board
* Disable MMCIF command completion signal on ape6evm, armadillo800eva,
kzm9g and lager boards.
* tag 'renesas-boards-for-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
ARM: shmobile: lager: disable MMCIF Command Completion Signal, add CLK_CTRL2
ARM: shmobile: kzm9g: disable MMCIF Command Completion Signal
ARM: shmobile: armadillo800eva: disable MMCIF Command Completion Signal
ARM: shmobile: ape6evm: disable MMCIF Command Completion Signal
ARM: shmobile: bockw: add USB Function support
ARM: shmobile: Koelsch support
ARM: shmobile: bockw: add R-Car sound support (PIO)
ARM: shmobile: bockw: enable global use of FPGA
ARM: shmobile: lager: Fix Display Unit platform data
ARM: shmobile: ape6evm: update MMC0, SDHI0 and SDHI1 with correct regulators
ARM: shmobile: lager: Add Display Unit support
ARM: shmobile: marzen: Add Display Unit support
ARM: shmobile: r8a7778: add usb phy power control function
ARM: shmobile: r8a7778: add USBHS clock
ARM: shmobile: r8a7791 CMT support
ARM: shmobile: r8a7791 SCIF support
ARM: shmobile: Initial r8a7791 SoC support
ARM: shmobile: r8a7778: add SSI/SRU clock support
ARM: shmobile: r8a7790: Add DU and LVDS clocks
ARM: shmobile: r8a7779: Rename DU device in clock lookups list
Signed-off-by: Olof Johansson <olof@lixom.net>
21 files changed, 1159 insertions, 34 deletions
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index e95af3f5433b..fd4651038a19 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -203,6 +203,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ | |||
203 | r8a7740-armadillo800eva-reference.dtb \ | 203 | r8a7740-armadillo800eva-reference.dtb \ |
204 | r8a7779-marzen.dtb \ | 204 | r8a7779-marzen.dtb \ |
205 | r8a7779-marzen-reference.dtb \ | 205 | r8a7779-marzen-reference.dtb \ |
206 | r8a7791-koelsch.dtb \ | ||
206 | r8a7790-lager.dtb \ | 207 | r8a7790-lager.dtb \ |
207 | r8a7790-lager-reference.dtb \ | 208 | r8a7790-lager-reference.dtb \ |
208 | sh73a0-kzm9g.dtb \ | 209 | sh73a0-kzm9g.dtb \ |
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts new file mode 100644 index 000000000000..1ce5250ec278 --- /dev/null +++ b/arch/arm/boot/dts/r8a7791-koelsch.dts | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Device Tree Source for the Koelsch board | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Electronics Corporation | ||
5 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public License | ||
8 | * version 2. This program is licensed "as is" without any warranty of any | ||
9 | * kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | /dts-v1/; | ||
13 | /include/ "r8a7791.dtsi" | ||
14 | |||
15 | / { | ||
16 | model = "Koelsch"; | ||
17 | compatible = "renesas,koelsch", "renesas,r8a7791"; | ||
18 | |||
19 | chosen { | ||
20 | bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; | ||
21 | }; | ||
22 | |||
23 | memory@40000000 { | ||
24 | device_type = "memory"; | ||
25 | reg = <0 0x40000000 0 0x80000000>; | ||
26 | }; | ||
27 | |||
28 | lbsc { | ||
29 | #address-cells = <1>; | ||
30 | #size-cells = <1>; | ||
31 | }; | ||
32 | }; | ||
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi new file mode 100644 index 000000000000..bbed43bd9be9 --- /dev/null +++ b/arch/arm/boot/dts/r8a7791.dtsi | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Device Tree Source for the r8a7791 SoC | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Electronics Corporation | ||
5 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public License | ||
8 | * version 2. This program is licensed "as is" without any warranty of any | ||
9 | * kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | / { | ||
13 | compatible = "renesas,r8a7791"; | ||
14 | interrupt-parent = <&gic>; | ||
15 | #address-cells = <2>; | ||
16 | #size-cells = <2>; | ||
17 | |||
18 | cpus { | ||
19 | #address-cells = <1>; | ||
20 | #size-cells = <0>; | ||
21 | |||
22 | cpu0: cpu@0 { | ||
23 | device_type = "cpu"; | ||
24 | compatible = "arm,cortex-a15"; | ||
25 | reg = <0>; | ||
26 | clock-frequency = <1300000000>; | ||
27 | }; | ||
28 | }; | ||
29 | |||
30 | gic: interrupt-controller@f1001000 { | ||
31 | compatible = "arm,cortex-a15-gic"; | ||
32 | #interrupt-cells = <3>; | ||
33 | #address-cells = <0>; | ||
34 | interrupt-controller; | ||
35 | reg = <0 0xf1001000 0 0x1000>, | ||
36 | <0 0xf1002000 0 0x1000>, | ||
37 | <0 0xf1004000 0 0x2000>, | ||
38 | <0 0xf1006000 0 0x2000>; | ||
39 | interrupts = <1 9 0xf04>; | ||
40 | }; | ||
41 | }; | ||
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 1f94c310c477..eda285794961 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -101,6 +101,12 @@ config ARCH_R8A7790 | |||
101 | select SH_CLK_CPG | 101 | select SH_CLK_CPG |
102 | select RENESAS_IRQC | 102 | select RENESAS_IRQC |
103 | 103 | ||
104 | config ARCH_R8A7791 | ||
105 | bool "R-Car M2 (R8A77910)" | ||
106 | select ARM_GIC | ||
107 | select CPU_V7 | ||
108 | select SH_CLK_CPG | ||
109 | |||
104 | config ARCH_EMEV2 | 110 | config ARCH_EMEV2 |
105 | bool "Emma Mobile EV2" | 111 | bool "Emma Mobile EV2" |
106 | select ARCH_WANT_OPTIONAL_GPIOLIB | 112 | select ARCH_WANT_OPTIONAL_GPIOLIB |
@@ -162,6 +168,8 @@ config MACH_BOCKW | |||
162 | select RENESAS_INTC_IRQPIN | 168 | select RENESAS_INTC_IRQPIN |
163 | select REGULATOR_FIXED_VOLTAGE if REGULATOR | 169 | select REGULATOR_FIXED_VOLTAGE if REGULATOR |
164 | select USE_OF | 170 | select USE_OF |
171 | select SND_SOC_AK4554 if SND_SIMPLE_CARD | ||
172 | select SND_SOC_AK4642 if SND_SIMPLE_CARD | ||
165 | 173 | ||
166 | config MACH_BOCKW_REFERENCE | 174 | config MACH_BOCKW_REFERENCE |
167 | bool "BOCK-W - Reference Device Tree Implementation" | 175 | bool "BOCK-W - Reference Device Tree Implementation" |
@@ -213,6 +221,11 @@ config MACH_LAGER_REFERENCE | |||
213 | 221 | ||
214 | This is intended to aid developers | 222 | This is intended to aid developers |
215 | 223 | ||
224 | config MACH_KOELSCH | ||
225 | bool "Koelsch board" | ||
226 | depends on ARCH_R8A7791 | ||
227 | select USE_OF | ||
228 | |||
216 | config MACH_KZM9D | 229 | config MACH_KZM9D |
217 | bool "KZM9D board" | 230 | bool "KZM9D board" |
218 | depends on ARCH_EMEV2 | 231 | depends on ARCH_EMEV2 |
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index 2705bfa8c113..e552e84b1fae 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o | |||
15 | obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o | 15 | obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o |
16 | obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o | 16 | obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o |
17 | obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o | 17 | obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o |
18 | obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o | ||
18 | obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o | 19 | obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o |
19 | 20 | ||
20 | # Clock objects | 21 | # Clock objects |
@@ -27,6 +28,7 @@ obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o | |||
27 | obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o | 28 | obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o |
28 | obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o | 29 | obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o |
29 | obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o | 30 | obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o |
31 | obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o | ||
30 | obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o | 32 | obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o |
31 | endif | 33 | endif |
32 | 34 | ||
@@ -59,6 +61,7 @@ obj-$(CONFIG_MACH_LAGER) += board-lager.o | |||
59 | obj-$(CONFIG_MACH_LAGER_REFERENCE) += board-lager-reference.o | 61 | obj-$(CONFIG_MACH_LAGER_REFERENCE) += board-lager-reference.o |
60 | obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o | 62 | obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o |
61 | obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o | 63 | obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o |
64 | obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o | ||
62 | obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o | 65 | obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o |
63 | obj-$(CONFIG_MACH_KZM9D_REFERENCE) += board-kzm9d-reference.o | 66 | obj-$(CONFIG_MACH_KZM9D_REFERENCE) += board-kzm9d-reference.o |
64 | obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o | 67 | obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o |
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot index 6a504fe7d86c..60e29e6c1126 100644 --- a/arch/arm/mach-shmobile/Makefile.boot +++ b/arch/arm/mach-shmobile/Makefile.boot | |||
@@ -6,6 +6,7 @@ loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000 | |||
6 | loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000 | 6 | loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000 |
7 | loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 | 7 | loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 |
8 | loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 | 8 | loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 |
9 | loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000 | ||
9 | loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000 | 10 | loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000 |
10 | loadaddr-$(CONFIG_MACH_KZM9D_REFERENCE) += 0x40008000 | 11 | loadaddr-$(CONFIG_MACH_KZM9D_REFERENCE) += 0x40008000 |
11 | loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 | 12 | loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 |
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c index 24b87eea9da3..0365d2e2e730 100644 --- a/arch/arm/mach-shmobile/board-ape6evm.c +++ b/arch/arm/mach-shmobile/board-ape6evm.c | |||
@@ -113,22 +113,56 @@ static const struct smsc911x_platform_config lan9220_data __initconst = { | |||
113 | }; | 113 | }; |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * On APE6EVM power is supplied to MMCIF by a tps80032 regulator. For now we | 116 | * MMC0 power supplies: |
117 | * model a VDD supply to MMCIF, using a fixed 3.3V regulator. Also use the | 117 | * Both Vcc and VccQ to eMMC on APE6EVM are supplied by a tps80032 voltage |
118 | * static power supply for SDHI0 and SDHI1, whereas SDHI0's VccQ is also | 118 | * regulator. Until support for it is added to this file we simulate the |
119 | * supplied by the same tps80032 regulator and thus can also be adjusted | 119 | * Vcc supply by a fixed always-on regulator |
120 | * dynamically. | ||
121 | */ | 120 | */ |
122 | static struct regulator_consumer_supply fixed3v3_power_consumers[] = | 121 | static struct regulator_consumer_supply vcc_mmc0_consumers[] = |
123 | { | 122 | { |
124 | REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), | 123 | REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), |
124 | }; | ||
125 | |||
126 | /* | ||
127 | * SDHI0 power supplies: | ||
128 | * Vcc to SDHI0 on APE6EVM is supplied by a GPIO-switchable regulator. VccQ is | ||
129 | * provided by the same tps80032 regulator as both MMC0 voltages - see comment | ||
130 | * above | ||
131 | */ | ||
132 | static struct regulator_consumer_supply vcc_sdhi0_consumers[] = | ||
133 | { | ||
125 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), | 134 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), |
135 | }; | ||
136 | |||
137 | static struct regulator_init_data vcc_sdhi0_init_data = { | ||
138 | .constraints = { | ||
139 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
140 | }, | ||
141 | .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers), | ||
142 | .consumer_supplies = vcc_sdhi0_consumers, | ||
143 | }; | ||
144 | |||
145 | static const struct fixed_voltage_config vcc_sdhi0_info __initconst = { | ||
146 | .supply_name = "SDHI0 Vcc", | ||
147 | .microvolts = 3300000, | ||
148 | .gpio = 76, | ||
149 | .enable_high = 1, | ||
150 | .init_data = &vcc_sdhi0_init_data, | ||
151 | }; | ||
152 | |||
153 | /* | ||
154 | * SDHI1 power supplies: | ||
155 | * Vcc and VccQ to SDHI1 on APE6EVM are both fixed at 3.3V | ||
156 | */ | ||
157 | static struct regulator_consumer_supply vcc_sdhi1_consumers[] = | ||
158 | { | ||
126 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), | 159 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), |
127 | }; | 160 | }; |
128 | 161 | ||
129 | /* MMCIF */ | 162 | /* MMCIF */ |
130 | static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = { | 163 | static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = { |
131 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | 164 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
165 | .ccs_unsupported = true, | ||
132 | }; | 166 | }; |
133 | 167 | ||
134 | static const struct resource mmcif0_resources[] __initconst = { | 168 | static const struct resource mmcif0_resources[] __initconst = { |
@@ -215,14 +249,19 @@ static void __init ape6evm_add_standard_devices(void) | |||
215 | platform_device_register_resndata(&platform_bus, "smsc911x", -1, | 249 | platform_device_register_resndata(&platform_bus, "smsc911x", -1, |
216 | lan9220_res, ARRAY_SIZE(lan9220_res), | 250 | lan9220_res, ARRAY_SIZE(lan9220_res), |
217 | &lan9220_data, sizeof(lan9220_data)); | 251 | &lan9220_data, sizeof(lan9220_data)); |
218 | regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers, | 252 | |
219 | ARRAY_SIZE(fixed3v3_power_consumers), 3300000); | 253 | regulator_register_always_on(1, "MMC0 Vcc", vcc_mmc0_consumers, |
254 | ARRAY_SIZE(vcc_mmc0_consumers), 2800000); | ||
220 | platform_device_register_resndata(&platform_bus, "sh_mmcif", 0, | 255 | platform_device_register_resndata(&platform_bus, "sh_mmcif", 0, |
221 | mmcif0_resources, ARRAY_SIZE(mmcif0_resources), | 256 | mmcif0_resources, ARRAY_SIZE(mmcif0_resources), |
222 | &mmcif0_pdata, sizeof(mmcif0_pdata)); | 257 | &mmcif0_pdata, sizeof(mmcif0_pdata)); |
258 | platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2, | ||
259 | &vcc_sdhi0_info, sizeof(vcc_sdhi0_info)); | ||
223 | platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0, | 260 | platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0, |
224 | sdhi0_resources, ARRAY_SIZE(sdhi0_resources), | 261 | sdhi0_resources, ARRAY_SIZE(sdhi0_resources), |
225 | &sdhi0_pdata, sizeof(sdhi0_pdata)); | 262 | &sdhi0_pdata, sizeof(sdhi0_pdata)); |
263 | regulator_register_always_on(3, "SDHI1 Vcc", vcc_sdhi1_consumers, | ||
264 | ARRAY_SIZE(vcc_sdhi1_consumers), 3300000); | ||
226 | platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, | 265 | platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, |
227 | sdhi1_resources, ARRAY_SIZE(sdhi1_resources), | 266 | sdhi1_resources, ARRAY_SIZE(sdhi1_resources), |
228 | &sdhi1_pdata, sizeof(sdhi1_pdata)); | 267 | &sdhi1_pdata, sizeof(sdhi1_pdata)); |
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 5bd1479d3deb..fc8f9f85d86d 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -823,6 +823,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = { | |||
823 | .caps = MMC_CAP_4_BIT_DATA | | 823 | .caps = MMC_CAP_4_BIT_DATA | |
824 | MMC_CAP_8_BIT_DATA | | 824 | MMC_CAP_8_BIT_DATA | |
825 | MMC_CAP_NONREMOVABLE, | 825 | MMC_CAP_NONREMOVABLE, |
826 | .ccs_unsupported = true, | ||
826 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, | 827 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, |
827 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | 828 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, |
828 | }; | 829 | }; |
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c index 6b9faf3908f7..330e84c14f8e 100644 --- a/arch/arm/mach-shmobile/board-bockw.c +++ b/arch/arm/mach-shmobile/board-bockw.c | |||
@@ -32,11 +32,19 @@ | |||
32 | #include <linux/smsc911x.h> | 32 | #include <linux/smsc911x.h> |
33 | #include <linux/spi/spi.h> | 33 | #include <linux/spi/spi.h> |
34 | #include <linux/spi/flash.h> | 34 | #include <linux/spi/flash.h> |
35 | #include <linux/usb/renesas_usbhs.h> | ||
35 | #include <media/soc_camera.h> | 36 | #include <media/soc_camera.h> |
36 | #include <mach/common.h> | 37 | #include <mach/common.h> |
37 | #include <mach/irqs.h> | 38 | #include <mach/irqs.h> |
38 | #include <mach/r8a7778.h> | 39 | #include <mach/r8a7778.h> |
39 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
41 | #include <sound/rcar_snd.h> | ||
42 | #include <sound/simple_card.h> | ||
43 | |||
44 | #define FPGA 0x18200000 | ||
45 | #define IRQ0MR 0x30 | ||
46 | #define COMCTLR 0x101c | ||
47 | static void __iomem *fpga; | ||
40 | 48 | ||
41 | /* | 49 | /* |
42 | * CN9(Upper side) SCIF/RCAN selection | 50 | * CN9(Upper side) SCIF/RCAN selection |
@@ -63,6 +71,45 @@ | |||
63 | * SW19 (MMC) 1 pin | 71 | * SW19 (MMC) 1 pin |
64 | */ | 72 | */ |
65 | 73 | ||
74 | /* | ||
75 | * SSI settings | ||
76 | * | ||
77 | * SW45: 1-4 side (SSI5 out, ROUT/LOUT CN19 Mid) | ||
78 | * SW46: 1101 (SSI6 Recorde) | ||
79 | * SW47: 1110 (SSI5 Playback) | ||
80 | * SW48: 11 (Recorde power) | ||
81 | * SW49: 1 (SSI slave mode) | ||
82 | * SW50: 1111 (SSI7, SSI8) | ||
83 | * SW51: 1111 (SSI3, SSI4) | ||
84 | * SW54: 1pin (ak4554 FPGA control) | ||
85 | * SW55: 1 (CLKB is 24.5760MHz) | ||
86 | * SW60: 1pin (ak4554 FPGA control) | ||
87 | * SW61: 3pin (use X11 clock) | ||
88 | * SW78: 3-6 (ak4642 connects I2C0) | ||
89 | * | ||
90 | * You can use sound as | ||
91 | * | ||
92 | * hw0: CN19: SSI56-AK4643 | ||
93 | * hw1: CN21: SSI3-AK4554(playback) | ||
94 | * hw2: CN21: SSI4-AK4554(capture) | ||
95 | * hw3: CN20: SSI7-AK4554(playback) | ||
96 | * hw4: CN20: SSI8-AK4554(capture) | ||
97 | * | ||
98 | * this command is required when playback on hw0. | ||
99 | * | ||
100 | * # amixer set "LINEOUT Mixer DACL" on | ||
101 | */ | ||
102 | |||
103 | /* | ||
104 | * USB | ||
105 | * | ||
106 | * USB1 (CN29) can be Host/Function | ||
107 | * | ||
108 | * Host Func | ||
109 | * SW98 1 2 | ||
110 | * SW99 1 3 | ||
111 | */ | ||
112 | |||
66 | /* Dummy supplies, where voltage doesn't matter */ | 113 | /* Dummy supplies, where voltage doesn't matter */ |
67 | static struct regulator_consumer_supply dummy_supplies[] = { | 114 | static struct regulator_consumer_supply dummy_supplies[] = { |
68 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | 115 | REGULATOR_SUPPLY("vddvario", "smsc911x"), |
@@ -81,13 +128,71 @@ static struct resource smsc911x_resources[] __initdata = { | |||
81 | DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */ | 128 | DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */ |
82 | }; | 129 | }; |
83 | 130 | ||
131 | #if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC) | ||
132 | /* | ||
133 | * When USB1 is Func | ||
134 | */ | ||
135 | static int usbhsf_get_id(struct platform_device *pdev) | ||
136 | { | ||
137 | return USBHS_GADGET; | ||
138 | } | ||
139 | |||
140 | #define SUSPMODE 0x102 | ||
141 | static int usbhsf_power_ctrl(struct platform_device *pdev, | ||
142 | void __iomem *base, int enable) | ||
143 | { | ||
144 | enable = !!enable; | ||
145 | |||
146 | r8a7778_usb_phy_power(enable); | ||
147 | |||
148 | iowrite16(enable << 14, base + SUSPMODE); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static struct resource usbhsf_resources[] __initdata = { | ||
154 | DEFINE_RES_MEM(0xffe60000, 0x110), | ||
155 | DEFINE_RES_IRQ(gic_iid(0x4f)), | ||
156 | }; | ||
157 | |||
158 | static struct renesas_usbhs_platform_info usbhs_info __initdata = { | ||
159 | .platform_callback = { | ||
160 | .get_id = usbhsf_get_id, | ||
161 | .power_ctrl = usbhsf_power_ctrl, | ||
162 | }, | ||
163 | .driver_param = { | ||
164 | .buswait_bwait = 4, | ||
165 | }, | ||
166 | }; | ||
167 | |||
168 | #define USB_PHY_SETTING {.port1_func = 1, .ovc_pin[1].active_high = 1,} | ||
169 | #define USB1_DEVICE "renesas_usbhs" | ||
170 | #define ADD_USB_FUNC_DEVICE_IF_POSSIBLE() \ | ||
171 | platform_device_register_resndata( \ | ||
172 | &platform_bus, "renesas_usbhs", -1, \ | ||
173 | usbhsf_resources, \ | ||
174 | ARRAY_SIZE(usbhsf_resources), \ | ||
175 | &usbhs_info, sizeof(struct renesas_usbhs_platform_info)) | ||
176 | |||
177 | #else | ||
178 | /* | ||
179 | * When USB1 is Host | ||
180 | */ | ||
181 | #define USB_PHY_SETTING { } | ||
182 | #define USB1_DEVICE "ehci-platform" | ||
183 | #define ADD_USB_FUNC_DEVICE_IF_POSSIBLE() | ||
184 | |||
185 | #endif | ||
186 | |||
84 | /* USB */ | 187 | /* USB */ |
85 | static struct resource usb_phy_resources[] __initdata = { | 188 | static struct resource usb_phy_resources[] __initdata = { |
86 | DEFINE_RES_MEM(0xffe70800, 0x100), | 189 | DEFINE_RES_MEM(0xffe70800, 0x100), |
87 | DEFINE_RES_MEM(0xffe76000, 0x100), | 190 | DEFINE_RES_MEM(0xffe76000, 0x100), |
88 | }; | 191 | }; |
89 | 192 | ||
90 | static struct rcar_phy_platform_data usb_phy_platform_data __initdata; | 193 | static struct rcar_phy_platform_data usb_phy_platform_data __initdata = |
194 | USB_PHY_SETTING; | ||
195 | |||
91 | 196 | ||
92 | /* SDHI */ | 197 | /* SDHI */ |
93 | static struct sh_mobile_sdhi_info sdhi0_info __initdata = { | 198 | static struct sh_mobile_sdhi_info sdhi0_info __initdata = { |
@@ -118,7 +223,9 @@ static struct sh_eth_plat_data ether_platform_data __initdata = { | |||
118 | static struct i2c_board_info i2c0_devices[] = { | 223 | static struct i2c_board_info i2c0_devices[] = { |
119 | { | 224 | { |
120 | I2C_BOARD_INFO("rx8581", 0x51), | 225 | I2C_BOARD_INFO("rx8581", 0x51), |
121 | }, | 226 | }, { |
227 | I2C_BOARD_INFO("ak4643", 0x12), | ||
228 | } | ||
122 | }; | 229 | }; |
123 | 230 | ||
124 | /* HSPI*/ | 231 | /* HSPI*/ |
@@ -181,7 +288,213 @@ static struct soc_camera_link iclink##idx##_ml86v7667 __initdata = { \ | |||
181 | BOCKW_CAMERA(0); | 288 | BOCKW_CAMERA(0); |
182 | BOCKW_CAMERA(1); | 289 | BOCKW_CAMERA(1); |
183 | 290 | ||
291 | /* Sound */ | ||
292 | static struct resource rsnd_resources[] __initdata = { | ||
293 | [RSND_GEN1_SRU] = DEFINE_RES_MEM(0xffd90000, 0x1000), | ||
294 | [RSND_GEN1_SSI] = DEFINE_RES_MEM(0xffd91000, 0x1240), | ||
295 | [RSND_GEN1_ADG] = DEFINE_RES_MEM(0xfffe0000, 0x24), | ||
296 | }; | ||
297 | |||
298 | static struct rsnd_ssi_platform_info rsnd_ssi[] = { | ||
299 | RSND_SSI_UNUSED, /* SSI 0 */ | ||
300 | RSND_SSI_UNUSED, /* SSI 1 */ | ||
301 | RSND_SSI_UNUSED, /* SSI 2 */ | ||
302 | RSND_SSI_SET(1, 0, gic_iid(0x85), RSND_SSI_PLAY), | ||
303 | RSND_SSI_SET(2, 0, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE | RSND_SSI_CLK_FROM_ADG), | ||
304 | RSND_SSI_SET(0, 0, gic_iid(0x86), RSND_SSI_PLAY), | ||
305 | RSND_SSI_SET(0, 0, gic_iid(0x86), 0), | ||
306 | RSND_SSI_SET(3, 0, gic_iid(0x86), RSND_SSI_PLAY), | ||
307 | RSND_SSI_SET(4, 0, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE | RSND_SSI_CLK_FROM_ADG), | ||
308 | }; | ||
309 | |||
310 | static struct rsnd_scu_platform_info rsnd_scu[9] = { | ||
311 | /* no member at this point */ | ||
312 | }; | ||
313 | |||
314 | enum { | ||
315 | AK4554_34 = 0, | ||
316 | AK4643_56, | ||
317 | AK4554_78, | ||
318 | SOUND_MAX, | ||
319 | }; | ||
320 | |||
321 | static int rsnd_codec_power(int id, int enable) | ||
322 | { | ||
323 | static int sound_user[SOUND_MAX] = {0, 0, 0}; | ||
324 | int *usr = NULL; | ||
325 | u32 bit; | ||
326 | |||
327 | switch (id) { | ||
328 | case 3: | ||
329 | case 4: | ||
330 | usr = sound_user + AK4554_34; | ||
331 | bit = (1 << 10); | ||
332 | break; | ||
333 | case 5: | ||
334 | case 6: | ||
335 | usr = sound_user + AK4643_56; | ||
336 | bit = (1 << 6); | ||
337 | break; | ||
338 | case 7: | ||
339 | case 8: | ||
340 | usr = sound_user + AK4554_78; | ||
341 | bit = (1 << 7); | ||
342 | break; | ||
343 | } | ||
344 | |||
345 | if (!usr) | ||
346 | return -EIO; | ||
347 | |||
348 | if (enable) { | ||
349 | if (*usr == 0) { | ||
350 | u32 val = ioread16(fpga + COMCTLR); | ||
351 | val &= ~bit; | ||
352 | iowrite16(val, fpga + COMCTLR); | ||
353 | } | ||
354 | |||
355 | (*usr)++; | ||
356 | } else { | ||
357 | if (*usr == 0) | ||
358 | return 0; | ||
359 | |||
360 | (*usr)--; | ||
361 | |||
362 | if (*usr == 0) { | ||
363 | u32 val = ioread16(fpga + COMCTLR); | ||
364 | val |= bit; | ||
365 | iowrite16(val, fpga + COMCTLR); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | return 0; | ||
370 | } | ||
371 | |||
372 | static int rsnd_start(int id) | ||
373 | { | ||
374 | return rsnd_codec_power(id, 1); | ||
375 | } | ||
376 | |||
377 | static int rsnd_stop(int id) | ||
378 | { | ||
379 | return rsnd_codec_power(id, 0); | ||
380 | } | ||
381 | |||
382 | static struct rcar_snd_info rsnd_info = { | ||
383 | .flags = RSND_GEN1, | ||
384 | .ssi_info = rsnd_ssi, | ||
385 | .ssi_info_nr = ARRAY_SIZE(rsnd_ssi), | ||
386 | .scu_info = rsnd_scu, | ||
387 | .scu_info_nr = ARRAY_SIZE(rsnd_scu), | ||
388 | .start = rsnd_start, | ||
389 | .stop = rsnd_stop, | ||
390 | }; | ||
391 | |||
392 | static struct asoc_simple_card_info rsnd_card_info[] = { | ||
393 | /* SSI5, SSI6 */ | ||
394 | { | ||
395 | .name = "AK4643", | ||
396 | .card = "SSI56-AK4643", | ||
397 | .codec = "ak4642-codec.0-0012", | ||
398 | .platform = "rcar_sound", | ||
399 | .daifmt = SND_SOC_DAIFMT_LEFT_J, | ||
400 | .cpu_dai = { | ||
401 | .name = "rsnd-dai.0", | ||
402 | .fmt = SND_SOC_DAIFMT_CBS_CFS, | ||
403 | }, | ||
404 | .codec_dai = { | ||
405 | .name = "ak4642-hifi", | ||
406 | .fmt = SND_SOC_DAIFMT_CBM_CFM, | ||
407 | .sysclk = 11289600, | ||
408 | }, | ||
409 | }, | ||
410 | /* SSI3 */ | ||
411 | { | ||
412 | .name = "AK4554", | ||
413 | .card = "SSI3-AK4554(playback)", | ||
414 | .codec = "ak4554-adc-dac.0", | ||
415 | .platform = "rcar_sound", | ||
416 | .cpu_dai = { | ||
417 | .name = "rsnd-dai.1", | ||
418 | .fmt = SND_SOC_DAIFMT_CBM_CFM | | ||
419 | SND_SOC_DAIFMT_RIGHT_J, | ||
420 | }, | ||
421 | .codec_dai = { | ||
422 | .name = "ak4554-hifi", | ||
423 | }, | ||
424 | }, | ||
425 | /* SSI4 */ | ||
426 | { | ||
427 | .name = "AK4554", | ||
428 | .card = "SSI4-AK4554(capture)", | ||
429 | .codec = "ak4554-adc-dac.0", | ||
430 | .platform = "rcar_sound", | ||
431 | .cpu_dai = { | ||
432 | .name = "rsnd-dai.2", | ||
433 | .fmt = SND_SOC_DAIFMT_CBM_CFM | | ||
434 | SND_SOC_DAIFMT_LEFT_J, | ||
435 | }, | ||
436 | .codec_dai = { | ||
437 | .name = "ak4554-hifi", | ||
438 | }, | ||
439 | }, | ||
440 | /* SSI7 */ | ||
441 | { | ||
442 | .name = "AK4554", | ||
443 | .card = "SSI7-AK4554(playback)", | ||
444 | .codec = "ak4554-adc-dac.1", | ||
445 | .platform = "rcar_sound", | ||
446 | .cpu_dai = { | ||
447 | .name = "rsnd-dai.3", | ||
448 | .fmt = SND_SOC_DAIFMT_CBM_CFM | | ||
449 | SND_SOC_DAIFMT_RIGHT_J, | ||
450 | }, | ||
451 | .codec_dai = { | ||
452 | .name = "ak4554-hifi", | ||
453 | }, | ||
454 | }, | ||
455 | /* SSI8 */ | ||
456 | { | ||
457 | .name = "AK4554", | ||
458 | .card = "SSI8-AK4554(capture)", | ||
459 | .codec = "ak4554-adc-dac.1", | ||
460 | .platform = "rcar_sound", | ||
461 | .cpu_dai = { | ||
462 | .name = "rsnd-dai.4", | ||
463 | .fmt = SND_SOC_DAIFMT_CBM_CFM | | ||
464 | SND_SOC_DAIFMT_LEFT_J, | ||
465 | }, | ||
466 | .codec_dai = { | ||
467 | .name = "ak4554-hifi", | ||
468 | }, | ||
469 | } | ||
470 | }; | ||
471 | |||
184 | static const struct pinctrl_map bockw_pinctrl_map[] = { | 472 | static const struct pinctrl_map bockw_pinctrl_map[] = { |
473 | /* AUDIO */ | ||
474 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
475 | "audio_clk_a", "audio_clk"), | ||
476 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
477 | "audio_clk_b", "audio_clk"), | ||
478 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
479 | "ssi34_ctrl", "ssi"), | ||
480 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
481 | "ssi3_data", "ssi"), | ||
482 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
483 | "ssi4_data", "ssi"), | ||
484 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
485 | "ssi5_ctrl", "ssi"), | ||
486 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
487 | "ssi5_data", "ssi"), | ||
488 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
489 | "ssi6_ctrl", "ssi"), | ||
490 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
491 | "ssi6_data", "ssi"), | ||
492 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
493 | "ssi78_ctrl", "ssi"), | ||
494 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
495 | "ssi7_data", "ssi"), | ||
496 | PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778", | ||
497 | "ssi8_data", "ssi"), | ||
185 | /* Ether */ | 498 | /* Ether */ |
186 | PIN_MAP_MUX_GROUP_DEFAULT("r8a777x-ether", "pfc-r8a7778", | 499 | PIN_MAP_MUX_GROUP_DEFAULT("r8a777x-ether", "pfc-r8a7778", |
187 | "ether_rmii", "ether"), | 500 | "ether_rmii", "ether"), |
@@ -201,7 +514,7 @@ static const struct pinctrl_map bockw_pinctrl_map[] = { | |||
201 | /* USB */ | 514 | /* USB */ |
202 | PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", | 515 | PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", |
203 | "usb0", "usb0"), | 516 | "usb0", "usb0"), |
204 | PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", | 517 | PIN_MAP_MUX_GROUP_DEFAULT(USB1_DEVICE, "pfc-r8a7778", |
205 | "usb1", "usb1"), | 518 | "usb1", "usb1"), |
206 | /* SDHI0 */ | 519 | /* SDHI0 */ |
207 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", | 520 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", |
@@ -224,13 +537,13 @@ static const struct pinctrl_map bockw_pinctrl_map[] = { | |||
224 | "vin1_data8", "vin1"), | 537 | "vin1_data8", "vin1"), |
225 | }; | 538 | }; |
226 | 539 | ||
227 | #define FPGA 0x18200000 | ||
228 | #define IRQ0MR 0x30 | ||
229 | #define PFC 0xfffc0000 | 540 | #define PFC 0xfffc0000 |
230 | #define PUPR4 0x110 | 541 | #define PUPR4 0x110 |
231 | static void __init bockw_init(void) | 542 | static void __init bockw_init(void) |
232 | { | 543 | { |
233 | void __iomem *base; | 544 | void __iomem *base; |
545 | struct clk *clk; | ||
546 | int i; | ||
234 | 547 | ||
235 | r8a7778_clock_init(); | 548 | r8a7778_clock_init(); |
236 | r8a7778_init_irq_extpin(1); | 549 | r8a7778_init_irq_extpin(1); |
@@ -269,8 +582,8 @@ static void __init bockw_init(void) | |||
269 | 582 | ||
270 | 583 | ||
271 | /* for SMSC */ | 584 | /* for SMSC */ |
272 | base = ioremap_nocache(FPGA, SZ_1M); | 585 | fpga = ioremap_nocache(FPGA, SZ_1M); |
273 | if (base) { | 586 | if (fpga) { |
274 | /* | 587 | /* |
275 | * CAUTION | 588 | * CAUTION |
276 | * | 589 | * |
@@ -278,10 +591,9 @@ static void __init bockw_init(void) | |||
278 | * it should be cared in the future | 591 | * it should be cared in the future |
279 | * Now, it is assuming IRQ0 was used only from SMSC. | 592 | * Now, it is assuming IRQ0 was used only from SMSC. |
280 | */ | 593 | */ |
281 | u16 val = ioread16(base + IRQ0MR); | 594 | u16 val = ioread16(fpga + IRQ0MR); |
282 | val &= ~(1 << 4); /* enable SMSC911x */ | 595 | val &= ~(1 << 4); /* enable SMSC911x */ |
283 | iowrite16(val, base + IRQ0MR); | 596 | iowrite16(val, fpga + IRQ0MR); |
284 | iounmap(base); | ||
285 | 597 | ||
286 | regulator_register_fixed(0, dummy_supplies, | 598 | regulator_register_fixed(0, dummy_supplies, |
287 | ARRAY_SIZE(dummy_supplies)); | 599 | ARRAY_SIZE(dummy_supplies)); |
@@ -308,6 +620,42 @@ static void __init bockw_init(void) | |||
308 | sdhi0_resources, ARRAY_SIZE(sdhi0_resources), | 620 | sdhi0_resources, ARRAY_SIZE(sdhi0_resources), |
309 | &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); | 621 | &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); |
310 | } | 622 | } |
623 | |||
624 | /* for Audio */ | ||
625 | clk = clk_get(NULL, "audio_clk_b"); | ||
626 | clk_set_rate(clk, 24576000); | ||
627 | clk_put(clk); | ||
628 | rsnd_codec_power(5, 1); /* enable ak4642 */ | ||
629 | |||
630 | platform_device_register_simple( | ||
631 | "ak4554-adc-dac", 0, NULL, 0); | ||
632 | |||
633 | platform_device_register_simple( | ||
634 | "ak4554-adc-dac", 1, NULL, 0); | ||
635 | |||
636 | platform_device_register_resndata( | ||
637 | &platform_bus, "rcar_sound", -1, | ||
638 | rsnd_resources, ARRAY_SIZE(rsnd_resources), | ||
639 | &rsnd_info, sizeof(rsnd_info)); | ||
640 | |||
641 | for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) { | ||
642 | struct platform_device_info cardinfo = { | ||
643 | .parent = &platform_bus, | ||
644 | .name = "asoc-simple-card", | ||
645 | .id = i, | ||
646 | .data = &rsnd_card_info[i], | ||
647 | .size_data = sizeof(struct asoc_simple_card_info), | ||
648 | .dma_mask = ~0, | ||
649 | }; | ||
650 | |||
651 | platform_device_register_full(&cardinfo); | ||
652 | } | ||
653 | } | ||
654 | |||
655 | static void __init bockw_init_late(void) | ||
656 | { | ||
657 | r8a7778_init_late(); | ||
658 | ADD_USB_FUNC_DEVICE_IF_POSSIBLE(); | ||
311 | } | 659 | } |
312 | 660 | ||
313 | static const char *bockw_boards_compat_dt[] __initdata = { | 661 | static const char *bockw_boards_compat_dt[] __initdata = { |
@@ -320,5 +668,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw") | |||
320 | .init_irq = r8a7778_init_irq_dt, | 668 | .init_irq = r8a7778_init_irq_dt, |
321 | .init_machine = bockw_init, | 669 | .init_machine = bockw_init, |
322 | .dt_compat = bockw_boards_compat_dt, | 670 | .dt_compat = bockw_boards_compat_dt, |
323 | .init_late = r8a7778_init_late, | 671 | .init_late = bockw_init_late, |
324 | MACHINE_END | 672 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c new file mode 100644 index 000000000000..cc2d5e82b59a --- /dev/null +++ b/arch/arm/mach-shmobile/board-koelsch.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Koelsch board support | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Electronics Corporation | ||
5 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
6 | * Copyright (C) 2013 Magnus Damm | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <mach/common.h> | ||
25 | #include <mach/r8a7791.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | #include <asm/mach/arch.h> | ||
28 | |||
29 | static void __init koelsch_add_standard_devices(void) | ||
30 | { | ||
31 | r8a7791_clock_init(); | ||
32 | r8a7791_add_dt_devices(); | ||
33 | } | ||
34 | |||
35 | static const char * const koelsch_boards_compat_dt[] __initconst = { | ||
36 | "renesas,koelsch", | ||
37 | NULL, | ||
38 | }; | ||
39 | |||
40 | DT_MACHINE_START(KOELSCH_DT, "koelsch") | ||
41 | .init_early = r8a7791_init_early, | ||
42 | .init_machine = koelsch_add_standard_devices, | ||
43 | .dt_compat = koelsch_boards_compat_dt, | ||
44 | MACHINE_END | ||
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index f1994968d303..fe689b7fdc9e 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -366,6 +366,7 @@ static struct resource sh_mmcif_resources[] = { | |||
366 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { | 366 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
367 | .ocr = MMC_VDD_165_195, | 367 | .ocr = MMC_VDD_165_195, |
368 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | 368 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
369 | .ccs_unsupported = true, | ||
369 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, | 370 | .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, |
370 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | 371 | .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, |
371 | }; | 372 | }; |
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index ffb6f0ac7606..1e231423b2b0 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mmc/sh_mmcif.h> | 28 | #include <linux/mmc/sh_mmcif.h> |
29 | #include <linux/pinctrl/machine.h> | 29 | #include <linux/pinctrl/machine.h> |
30 | #include <linux/platform_data/gpio-rcar.h> | 30 | #include <linux/platform_data/gpio-rcar.h> |
31 | #include <linux/platform_data/rcar-du.h> | ||
31 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
32 | #include <linux/regulator/fixed.h> | 33 | #include <linux/regulator/fixed.h> |
33 | #include <linux/regulator/machine.h> | 34 | #include <linux/regulator/machine.h> |
@@ -38,6 +39,62 @@ | |||
38 | #include <asm/mach-types.h> | 39 | #include <asm/mach-types.h> |
39 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
40 | 41 | ||
42 | /* DU */ | ||
43 | static struct rcar_du_encoder_data lager_du_encoders[] = { | ||
44 | { | ||
45 | .type = RCAR_DU_ENCODER_VGA, | ||
46 | .output = RCAR_DU_OUTPUT_DPAD0, | ||
47 | }, { | ||
48 | .type = RCAR_DU_ENCODER_NONE, | ||
49 | .output = RCAR_DU_OUTPUT_LVDS1, | ||
50 | .connector.lvds.panel = { | ||
51 | .width_mm = 210, | ||
52 | .height_mm = 158, | ||
53 | .mode = { | ||
54 | .clock = 65000, | ||
55 | .hdisplay = 1024, | ||
56 | .hsync_start = 1048, | ||
57 | .hsync_end = 1184, | ||
58 | .htotal = 1344, | ||
59 | .vdisplay = 768, | ||
60 | .vsync_start = 771, | ||
61 | .vsync_end = 777, | ||
62 | .vtotal = 806, | ||
63 | .flags = 0, | ||
64 | }, | ||
65 | }, | ||
66 | }, | ||
67 | }; | ||
68 | |||
69 | static const struct rcar_du_platform_data lager_du_pdata __initconst = { | ||
70 | .encoders = lager_du_encoders, | ||
71 | .num_encoders = ARRAY_SIZE(lager_du_encoders), | ||
72 | }; | ||
73 | |||
74 | static const struct resource du_resources[] __initconst = { | ||
75 | DEFINE_RES_MEM(0xfeb00000, 0x70000), | ||
76 | DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"), | ||
77 | DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"), | ||
78 | DEFINE_RES_IRQ(gic_spi(256)), | ||
79 | DEFINE_RES_IRQ(gic_spi(268)), | ||
80 | DEFINE_RES_IRQ(gic_spi(269)), | ||
81 | }; | ||
82 | |||
83 | static void __init lager_add_du_device(void) | ||
84 | { | ||
85 | struct platform_device_info info = { | ||
86 | .name = "rcar-du-r8a7790", | ||
87 | .id = -1, | ||
88 | .res = du_resources, | ||
89 | .num_res = ARRAY_SIZE(du_resources), | ||
90 | .data = &lager_du_pdata, | ||
91 | .size_data = sizeof(lager_du_pdata), | ||
92 | .dma_mask = DMA_BIT_MASK(32), | ||
93 | }; | ||
94 | |||
95 | platform_device_register_full(&info); | ||
96 | } | ||
97 | |||
41 | /* LEDS */ | 98 | /* LEDS */ |
42 | static struct gpio_led lager_leds[] = { | 99 | static struct gpio_led lager_leds[] = { |
43 | { | 100 | { |
@@ -85,6 +142,8 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] = | |||
85 | /* MMCIF */ | 142 | /* MMCIF */ |
86 | static struct sh_mmcif_plat_data mmcif1_pdata __initdata = { | 143 | static struct sh_mmcif_plat_data mmcif1_pdata __initdata = { |
87 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | 144 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
145 | .clk_ctrl2_present = true, | ||
146 | .ccs_unsupported = true, | ||
88 | }; | 147 | }; |
89 | 148 | ||
90 | static struct resource mmcif1_resources[] __initdata = { | 149 | static struct resource mmcif1_resources[] __initdata = { |
@@ -106,6 +165,13 @@ static struct resource ether_resources[] __initdata = { | |||
106 | }; | 165 | }; |
107 | 166 | ||
108 | static const struct pinctrl_map lager_pinctrl_map[] = { | 167 | static const struct pinctrl_map lager_pinctrl_map[] = { |
168 | /* DU (CN10: ARGB0, CN13: LVDS) */ | ||
169 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", | ||
170 | "du_rgb666", "du"), | ||
171 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", | ||
172 | "du_sync_1", "du"), | ||
173 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", | ||
174 | "du_clk_out_0", "du"), | ||
109 | /* SCIF0 (CN19: DEBUG SERIAL0) */ | 175 | /* SCIF0 (CN19: DEBUG SERIAL0) */ |
110 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", | 176 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", |
111 | "scif0_data", "scif0"), | 177 | "scif0_data", "scif0"), |
@@ -153,6 +219,8 @@ static void __init lager_add_standard_devices(void) | |||
153 | ether_resources, | 219 | ether_resources, |
154 | ARRAY_SIZE(ether_resources), | 220 | ARRAY_SIZE(ether_resources), |
155 | ðer_pdata, sizeof(ether_pdata)); | 221 | ðer_pdata, sizeof(ether_pdata)); |
222 | |||
223 | lager_add_du_device(); | ||
156 | } | 224 | } |
157 | 225 | ||
158 | static const char *lager_boards_compat_dt[] __initdata = { | 226 | static const char *lager_boards_compat_dt[] __initdata = { |
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index 3f5044fda4e3..434b213cc738 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | #include <linux/pinctrl/machine.h> | 31 | #include <linux/pinctrl/machine.h> |
32 | #include <linux/platform_data/gpio-rcar.h> | 32 | #include <linux/platform_data/gpio-rcar.h> |
33 | #include <linux/platform_data/rcar-du.h> | ||
33 | #include <linux/platform_data/usb-rcar-phy.h> | 34 | #include <linux/platform_data/usb-rcar-phy.h> |
34 | #include <linux/regulator/fixed.h> | 35 | #include <linux/regulator/fixed.h> |
35 | #include <linux/regulator/machine.h> | 36 | #include <linux/regulator/machine.h> |
@@ -169,6 +170,63 @@ static struct platform_device hspi_device = { | |||
169 | .num_resources = ARRAY_SIZE(hspi_resources), | 170 | .num_resources = ARRAY_SIZE(hspi_resources), |
170 | }; | 171 | }; |
171 | 172 | ||
173 | /* | ||
174 | * DU | ||
175 | * | ||
176 | * The panel only specifies the [hv]display and [hv]total values. The position | ||
177 | * and width of the sync pulses don't matter, they're copied from VESA timings. | ||
178 | */ | ||
179 | static struct rcar_du_encoder_data du_encoders[] = { | ||
180 | { | ||
181 | .type = RCAR_DU_ENCODER_VGA, | ||
182 | .output = RCAR_DU_OUTPUT_DPAD0, | ||
183 | }, { | ||
184 | .type = RCAR_DU_ENCODER_LVDS, | ||
185 | .output = RCAR_DU_OUTPUT_DPAD1, | ||
186 | .connector.lvds.panel = { | ||
187 | .width_mm = 210, | ||
188 | .height_mm = 158, | ||
189 | .mode = { | ||
190 | .clock = 65000, | ||
191 | .hdisplay = 1024, | ||
192 | .hsync_start = 1048, | ||
193 | .hsync_end = 1184, | ||
194 | .htotal = 1344, | ||
195 | .vdisplay = 768, | ||
196 | .vsync_start = 771, | ||
197 | .vsync_end = 777, | ||
198 | .vtotal = 806, | ||
199 | .flags = 0, | ||
200 | }, | ||
201 | }, | ||
202 | }, | ||
203 | }; | ||
204 | |||
205 | static const struct rcar_du_platform_data du_pdata __initconst = { | ||
206 | .encoders = du_encoders, | ||
207 | .num_encoders = ARRAY_SIZE(du_encoders), | ||
208 | }; | ||
209 | |||
210 | static const struct resource du_resources[] __initconst = { | ||
211 | DEFINE_RES_MEM(0xfff80000, 0x40000), | ||
212 | DEFINE_RES_IRQ(gic_iid(0x3f)), | ||
213 | }; | ||
214 | |||
215 | static void __init marzen_add_du_device(void) | ||
216 | { | ||
217 | struct platform_device_info info = { | ||
218 | .name = "rcar-du-r8a7779", | ||
219 | .id = -1, | ||
220 | .res = du_resources, | ||
221 | .num_res = ARRAY_SIZE(du_resources), | ||
222 | .data = &du_pdata, | ||
223 | .size_data = sizeof(du_pdata), | ||
224 | .dma_mask = DMA_BIT_MASK(32), | ||
225 | }; | ||
226 | |||
227 | platform_device_register_full(&info); | ||
228 | } | ||
229 | |||
172 | /* LEDS */ | 230 | /* LEDS */ |
173 | static struct gpio_led marzen_leds[] = { | 231 | static struct gpio_led marzen_leds[] = { |
174 | { | 232 | { |
@@ -237,6 +295,19 @@ static struct platform_device *marzen_devices[] __initdata = { | |||
237 | }; | 295 | }; |
238 | 296 | ||
239 | static const struct pinctrl_map marzen_pinctrl_map[] = { | 297 | static const struct pinctrl_map marzen_pinctrl_map[] = { |
298 | /* DU (CN10: ARGB0, CN13: LVDS) */ | ||
299 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779", | ||
300 | "du0_rgb888", "du0"), | ||
301 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779", | ||
302 | "du0_sync_1", "du0"), | ||
303 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779", | ||
304 | "du0_clk_out_0", "du0"), | ||
305 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779", | ||
306 | "du1_rgb666", "du1"), | ||
307 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779", | ||
308 | "du1_sync_1", "du1"), | ||
309 | PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779", | ||
310 | "du1_clk_out", "du1"), | ||
240 | /* HSPI0 */ | 311 | /* HSPI0 */ |
241 | PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779", | 312 | PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779", |
242 | "hspi0", "hspi0"), | 313 | "hspi0", "hspi0"), |
@@ -297,6 +368,7 @@ static void __init marzen_init(void) | |||
297 | r8a7779_add_vin_device(1, &vin_platform_data); | 368 | r8a7779_add_vin_device(1, &vin_platform_data); |
298 | r8a7779_add_vin_device(3, &vin_platform_data); | 369 | r8a7779_add_vin_device(3, &vin_platform_data); |
299 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); | 370 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); |
371 | marzen_add_du_device(); | ||
300 | } | 372 | } |
301 | 373 | ||
302 | static const char *marzen_boards_compat_dt[] __initdata = { | 374 | static const char *marzen_boards_compat_dt[] __initdata = { |
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c index c4bf2d8fb111..fb6af83858e3 100644 --- a/arch/arm/mach-shmobile/clock-r8a7778.c +++ b/arch/arm/mach-shmobile/clock-r8a7778.c | |||
@@ -69,6 +69,15 @@ static struct clk extal_clk = { | |||
69 | .mapping = &cpg_mapping, | 69 | .mapping = &cpg_mapping, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct clk audio_clk_a = { | ||
73 | }; | ||
74 | |||
75 | static struct clk audio_clk_b = { | ||
76 | }; | ||
77 | |||
78 | static struct clk audio_clk_c = { | ||
79 | }; | ||
80 | |||
72 | /* | 81 | /* |
73 | * clock ratio of these clock will be updated | 82 | * clock ratio of these clock will be updated |
74 | * on r8a7778_clock_init() | 83 | * on r8a7778_clock_init() |
@@ -100,18 +109,23 @@ static struct clk *main_clks[] = { | |||
100 | &p_clk, | 109 | &p_clk, |
101 | &g_clk, | 110 | &g_clk, |
102 | &z_clk, | 111 | &z_clk, |
112 | &audio_clk_a, | ||
113 | &audio_clk_b, | ||
114 | &audio_clk_c, | ||
103 | }; | 115 | }; |
104 | 116 | ||
105 | enum { | 117 | enum { |
106 | MSTP331, | 118 | MSTP331, |
107 | MSTP323, MSTP322, MSTP321, | 119 | MSTP323, MSTP322, MSTP321, |
120 | MSTP311, MSTP310, | ||
121 | MSTP309, MSTP308, MSTP307, | ||
108 | MSTP114, | 122 | MSTP114, |
109 | MSTP110, MSTP109, | 123 | MSTP110, MSTP109, |
110 | MSTP100, | 124 | MSTP100, |
111 | MSTP030, | 125 | MSTP030, |
112 | MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, | 126 | MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, |
113 | MSTP016, MSTP015, | 127 | MSTP016, MSTP015, MSTP012, MSTP011, MSTP010, |
114 | MSTP007, | 128 | MSTP009, MSTP008, MSTP007, |
115 | MSTP_NR }; | 129 | MSTP_NR }; |
116 | 130 | ||
117 | static struct clk mstp_clks[MSTP_NR] = { | 131 | static struct clk mstp_clks[MSTP_NR] = { |
@@ -119,6 +133,11 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
119 | [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */ | 133 | [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */ |
120 | [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */ | 134 | [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */ |
121 | [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */ | 135 | [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */ |
136 | [MSTP311] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 11, 0), /* SSI4 */ | ||
137 | [MSTP310] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 10, 0), /* SSI5 */ | ||
138 | [MSTP309] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 9, 0), /* SSI6 */ | ||
139 | [MSTP308] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 8, 0), /* SSI7 */ | ||
140 | [MSTP307] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 7, 0), /* SSI8 */ | ||
122 | [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */ | 141 | [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */ |
123 | [MSTP110] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 10, 0), /* VIN0 */ | 142 | [MSTP110] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 10, 0), /* VIN0 */ |
124 | [MSTP109] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 9, 0), /* VIN1 */ | 143 | [MSTP109] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 9, 0), /* VIN1 */ |
@@ -135,11 +154,20 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
135 | [MSTP021] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 21, 0), /* SCIF5 */ | 154 | [MSTP021] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 21, 0), /* SCIF5 */ |
136 | [MSTP016] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 16, 0), /* TMU0 */ | 155 | [MSTP016] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 16, 0), /* TMU0 */ |
137 | [MSTP015] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 15, 0), /* TMU1 */ | 156 | [MSTP015] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 15, 0), /* TMU1 */ |
157 | [MSTP012] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 12, 0), /* SSI0 */ | ||
158 | [MSTP011] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 11, 0), /* SSI1 */ | ||
159 | [MSTP010] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 10, 0), /* SSI2 */ | ||
160 | [MSTP009] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 9, 0), /* SSI3 */ | ||
161 | [MSTP008] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 8, 0), /* SRU */ | ||
138 | [MSTP007] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 7, 0), /* HSPI */ | 162 | [MSTP007] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 7, 0), /* HSPI */ |
139 | }; | 163 | }; |
140 | 164 | ||
141 | static struct clk_lookup lookups[] = { | 165 | static struct clk_lookup lookups[] = { |
142 | /* main */ | 166 | /* main */ |
167 | CLKDEV_CON_ID("audio_clk_a", &audio_clk_a), | ||
168 | CLKDEV_CON_ID("audio_clk_b", &audio_clk_b), | ||
169 | CLKDEV_CON_ID("audio_clk_c", &audio_clk_c), | ||
170 | CLKDEV_CON_ID("audio_clk_internal", &s1_clk), | ||
143 | CLKDEV_CON_ID("shyway_clk", &s_clk), | 171 | CLKDEV_CON_ID("shyway_clk", &s_clk), |
144 | CLKDEV_CON_ID("peripheral_clk", &p_clk), | 172 | CLKDEV_CON_ID("peripheral_clk", &p_clk), |
145 | 173 | ||
@@ -153,6 +181,7 @@ static struct clk_lookup lookups[] = { | |||
153 | CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */ | 181 | CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */ |
154 | CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ | 182 | CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ |
155 | CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ | 183 | CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ |
184 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP100]), /* USB FUNC */ | ||
156 | CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ | 185 | CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ |
157 | CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ | 186 | CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ |
158 | CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */ | 187 | CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */ |
@@ -168,6 +197,17 @@ static struct clk_lookup lookups[] = { | |||
168 | CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ | 197 | CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ |
169 | CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ | 198 | CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ |
170 | CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */ | 199 | CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */ |
200 | CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */ | ||
201 | |||
202 | CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]), | ||
203 | CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP011]), | ||
204 | CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP010]), | ||
205 | CLKDEV_ICK_ID("ssi.3", "rcar_sound", &mstp_clks[MSTP009]), | ||
206 | CLKDEV_ICK_ID("ssi.4", "rcar_sound", &mstp_clks[MSTP311]), | ||
207 | CLKDEV_ICK_ID("ssi.5", "rcar_sound", &mstp_clks[MSTP310]), | ||
208 | CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]), | ||
209 | CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]), | ||
210 | CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]), | ||
171 | }; | 211 | }; |
172 | 212 | ||
173 | void __init r8a7778_clock_init(void) | 213 | void __init r8a7778_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c index bd6ad922eb7e..1f7080fab0a5 100644 --- a/arch/arm/mach-shmobile/clock-r8a7779.c +++ b/arch/arm/mach-shmobile/clock-r8a7779.c | |||
@@ -200,7 +200,7 @@ static struct clk_lookup lookups[] = { | |||
200 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ | 200 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ |
201 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ | 201 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ |
202 | CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ | 202 | CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ |
203 | CLKDEV_DEV_ID("rcar-du.0", &mstp_clks[MSTP103]), /* DU */ | 203 | CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */ |
204 | }; | 204 | }; |
205 | 205 | ||
206 | void __init r8a7779_clock_init(void) | 206 | void __init r8a7779_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index fc36d3db0b4d..d99b87bc76ea 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -182,7 +182,7 @@ static struct clk div6_clks[DIV6_NR] = { | |||
182 | /* MSTP */ | 182 | /* MSTP */ |
183 | enum { | 183 | enum { |
184 | MSTP813, | 184 | MSTP813, |
185 | MSTP721, MSTP720, | 185 | MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720, |
186 | MSTP717, MSTP716, | 186 | MSTP717, MSTP716, |
187 | MSTP522, | 187 | MSTP522, |
188 | MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304, | 188 | MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304, |
@@ -193,6 +193,11 @@ enum { | |||
193 | 193 | ||
194 | static struct clk mstp_clks[MSTP_NR] = { | 194 | static struct clk mstp_clks[MSTP_NR] = { |
195 | [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */ | 195 | [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */ |
196 | [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */ | ||
197 | [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */ | ||
198 | [MSTP724] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 24, 0), /* DU0 */ | ||
199 | [MSTP723] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 23, 0), /* DU1 */ | ||
200 | [MSTP722] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 22, 0), /* DU2 */ | ||
196 | [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */ | 201 | [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */ |
197 | [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ | 202 | [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ |
198 | [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */ | 203 | [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */ |
@@ -251,6 +256,11 @@ static struct clk_lookup lookups[] = { | |||
251 | CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]), | 256 | CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]), |
252 | 257 | ||
253 | /* MSTP */ | 258 | /* MSTP */ |
259 | CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]), | ||
260 | CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]), | ||
261 | CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]), | ||
262 | CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]), | ||
263 | CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]), | ||
254 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), | 264 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), |
255 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), | 265 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), |
256 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), | 266 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), |
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c new file mode 100644 index 000000000000..c9a26f16ce5b --- /dev/null +++ b/arch/arm/mach-shmobile/clock-r8a7791.c | |||
@@ -0,0 +1,237 @@ | |||
1 | /* | ||
2 | * r8a7791 clock framework support | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Electronics Corporation | ||
5 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
6 | * Copyright (C) 2013 Magnus Damm | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/sh_clk.h> | ||
25 | #include <linux/clkdev.h> | ||
26 | #include <mach/clock.h> | ||
27 | #include <mach/common.h> | ||
28 | |||
29 | /* | ||
30 | * MD EXTAL PLL0 PLL1 PLL3 | ||
31 | * 14 13 19 (MHz) *1 *1 | ||
32 | *--------------------------------------------------- | ||
33 | * 0 0 0 15 x 1 x172/2 x208/2 x106 | ||
34 | * 0 0 1 15 x 1 x172/2 x208/2 x88 | ||
35 | * 0 1 0 20 x 1 x130/2 x156/2 x80 | ||
36 | * 0 1 1 20 x 1 x130/2 x156/2 x66 | ||
37 | * 1 0 0 26 / 2 x200/2 x240/2 x122 | ||
38 | * 1 0 1 26 / 2 x200/2 x240/2 x102 | ||
39 | * 1 1 0 30 / 2 x172/2 x208/2 x106 | ||
40 | * 1 1 1 30 / 2 x172/2 x208/2 x88 | ||
41 | * | ||
42 | * *1 : Table 7.6 indicates VCO ouput (PLLx = VCO/2) | ||
43 | * see "p1 / 2" on R8A7791_CLOCK_ROOT() below | ||
44 | */ | ||
45 | |||
46 | #define MD(nr) (1 << nr) | ||
47 | |||
48 | #define CPG_BASE 0xe6150000 | ||
49 | #define CPG_LEN 0x1000 | ||
50 | |||
51 | #define SMSTPCR0 0xE6150130 | ||
52 | #define SMSTPCR1 0xE6150134 | ||
53 | #define SMSTPCR2 0xe6150138 | ||
54 | #define SMSTPCR3 0xE615013C | ||
55 | #define SMSTPCR5 0xE6150144 | ||
56 | #define SMSTPCR7 0xe615014c | ||
57 | #define SMSTPCR8 0xE6150990 | ||
58 | #define SMSTPCR9 0xE6150994 | ||
59 | #define SMSTPCR10 0xE6150998 | ||
60 | #define SMSTPCR11 0xE615099C | ||
61 | |||
62 | #define MODEMR 0xE6160060 | ||
63 | #define SDCKCR 0xE6150074 | ||
64 | #define SD2CKCR 0xE6150078 | ||
65 | #define SD3CKCR 0xE615007C | ||
66 | #define MMC0CKCR 0xE6150240 | ||
67 | #define MMC1CKCR 0xE6150244 | ||
68 | #define SSPCKCR 0xE6150248 | ||
69 | #define SSPRSCKCR 0xE615024C | ||
70 | |||
71 | static struct clk_mapping cpg_mapping = { | ||
72 | .phys = CPG_BASE, | ||
73 | .len = CPG_LEN, | ||
74 | }; | ||
75 | |||
76 | static struct clk extal_clk = { | ||
77 | /* .rate will be updated on r8a7791_clock_init() */ | ||
78 | .mapping = &cpg_mapping, | ||
79 | }; | ||
80 | |||
81 | static struct sh_clk_ops followparent_clk_ops = { | ||
82 | .recalc = followparent_recalc, | ||
83 | }; | ||
84 | |||
85 | static struct clk main_clk = { | ||
86 | /* .parent will be set r8a73a4_clock_init */ | ||
87 | .ops = &followparent_clk_ops, | ||
88 | }; | ||
89 | |||
90 | /* | ||
91 | * clock ratio of these clock will be updated | ||
92 | * on r8a7791_clock_init() | ||
93 | */ | ||
94 | SH_FIXED_RATIO_CLK_SET(pll1_clk, main_clk, 1, 1); | ||
95 | SH_FIXED_RATIO_CLK_SET(pll3_clk, main_clk, 1, 1); | ||
96 | |||
97 | /* fixed ratio clock */ | ||
98 | SH_FIXED_RATIO_CLK_SET(extal_div2_clk, extal_clk, 1, 2); | ||
99 | SH_FIXED_RATIO_CLK_SET(cp_clk, extal_clk, 1, 2); | ||
100 | |||
101 | SH_FIXED_RATIO_CLK_SET(pll1_div2_clk, pll1_clk, 1, 2); | ||
102 | SH_FIXED_RATIO_CLK_SET(hp_clk, pll1_clk, 1, 12); | ||
103 | SH_FIXED_RATIO_CLK_SET(p_clk, pll1_clk, 1, 24); | ||
104 | SH_FIXED_RATIO_CLK_SET(rclk_clk, pll1_clk, 1, (48 * 1024)); | ||
105 | SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15); | ||
106 | |||
107 | static struct clk *main_clks[] = { | ||
108 | &extal_clk, | ||
109 | &extal_div2_clk, | ||
110 | &main_clk, | ||
111 | &pll1_clk, | ||
112 | &pll1_div2_clk, | ||
113 | &pll3_clk, | ||
114 | &hp_clk, | ||
115 | &p_clk, | ||
116 | &rclk_clk, | ||
117 | &mp_clk, | ||
118 | &cp_clk, | ||
119 | }; | ||
120 | |||
121 | /* MSTP */ | ||
122 | enum { | ||
123 | MSTP721, MSTP720, | ||
124 | MSTP719, MSTP718, MSTP715, MSTP714, | ||
125 | MSTP216, MSTP207, MSTP206, | ||
126 | MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107, | ||
127 | MSTP124, | ||
128 | MSTP_NR | ||
129 | }; | ||
130 | |||
131 | static struct clk mstp_clks[MSTP_NR] = { | ||
132 | [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */ | ||
133 | [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ | ||
134 | [MSTP719] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 19, 0), /* SCIF2 */ | ||
135 | [MSTP718] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 18, 0), /* SCIF3 */ | ||
136 | [MSTP715] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 15, 0), /* SCIF4 */ | ||
137 | [MSTP714] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 14, 0), /* SCIF5 */ | ||
138 | [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ | ||
139 | [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ | ||
140 | [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */ | ||
141 | [MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ | ||
142 | [MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ | ||
143 | [MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */ | ||
144 | [MSTP1105] = SH_CLK_MSTP32(&mp_clk, SMSTPCR11, 5, 0), /* SCIFA3 */ | ||
145 | [MSTP1106] = SH_CLK_MSTP32(&mp_clk, SMSTPCR11, 6, 0), /* SCIFA4 */ | ||
146 | [MSTP1107] = SH_CLK_MSTP32(&mp_clk, SMSTPCR11, 7, 0), /* SCIFA5 */ | ||
147 | [MSTP124] = SH_CLK_MSTP32(&rclk_clk, SMSTPCR1, 24, 0), /* CMT0 */ | ||
148 | }; | ||
149 | |||
150 | static struct clk_lookup lookups[] = { | ||
151 | |||
152 | /* main clocks */ | ||
153 | CLKDEV_CON_ID("extal", &extal_clk), | ||
154 | CLKDEV_CON_ID("extal_div2", &extal_div2_clk), | ||
155 | CLKDEV_CON_ID("main", &main_clk), | ||
156 | CLKDEV_CON_ID("pll1", &pll1_clk), | ||
157 | CLKDEV_CON_ID("pll1_div2", &pll1_div2_clk), | ||
158 | CLKDEV_CON_ID("pll3", &pll3_clk), | ||
159 | CLKDEV_CON_ID("hp", &hp_clk), | ||
160 | CLKDEV_CON_ID("p", &p_clk), | ||
161 | CLKDEV_CON_ID("rclk", &rclk_clk), | ||
162 | CLKDEV_CON_ID("mp", &mp_clk), | ||
163 | CLKDEV_CON_ID("cp", &cp_clk), | ||
164 | CLKDEV_CON_ID("peripheral_clk", &hp_clk), | ||
165 | |||
166 | /* MSTP */ | ||
167 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ | ||
168 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ | ||
169 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), /* SCIFB0 */ | ||
170 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), /* SCIFB1 */ | ||
171 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), /* SCIFB2 */ | ||
172 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP202]), /* SCIFA2 */ | ||
173 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP721]), /* SCIF0 */ | ||
174 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), /* SCIF1 */ | ||
175 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP719]), /* SCIF2 */ | ||
176 | CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP718]), /* SCIF3 */ | ||
177 | CLKDEV_DEV_ID("sh-sci.10", &mstp_clks[MSTP715]), /* SCIF4 */ | ||
178 | CLKDEV_DEV_ID("sh-sci.11", &mstp_clks[MSTP714]), /* SCIF5 */ | ||
179 | CLKDEV_DEV_ID("sh-sci.12", &mstp_clks[MSTP1105]), /* SCIFA3 */ | ||
180 | CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */ | ||
181 | CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */ | ||
182 | CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), | ||
183 | }; | ||
184 | |||
185 | #define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ | ||
186 | extal_clk.rate = e * 1000 * 1000; \ | ||
187 | main_clk.parent = m; \ | ||
188 | SH_CLK_SET_RATIO(&pll1_clk_ratio, p1 / 2, 1); \ | ||
189 | if (mode & MD(19)) \ | ||
190 | SH_CLK_SET_RATIO(&pll3_clk_ratio, p31, 1); \ | ||
191 | else \ | ||
192 | SH_CLK_SET_RATIO(&pll3_clk_ratio, p30, 1) | ||
193 | |||
194 | |||
195 | void __init r8a7791_clock_init(void) | ||
196 | { | ||
197 | void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE); | ||
198 | u32 mode; | ||
199 | int k, ret = 0; | ||
200 | |||
201 | BUG_ON(!modemr); | ||
202 | mode = ioread32(modemr); | ||
203 | iounmap(modemr); | ||
204 | |||
205 | switch (mode & (MD(14) | MD(13))) { | ||
206 | case 0: | ||
207 | R8A7791_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88); | ||
208 | break; | ||
209 | case MD(13): | ||
210 | R8A7791_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66); | ||
211 | break; | ||
212 | case MD(14): | ||
213 | R8A7791_CLOCK_ROOT(26, &extal_div2_clk, 200, 240, 122, 102); | ||
214 | break; | ||
215 | case MD(13) | MD(14): | ||
216 | R8A7791_CLOCK_ROOT(30, &extal_div2_clk, 172, 208, 106, 88); | ||
217 | break; | ||
218 | } | ||
219 | |||
220 | for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) | ||
221 | ret = clk_register(main_clks[k]); | ||
222 | |||
223 | if (!ret) | ||
224 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); | ||
225 | |||
226 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | ||
227 | |||
228 | if (!ret) | ||
229 | shmobile_clk_init(); | ||
230 | else | ||
231 | goto epanic; | ||
232 | |||
233 | return; | ||
234 | |||
235 | epanic: | ||
236 | panic("failed to setup r8a7791 clocks\n"); | ||
237 | } | ||
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h index adfcf51b163d..ea1dca6880f4 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7778.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h | |||
@@ -35,4 +35,6 @@ extern void r8a7778_clock_init(void); | |||
35 | extern void r8a7778_init_irq_extpin(int irlm); | 35 | extern void r8a7778_init_irq_extpin(int irlm); |
36 | extern void r8a7778_pinmux_init(void); | 36 | extern void r8a7778_pinmux_init(void); |
37 | 37 | ||
38 | extern int r8a7778_usb_phy_power(bool enable); | ||
39 | |||
38 | #endif /* __ASM_R8A7778_H__ */ | 40 | #endif /* __ASM_R8A7778_H__ */ |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h new file mode 100644 index 000000000000..2e6d66131083 --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __ASM_R8A7791_H__ | ||
2 | #define __ASM_R8A7791_H__ | ||
3 | |||
4 | void r8a7791_add_dt_devices(void); | ||
5 | void r8a7791_clock_init(void); | ||
6 | void r8a7791_init_early(void); | ||
7 | |||
8 | #endif /* __ASM_R8A7791_H__ */ | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c index 6a2657ebd197..e484d1420a01 100644 --- a/arch/arm/mach-shmobile/setup-r8a7778.c +++ b/arch/arm/mach-shmobile/setup-r8a7778.c | |||
@@ -95,29 +95,46 @@ static struct sh_timer_config sh_tmu1_platform_data __initdata = { | |||
95 | &sh_tmu##idx##_platform_data, \ | 95 | &sh_tmu##idx##_platform_data, \ |
96 | sizeof(sh_tmu##idx##_platform_data)) | 96 | sizeof(sh_tmu##idx##_platform_data)) |
97 | 97 | ||
98 | /* USB */ | 98 | int r8a7778_usb_phy_power(bool enable) |
99 | static struct usb_phy *phy; | 99 | { |
100 | static struct usb_phy *phy = NULL; | ||
101 | int ret = 0; | ||
102 | |||
103 | if (!phy) | ||
104 | phy = usb_get_phy(USB_PHY_TYPE_USB2); | ||
105 | |||
106 | if (IS_ERR(phy)) { | ||
107 | pr_err("kernel doesn't have usb phy driver\n"); | ||
108 | return PTR_ERR(phy); | ||
109 | } | ||
110 | |||
111 | if (enable) | ||
112 | ret = usb_phy_init(phy); | ||
113 | else | ||
114 | usb_phy_shutdown(phy); | ||
100 | 115 | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | /* USB */ | ||
101 | static int usb_power_on(struct platform_device *pdev) | 120 | static int usb_power_on(struct platform_device *pdev) |
102 | { | 121 | { |
103 | if (IS_ERR(phy)) | 122 | int ret = r8a7778_usb_phy_power(true); |
104 | return PTR_ERR(phy); | 123 | |
124 | if (ret) | ||
125 | return ret; | ||
105 | 126 | ||
106 | pm_runtime_enable(&pdev->dev); | 127 | pm_runtime_enable(&pdev->dev); |
107 | pm_runtime_get_sync(&pdev->dev); | 128 | pm_runtime_get_sync(&pdev->dev); |
108 | 129 | ||
109 | usb_phy_init(phy); | ||
110 | |||
111 | return 0; | 130 | return 0; |
112 | } | 131 | } |
113 | 132 | ||
114 | static void usb_power_off(struct platform_device *pdev) | 133 | static void usb_power_off(struct platform_device *pdev) |
115 | { | 134 | { |
116 | if (IS_ERR(phy)) | 135 | if (r8a7778_usb_phy_power(false)) |
117 | return; | 136 | return; |
118 | 137 | ||
119 | usb_phy_shutdown(phy); | ||
120 | |||
121 | pm_runtime_put_sync(&pdev->dev); | 138 | pm_runtime_put_sync(&pdev->dev); |
122 | pm_runtime_disable(&pdev->dev); | 139 | pm_runtime_disable(&pdev->dev); |
123 | } | 140 | } |
@@ -353,8 +370,6 @@ void __init r8a7778_add_standard_devices(void) | |||
353 | 370 | ||
354 | void __init r8a7778_init_late(void) | 371 | void __init r8a7778_init_late(void) |
355 | { | 372 | { |
356 | phy = usb_get_phy(USB_PHY_TYPE_USB2); | ||
357 | |||
358 | platform_device_register_full(&ehci_info); | 373 | platform_device_register_full(&ehci_info); |
359 | platform_device_register_full(&ohci_info); | 374 | platform_device_register_full(&ohci_info); |
360 | } | 375 | } |
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c new file mode 100644 index 000000000000..b56399d2e1de --- /dev/null +++ b/arch/arm/mach-shmobile/setup-r8a7791.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * r8a7791 processor support | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Electronics Corporation | ||
5 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
6 | * Copyright (C) 2013 Magnus Damm | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/irq.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/of_platform.h> | ||
25 | #include <linux/serial_sci.h> | ||
26 | #include <linux/sh_timer.h> | ||
27 | #include <mach/common.h> | ||
28 | #include <mach/irqs.h> | ||
29 | #include <mach/r8a7791.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | |||
32 | #define SCIF_COMMON(scif_type, baseaddr, irq) \ | ||
33 | .type = scif_type, \ | ||
34 | .mapbase = baseaddr, \ | ||
35 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ | ||
36 | .irqs = SCIx_IRQ_MUXED(irq) | ||
37 | |||
38 | #define SCIFA_DATA(index, baseaddr, irq) \ | ||
39 | [index] = { \ | ||
40 | SCIF_COMMON(PORT_SCIFA, baseaddr, irq), \ | ||
41 | .scbrr_algo_id = SCBRR_ALGO_4, \ | ||
42 | .scscr = SCSCR_RE | SCSCR_TE, \ | ||
43 | } | ||
44 | |||
45 | #define SCIFB_DATA(index, baseaddr, irq) \ | ||
46 | [index] = { \ | ||
47 | SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \ | ||
48 | .scbrr_algo_id = SCBRR_ALGO_4, \ | ||
49 | .scscr = SCSCR_RE | SCSCR_TE, \ | ||
50 | } | ||
51 | |||
52 | #define SCIF_DATA(index, baseaddr, irq) \ | ||
53 | [index] = { \ | ||
54 | SCIF_COMMON(PORT_SCIF, baseaddr, irq), \ | ||
55 | .scbrr_algo_id = SCBRR_ALGO_2, \ | ||
56 | .scscr = SCSCR_RE | SCSCR_TE, \ | ||
57 | } | ||
58 | |||
59 | #define HSCIF_DATA(index, baseaddr, irq) \ | ||
60 | [index] = { \ | ||
61 | SCIF_COMMON(PORT_HSCIF, baseaddr, irq), \ | ||
62 | .scbrr_algo_id = SCBRR_ALGO_6, \ | ||
63 | .scscr = SCSCR_RE | SCSCR_TE, \ | ||
64 | } | ||
65 | |||
66 | enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1, | ||
67 | SCIF2, SCIF3, SCIF4, SCIF5, SCIFA3, SCIFA4, SCIFA5 }; | ||
68 | |||
69 | static const struct plat_sci_port scif[] __initconst = { | ||
70 | SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ | ||
71 | SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ | ||
72 | SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ | ||
73 | SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ | ||
74 | SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ | ||
75 | SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */ | ||
76 | SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */ | ||
77 | SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */ | ||
78 | SCIF_DATA(SCIF2, 0xe6e58000, gic_spi(22)), /* SCIF2 */ | ||
79 | SCIF_DATA(SCIF3, 0xe6ea8000, gic_spi(23)), /* SCIF3 */ | ||
80 | SCIF_DATA(SCIF4, 0xe6ee0000, gic_spi(24)), /* SCIF4 */ | ||
81 | SCIF_DATA(SCIF5, 0xe6ee8000, gic_spi(25)), /* SCIF5 */ | ||
82 | SCIFA_DATA(SCIFA3, 0xe6c70000, gic_spi(29)), /* SCIFA3 */ | ||
83 | SCIFA_DATA(SCIFA4, 0xe6c78000, gic_spi(30)), /* SCIFA4 */ | ||
84 | SCIFA_DATA(SCIFA5, 0xe6c80000, gic_spi(31)), /* SCIFA5 */ | ||
85 | }; | ||
86 | |||
87 | static inline void r8a7791_register_scif(int idx) | ||
88 | { | ||
89 | platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx], | ||
90 | sizeof(struct plat_sci_port)); | ||
91 | } | ||
92 | |||
93 | static const struct sh_timer_config cmt00_platform_data __initconst = { | ||
94 | .name = "CMT00", | ||
95 | .timer_bit = 0, | ||
96 | .clockevent_rating = 80, | ||
97 | }; | ||
98 | |||
99 | static const struct resource cmt00_resources[] __initconst = { | ||
100 | DEFINE_RES_MEM(0xffca0510, 0x0c), | ||
101 | DEFINE_RES_MEM(0xffca0500, 0x04), | ||
102 | DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */ | ||
103 | }; | ||
104 | |||
105 | #define r8a7791_register_cmt(idx) \ | ||
106 | platform_device_register_resndata(&platform_bus, "sh_cmt", \ | ||
107 | idx, cmt##idx##_resources, \ | ||
108 | ARRAY_SIZE(cmt##idx##_resources), \ | ||
109 | &cmt##idx##_platform_data, \ | ||
110 | sizeof(struct sh_timer_config)) | ||
111 | |||
112 | void __init r8a7791_add_dt_devices(void) | ||
113 | { | ||
114 | r8a7791_register_scif(SCIFA0); | ||
115 | r8a7791_register_scif(SCIFA1); | ||
116 | r8a7791_register_scif(SCIFB0); | ||
117 | r8a7791_register_scif(SCIFB1); | ||
118 | r8a7791_register_scif(SCIFB2); | ||
119 | r8a7791_register_scif(SCIFA2); | ||
120 | r8a7791_register_scif(SCIF0); | ||
121 | r8a7791_register_scif(SCIF1); | ||
122 | r8a7791_register_scif(SCIF2); | ||
123 | r8a7791_register_scif(SCIF3); | ||
124 | r8a7791_register_scif(SCIF4); | ||
125 | r8a7791_register_scif(SCIF5); | ||
126 | r8a7791_register_scif(SCIFA3); | ||
127 | r8a7791_register_scif(SCIFA4); | ||
128 | r8a7791_register_scif(SCIFA5); | ||
129 | r8a7791_register_cmt(00); | ||
130 | } | ||
131 | |||
132 | void __init r8a7791_init_early(void) | ||
133 | { | ||
134 | #ifndef CONFIG_ARM_ARCH_TIMER | ||
135 | shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */ | ||
136 | #endif | ||
137 | } | ||
138 | |||
139 | #ifdef CONFIG_USE_OF | ||
140 | static const char *r8a7791_boards_compat_dt[] __initdata = { | ||
141 | "renesas,r8a7791", | ||
142 | NULL, | ||
143 | }; | ||
144 | |||
145 | DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") | ||
146 | .init_early = r8a7791_init_early, | ||
147 | .dt_compat = r8a7791_boards_compat_dt, | ||
148 | MACHINE_END | ||
149 | #endif /* CONFIG_USE_OF */ | ||