aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2014-02-20 04:16:28 -0500
committerOlof Johansson <olof@lixom.net>2014-02-20 04:16:28 -0500
commitff280bceb554633429e28a80b70ba83d79c96071 (patch)
tree744a6602ed6f8f6b4aaccfe677eafb6bdf393b9c
parent22a74909b1ad9db2c05e1aa3441ec5607be4bc0c (diff)
parent03fec7dee502d43114f384a1588ce84a3c9bf38d (diff)
Merge tag 'renesas-boards2-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/boards
Merge "Second Round of Renesas ARM Based SoC Board Updates for v3.15" from Simon Horman: * r7s72100 (RZ/A1H) based Genmai board - Enable SH ethernet - Add RSPI support * r8a7791 (R-Car M2) based Koelsch board - Add QSPI support - Add I2C support - Pass SH ethernet PHY IRQ * r8a7790 (R-Car H2) based Lager board - Switch QSPI to named IRQs - Add sound support - Add USB0 cable detection workaround - Pass SH ethernet PHY IRQ * r8a7779 (R-Car H1) based Marzen board - Revert conditional selection of SMSC_PHY * r8a7778 (R-Car M1) based Bock-W board - Use wp-gpios instead of WP pin * tag 'renesas-boards2-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: ARM: shmobile: genmai: Enable r7s72100-ether ARM: shmobile: lager legacy: Switch QSPI to named IRQs ARM: shmobile: koelsch legacy: Add QSPI support ARM: shmobile: genmai legacy: Add RSPI support Revert "ARM: shmobile: marzen: Conditionally select SMSC_PHY" ARM: shmobile: lager: add sound support ARM: shmobile: Lager USB0 cable detection workaround ARM: shmobile: bockw: use wp-gpios instead of WP pin ARM: shmobile: koelsch: Add I2C support ARM: shmobile: Koelsch: pass Ether PHY IRQ ARM: shmobile: Lager: pass Ether PHY IRQ
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw-reference.dts4
-rw-r--r--arch/arm/mach-shmobile/Kconfig3
-rw-r--r--arch/arm/mach-shmobile/board-genmai.c64
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c114
-rw-r--r--arch/arm/mach-shmobile/board-lager.c131
5 files changed, 309 insertions, 7 deletions
diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index bb62c7a906f4..06cda19dac6a 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -17,6 +17,7 @@
17/dts-v1/; 17/dts-v1/;
18#include "r8a7778.dtsi" 18#include "r8a7778.dtsi"
19#include <dt-bindings/interrupt-controller/irq.h> 19#include <dt-bindings/interrupt-controller/irq.h>
20#include <dt-bindings/gpio/gpio.h>
20 21
21/ { 22/ {
22 model = "bockw"; 23 model = "bockw";
@@ -84,7 +85,7 @@
84 85
85 sdhi0_pins: sd0 { 86 sdhi0_pins: sd0 {
86 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", 87 renesas,groups = "sdhi0_data4", "sdhi0_ctrl",
87 "sdhi0_cd", "sdhi0_wp"; 88 "sdhi0_cd";
88 renesas,function = "sdhi0"; 89 renesas,function = "sdhi0";
89 }; 90 };
90 91
@@ -101,6 +102,7 @@
101 vmmc-supply = <&fixedregulator3v3>; 102 vmmc-supply = <&fixedregulator3v3>;
102 bus-width = <4>; 103 bus-width = <4>;
103 status = "okay"; 104 status = "okay";
105 wp-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
104}; 106};
105 107
106&hspi0 { 108&hspi0 {
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index d67f4b9774f6..deb6dc884bf0 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -250,7 +250,6 @@ config MACH_MARZEN
250 depends on ARCH_R8A7779 250 depends on ARCH_R8A7779
251 select ARCH_REQUIRE_GPIOLIB 251 select ARCH_REQUIRE_GPIOLIB
252 select REGULATOR_FIXED_VOLTAGE if REGULATOR 252 select REGULATOR_FIXED_VOLTAGE if REGULATOR
253 select SMSC_PHY if SMSC911X
254 select USE_OF 253 select USE_OF
255 254
256config MACH_MARZEN_REFERENCE 255config MACH_MARZEN_REFERENCE
@@ -258,7 +257,6 @@ config MACH_MARZEN_REFERENCE
258 depends on ARCH_R8A7779 257 depends on ARCH_R8A7779
259 select ARCH_REQUIRE_GPIOLIB 258 select ARCH_REQUIRE_GPIOLIB
260 select REGULATOR_FIXED_VOLTAGE if REGULATOR 259 select REGULATOR_FIXED_VOLTAGE if REGULATOR
261 select SMSC_PHY if SMSC911X
262 select USE_OF 260 select USE_OF
263 ---help--- 261 ---help---
264 Use reference implementation of Marzen board support 262 Use reference implementation of Marzen board support
@@ -272,6 +270,7 @@ config MACH_LAGER
272 depends on ARCH_R8A7790 270 depends on ARCH_R8A7790
273 select USE_OF 271 select USE_OF
274 select MICREL_PHY if SH_ETH 272 select MICREL_PHY if SH_ETH
273 select SND_SOC_AK4642 if SND_SIMPLE_CARD
275 274
276config MACH_KOELSCH 275config MACH_KOELSCH
277 bool "Koelsch board" 276 bool "Koelsch board"
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index 3e92e3c62d4c..e240980cc227 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -20,15 +20,79 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/sh_eth.h>
24#include <linux/spi/rspi.h>
25#include <linux/spi/spi.h>
23#include <mach/common.h> 26#include <mach/common.h>
27#include <mach/irqs.h>
24#include <mach/r7s72100.h> 28#include <mach/r7s72100.h>
25#include <asm/mach-types.h> 29#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
27 31
32/* Ether */
33static const struct sh_eth_plat_data ether_pdata __initconst = {
34 .phy = 0x00, /* PD60610 */
35 .edmac_endian = EDMAC_LITTLE_ENDIAN,
36 .phy_interface = PHY_INTERFACE_MODE_MII,
37 .no_ether_link = 1
38};
39
40static const struct resource ether_resources[] __initconst = {
41 DEFINE_RES_MEM(0xe8203000, 0x800),
42 DEFINE_RES_MEM(0xe8204800, 0x200),
43 DEFINE_RES_IRQ(gic_iid(359)),
44};
45
46/* RSPI */
47#define RSPI_RESOURCE(idx, baseaddr, irq) \
48static const struct resource rspi##idx##_resources[] __initconst = { \
49 DEFINE_RES_MEM(baseaddr, 0x24), \
50 DEFINE_RES_IRQ_NAMED(irq, "error"), \
51 DEFINE_RES_IRQ_NAMED(irq + 1, "rx"), \
52 DEFINE_RES_IRQ_NAMED(irq + 2, "tx"), \
53}
54
55RSPI_RESOURCE(0, 0xe800c800, gic_iid(270));
56RSPI_RESOURCE(1, 0xe800d000, gic_iid(273));
57RSPI_RESOURCE(2, 0xe800d800, gic_iid(276));
58RSPI_RESOURCE(3, 0xe800e000, gic_iid(279));
59RSPI_RESOURCE(4, 0xe800e800, gic_iid(282));
60
61static const struct rspi_plat_data rspi_pdata __initconst = {
62 .num_chipselect = 1,
63};
64
65#define r7s72100_register_rspi(idx) \
66 platform_device_register_resndata(&platform_bus, "rspi-rz", idx, \
67 rspi##idx##_resources, \
68 ARRAY_SIZE(rspi##idx##_resources), \
69 &rspi_pdata, sizeof(rspi_pdata))
70
71static const struct spi_board_info spi_info[] __initconst = {
72 {
73 .modalias = "wm8978",
74 .max_speed_hz = 5000000,
75 .bus_num = 4,
76 .chip_select = 0,
77 },
78};
79
28static void __init genmai_add_standard_devices(void) 80static void __init genmai_add_standard_devices(void)
29{ 81{
30 r7s72100_clock_init(); 82 r7s72100_clock_init();
31 r7s72100_add_dt_devices(); 83 r7s72100_add_dt_devices();
84
85 platform_device_register_resndata(&platform_bus, "r7s72100-ether", -1,
86 ether_resources,
87 ARRAY_SIZE(ether_resources),
88 &ether_pdata, sizeof(ether_pdata));
89
90 r7s72100_register_rspi(0);
91 r7s72100_register_rspi(1);
92 r7s72100_register_rspi(2);
93 r7s72100_register_rspi(3);
94 r7s72100_register_rspi(4);
95 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
32} 96}
33 97
34static const char * const genmai_boards_compat_dt[] __initconst = { 98static const char * const genmai_boards_compat_dt[] __initconst = {
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 2ab5c75ba2c2..d42637db596a 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -23,14 +23,20 @@
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/irq.h>
26#include <linux/kernel.h> 27#include <linux/kernel.h>
27#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/mtd/mtd.h>
30#include <linux/mtd/partitions.h>
28#include <linux/phy.h> 31#include <linux/phy.h>
29#include <linux/pinctrl/machine.h> 32#include <linux/pinctrl/machine.h>
30#include <linux/platform_data/gpio-rcar.h> 33#include <linux/platform_data/gpio-rcar.h>
31#include <linux/platform_data/rcar-du.h> 34#include <linux/platform_data/rcar-du.h>
32#include <linux/platform_device.h> 35#include <linux/platform_device.h>
33#include <linux/sh_eth.h> 36#include <linux/sh_eth.h>
37#include <linux/spi/flash.h>
38#include <linux/spi/rspi.h>
39#include <linux/spi/spi.h>
34#include <mach/common.h> 40#include <mach/common.h>
35#include <mach/irqs.h> 41#include <mach/irqs.h>
36#include <mach/r8a7791.h> 42#include <mach/r8a7791.h>
@@ -92,6 +98,7 @@ static void __init koelsch_add_du_device(void)
92/* Ether */ 98/* Ether */
93static const struct sh_eth_plat_data ether_pdata __initconst = { 99static const struct sh_eth_plat_data ether_pdata __initconst = {
94 .phy = 0x1, 100 .phy = 0x1,
101 .phy_irq = irq_pin(0),
95 .edmac_endian = EDMAC_LITTLE_ENDIAN, 102 .edmac_endian = EDMAC_LITTLE_ENDIAN,
96 .phy_interface = PHY_INTERFACE_MODE_RMII, 103 .phy_interface = PHY_INTERFACE_MODE_RMII,
97 .ether_link_active_low = 1, 104 .ether_link_active_low = 1,
@@ -148,6 +155,55 @@ static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
148 .nbuttons = ARRAY_SIZE(gpio_buttons), 155 .nbuttons = ARRAY_SIZE(gpio_buttons),
149}; 156};
150 157
158/* QSPI */
159static const struct resource qspi_resources[] __initconst = {
160 DEFINE_RES_MEM(0xe6b10000, 0x1000),
161 DEFINE_RES_IRQ_NAMED(gic_spi(184), "mux"),
162};
163
164static const struct rspi_plat_data qspi_pdata __initconst = {
165 .num_chipselect = 1,
166};
167
168/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64 MiB) */
169static struct mtd_partition spi_flash_part[] = {
170 {
171 .name = "loader",
172 .offset = 0x00000000,
173 .size = 512 * 1024,
174 .mask_flags = MTD_WRITEABLE,
175 },
176 {
177 .name = "bootenv",
178 .offset = MTDPART_OFS_APPEND,
179 .size = 512 * 1024,
180 .mask_flags = MTD_WRITEABLE,
181 },
182 {
183 .name = "data",
184 .offset = MTDPART_OFS_APPEND,
185 .size = MTDPART_SIZ_FULL,
186 },
187};
188
189static const struct flash_platform_data spi_flash_data = {
190 .name = "m25p80",
191 .parts = spi_flash_part,
192 .nr_parts = ARRAY_SIZE(spi_flash_part),
193 .type = "s25fl512s",
194};
195
196static const struct spi_board_info spi_info[] __initconst = {
197 {
198 .modalias = "m25p80",
199 .platform_data = &spi_flash_data,
200 .mode = SPI_MODE_0,
201 .max_speed_hz = 30000000,
202 .bus_num = 0,
203 .chip_select = 0,
204 },
205};
206
151/* SATA0 */ 207/* SATA0 */
152static const struct resource sata0_resources[] __initconst = { 208static const struct resource sata0_resources[] __initconst = {
153 DEFINE_RES_MEM(0xee300000, 0x2000), 209 DEFINE_RES_MEM(0xee300000, 0x2000),
@@ -163,6 +219,38 @@ static const struct platform_device_info sata0_info __initconst = {
163 .dma_mask = DMA_BIT_MASK(32), 219 .dma_mask = DMA_BIT_MASK(32),
164}; 220};
165 221
222/* I2C */
223static const struct resource i2c_resources[] __initconst = {
224 /* I2C0 */
225 DEFINE_RES_MEM(0xE6508000, 0x40),
226 DEFINE_RES_IRQ(gic_spi(287)),
227 /* I2C1 */
228 DEFINE_RES_MEM(0xE6518000, 0x40),
229 DEFINE_RES_IRQ(gic_spi(288)),
230 /* I2C2 */
231 DEFINE_RES_MEM(0xE6530000, 0x40),
232 DEFINE_RES_IRQ(gic_spi(286)),
233 /* I2C3 */
234 DEFINE_RES_MEM(0xE6540000, 0x40),
235 DEFINE_RES_IRQ(gic_spi(290)),
236 /* I2C4 */
237 DEFINE_RES_MEM(0xE6520000, 0x40),
238 DEFINE_RES_IRQ(gic_spi(19)),
239 /* I2C5 */
240 DEFINE_RES_MEM(0xE6528000, 0x40),
241 DEFINE_RES_IRQ(gic_spi(20)),
242};
243
244static void __init koelsch_add_i2c(unsigned idx)
245{
246 unsigned res_idx = idx * 2;
247
248 BUG_ON(res_idx >= ARRAY_SIZE(i2c_resources));
249
250 platform_device_register_simple("i2c-rcar_gen2", idx,
251 i2c_resources + res_idx, 2);
252}
253
166static const struct pinctrl_map koelsch_pinctrl_map[] = { 254static const struct pinctrl_map koelsch_pinctrl_map[] = {
167 /* DU */ 255 /* DU */
168 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791", 256 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
@@ -180,12 +268,26 @@ static const struct pinctrl_map koelsch_pinctrl_map[] = {
180 "eth_rmii", "eth"), 268 "eth_rmii", "eth"),
181 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791", 269 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
182 "intc_irq0", "intc"), 270 "intc_irq0", "intc"),
271 /* QSPI */
272 PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
273 "qspi_ctrl", "qspi"),
274 PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
275 "qspi_data4", "qspi"),
183 /* SCIF0 (CN19: DEBUG SERIAL0) */ 276 /* SCIF0 (CN19: DEBUG SERIAL0) */
184 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791", 277 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791",
185 "scif0_data_d", "scif0"), 278 "scif0_data_d", "scif0"),
186 /* SCIF1 (CN20: DEBUG SERIAL1) */ 279 /* SCIF1 (CN20: DEBUG SERIAL1) */
187 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791", 280 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
188 "scif1_data_d", "scif1"), 281 "scif1_data_d", "scif1"),
282 /* I2C1 */
283 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.1", "pfc-r8a7791",
284 "i2c1_e", "i2c1"),
285 /* I2C2 */
286 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.2", "pfc-r8a7791",
287 "i2c2", "i2c2"),
288 /* I2C4 */
289 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
290 "i2c4_c", "i2c4"),
189}; 291};
190 292
191static void __init koelsch_add_standard_devices(void) 293static void __init koelsch_add_standard_devices(void)
@@ -205,10 +307,20 @@ static void __init koelsch_add_standard_devices(void)
205 platform_device_register_data(&platform_bus, "gpio-keys", -1, 307 platform_device_register_data(&platform_bus, "gpio-keys", -1,
206 &koelsch_keys_pdata, 308 &koelsch_keys_pdata,
207 sizeof(koelsch_keys_pdata)); 309 sizeof(koelsch_keys_pdata));
310 platform_device_register_resndata(&platform_bus, "qspi", 0,
311 qspi_resources,
312 ARRAY_SIZE(qspi_resources),
313 &qspi_pdata, sizeof(qspi_pdata));
314 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
208 315
209 koelsch_add_du_device(); 316 koelsch_add_du_device();
210 317
211 platform_device_register_full(&sata0_info); 318 platform_device_register_full(&sata0_info);
319
320 koelsch_add_i2c(1);
321 koelsch_add_i2c(2);
322 koelsch_add_i2c(4);
323 koelsch_add_i2c(5);
212} 324}
213 325
214/* 326/*
@@ -232,6 +344,8 @@ static void __init koelsch_init(void)
232{ 344{
233 koelsch_add_standard_devices(); 345 koelsch_add_standard_devices();
234 346
347 irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW);
348
235 if (IS_ENABLED(CONFIG_PHYLIB)) 349 if (IS_ENABLED(CONFIG_PHYLIB))
236 phy_register_fixup_for_id("r8a7791-ether-ff:01", 350 phy_register_fixup_for_id("r8a7791-ether-ff:01",
237 koelsch_ksz8041_fixup); 351 koelsch_ksz8041_fixup);
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index fdcc868de1fa..317574864e7b 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -20,8 +20,10 @@
20 20
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/gpio_keys.h> 22#include <linux/gpio_keys.h>
23#include <linux/i2c.h>
23#include <linux/input.h> 24#include <linux/input.h>
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h>
25#include <linux/kernel.h> 27#include <linux/kernel.h>
26#include <linux/leds.h> 28#include <linux/leds.h>
27#include <linux/mmc/host.h> 29#include <linux/mmc/host.h>
@@ -51,6 +53,20 @@
51#include <linux/spi/flash.h> 53#include <linux/spi/flash.h>
52#include <linux/spi/rspi.h> 54#include <linux/spi/rspi.h>
53#include <linux/spi/spi.h> 55#include <linux/spi/spi.h>
56#include <sound/rcar_snd.h>
57#include <sound/simple_card.h>
58
59/*
60 * SSI-AK4643
61 *
62 * SW1: 1: AK4643
63 * 2: CN22
64 * 3: ADV7511
65 *
66 * this command is required when playback.
67 *
68 * # amixer set "LINEOUT Mixer DACL" on
69 */
54 70
55/* DU */ 71/* DU */
56static struct rcar_du_encoder_data lager_du_encoders[] = { 72static struct rcar_du_encoder_data lager_du_encoders[] = {
@@ -233,6 +249,7 @@ static const struct resource mmcif1_resources[] __initconst = {
233/* Ether */ 249/* Ether */
234static const struct sh_eth_plat_data ether_pdata __initconst = { 250static const struct sh_eth_plat_data ether_pdata __initconst = {
235 .phy = 0x1, 251 .phy = 0x1,
252 .phy_irq = irq_pin(0),
236 .edmac_endian = EDMAC_LITTLE_ENDIAN, 253 .edmac_endian = EDMAC_LITTLE_ENDIAN,
237 .phy_interface = PHY_INTERFACE_MODE_RMII, 254 .phy_interface = PHY_INTERFACE_MODE_RMII,
238 .ether_link_active_low = 1, 255 .ether_link_active_low = 1,
@@ -293,7 +310,7 @@ static const struct spi_board_info spi_info[] __initconst = {
293/* QSPI resource */ 310/* QSPI resource */
294static const struct resource qspi_resources[] __initconst = { 311static const struct resource qspi_resources[] __initconst = {
295 DEFINE_RES_MEM(0xe6b10000, 0x1000), 312 DEFINE_RES_MEM(0xe6b10000, 0x1000),
296 DEFINE_RES_IRQ(gic_spi(184)), 313 DEFINE_RES_IRQ_NAMED(gic_spi(184), "mux"),
297}; 314};
298 315
299/* VIN */ 316/* VIN */
@@ -406,13 +423,30 @@ static int usbhs_hardware_init(struct platform_device *pdev)
406{ 423{
407 struct usbhs_private *priv = usbhs_get_priv(pdev); 424 struct usbhs_private *priv = usbhs_get_priv(pdev);
408 struct usb_phy *phy; 425 struct usb_phy *phy;
426 int ret;
427
428 /* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5
429 * setting to avoid VBUS short circuit due to wrong cable.
430 * PWEN should be pulled up high if USB Function is selected by SW5
431 */
432 gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */
433 if (!gpio_get_value(RCAR_GP_PIN(5, 18))) {
434 pr_warn("Error: USB Function not selected - check SW5 + SW6\n");
435 ret = -ENOTSUPP;
436 goto error;
437 }
409 438
410 phy = usb_get_phy_dev(&pdev->dev, 0); 439 phy = usb_get_phy_dev(&pdev->dev, 0);
411 if (IS_ERR(phy)) 440 if (IS_ERR(phy)) {
412 return PTR_ERR(phy); 441 ret = PTR_ERR(phy);
442 goto error;
443 }
413 444
414 priv->phy = phy; 445 priv->phy = phy;
415 return 0; 446 return 0;
447 error:
448 gpio_free(RCAR_GP_PIN(5, 18));
449 return ret;
416} 450}
417 451
418static int usbhs_hardware_exit(struct platform_device *pdev) 452static int usbhs_hardware_exit(struct platform_device *pdev)
@@ -424,6 +458,8 @@ static int usbhs_hardware_exit(struct platform_device *pdev)
424 458
425 usb_put_phy(priv->phy); 459 usb_put_phy(priv->phy);
426 priv->phy = NULL; 460 priv->phy = NULL;
461
462 gpio_free(RCAR_GP_PIN(5, 18));
427 return 0; 463 return 0;
428} 464}
429 465
@@ -488,6 +524,77 @@ static const struct resource usbhs_phy_resources[] __initconst = {
488 DEFINE_RES_MEM(0xe6590100, 0x100), 524 DEFINE_RES_MEM(0xe6590100, 0x100),
489}; 525};
490 526
527/* I2C */
528static struct i2c_board_info i2c2_devices[] = {
529 {
530 I2C_BOARD_INFO("ak4643", 0x12),
531 }
532};
533
534/* Sound */
535static struct resource rsnd_resources[] __initdata = {
536 [RSND_GEN2_SCU] = DEFINE_RES_MEM(0xec500000, 0x1000),
537 [RSND_GEN2_ADG] = DEFINE_RES_MEM(0xec5a0000, 0x100),
538 [RSND_GEN2_SSIU] = DEFINE_RES_MEM(0xec540000, 0x1000),
539 [RSND_GEN2_SSI] = DEFINE_RES_MEM(0xec541000, 0x1280),
540};
541
542static struct rsnd_ssi_platform_info rsnd_ssi[] = {
543 RSND_SSI_SET(0, 0, gic_spi(370), RSND_SSI_PLAY),
544 RSND_SSI_SET(0, 0, gic_spi(371), RSND_SSI_CLK_PIN_SHARE),
545};
546
547static struct rsnd_scu_platform_info rsnd_scu[2] = {
548 /* no member at this point */
549};
550
551static struct rcar_snd_info rsnd_info = {
552 .flags = RSND_GEN2,
553 .ssi_info = rsnd_ssi,
554 .ssi_info_nr = ARRAY_SIZE(rsnd_ssi),
555 .scu_info = rsnd_scu,
556 .scu_info_nr = ARRAY_SIZE(rsnd_scu),
557};
558
559static struct asoc_simple_card_info rsnd_card_info = {
560 .name = "AK4643",
561 .card = "SSI01-AK4643",
562 .codec = "ak4642-codec.2-0012",
563 .platform = "rcar_sound",
564 .daifmt = SND_SOC_DAIFMT_LEFT_J,
565 .cpu_dai = {
566 .name = "rcar_sound",
567 .fmt = SND_SOC_DAIFMT_CBS_CFS,
568 },
569 .codec_dai = {
570 .name = "ak4642-hifi",
571 .fmt = SND_SOC_DAIFMT_CBM_CFM,
572 .sysclk = 11289600,
573 },
574};
575
576static void __init lager_add_rsnd_device(void)
577{
578 struct platform_device_info cardinfo = {
579 .parent = &platform_bus,
580 .name = "asoc-simple-card",
581 .id = -1,
582 .data = &rsnd_card_info,
583 .size_data = sizeof(struct asoc_simple_card_info),
584 .dma_mask = DMA_BIT_MASK(32),
585 };
586
587 i2c_register_board_info(2, i2c2_devices,
588 ARRAY_SIZE(i2c2_devices));
589
590 platform_device_register_resndata(
591 &platform_bus, "rcar_sound", -1,
592 rsnd_resources, ARRAY_SIZE(rsnd_resources),
593 &rsnd_info, sizeof(rsnd_info));
594
595 platform_device_register_full(&cardinfo);
596}
597
491static const struct pinctrl_map lager_pinctrl_map[] = { 598static const struct pinctrl_map lager_pinctrl_map[] = {
492 /* DU (CN10: ARGB0, CN13: LVDS) */ 599 /* DU (CN10: ARGB0, CN13: LVDS) */
493 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", 600 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -496,12 +603,24 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
496 "du_sync_1", "du"), 603 "du_sync_1", "du"),
497 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", 604 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
498 "du_clk_out_0", "du"), 605 "du_clk_out_0", "du"),
606 /* I2C2 */
607 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar.2", "pfc-r8a7790",
608 "i2c2", "i2c2"),
499 /* SCIF0 (CN19: DEBUG SERIAL0) */ 609 /* SCIF0 (CN19: DEBUG SERIAL0) */
500 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", 610 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
501 "scif0_data", "scif0"), 611 "scif0_data", "scif0"),
502 /* SCIF1 (CN20: DEBUG SERIAL1) */ 612 /* SCIF1 (CN20: DEBUG SERIAL1) */
503 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790", 613 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790",
504 "scif1_data", "scif1"), 614 "scif1_data", "scif1"),
615 /* SSI (CN17: sound) */
616 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
617 "ssi0129_ctrl", "ssi"),
618 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
619 "ssi0_data", "ssi"),
620 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
621 "ssi1_data", "ssi"),
622 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
623 "audio_clk_a", "audio_clk"),
505 /* MMCIF1 */ 624 /* MMCIF1 */
506 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.1", "pfc-r8a7790", 625 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.1", "pfc-r8a7790",
507 "mmc1_data8", "mmc1"), 626 "mmc1_data8", "mmc1"),
@@ -534,7 +653,7 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
534 "vin1_clk", "vin1"), 653 "vin1_clk", "vin1"),
535 /* USB0 */ 654 /* USB0 */
536 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790", 655 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
537 "usb0", "usb0"), 656 "usb0_ovc_vbus", "usb0"),
538}; 657};
539 658
540static void __init lager_add_standard_devices(void) 659static void __init lager_add_standard_devices(void)
@@ -595,6 +714,8 @@ static void __init lager_add_standard_devices(void)
595 &usbhs_phy_pdata, 714 &usbhs_phy_pdata,
596 sizeof(usbhs_phy_pdata)); 715 sizeof(usbhs_phy_pdata));
597 lager_register_usbhs(); 716 lager_register_usbhs();
717
718 lager_add_rsnd_device();
598} 719}
599 720
600/* 721/*
@@ -618,6 +739,8 @@ static void __init lager_init(void)
618{ 739{
619 lager_add_standard_devices(); 740 lager_add_standard_devices();
620 741
742 irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW);
743
621 if (IS_ENABLED(CONFIG_PHYLIB)) 744 if (IS_ENABLED(CONFIG_PHYLIB))
622 phy_register_fixup_for_id("r8a7790-ether-ff:01", 745 phy_register_fixup_for_id("r8a7790-ether-ff:01",
623 lager_ksz8041_fixup); 746 lager_ksz8041_fixup);