ARM: shmobile: Add SDHI devices for legacy Koelsch
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / arm / mach-shmobile / board-koelsch.c
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/dma-mapping.h>
23 #include <linux/gpio.h>
24 #include <linux/gpio_keys.h>
25 #include <linux/input.h>
26 #include <linux/irq.h>
27 #include <linux/kernel.h>
28 #include <linux/leds.h>
29 #include <linux/mfd/tmio.h>
30 #include <linux/mmc/host.h>
31 #include <linux/mmc/sh_mobile_sdhi.h>
32 #include <linux/mtd/mtd.h>
33 #include <linux/mtd/partitions.h>
34 #include <linux/phy.h>
35 #include <linux/pinctrl/machine.h>
36 #include <linux/platform_data/gpio-rcar.h>
37 #include <linux/platform_data/rcar-du.h>
38 #include <linux/platform_device.h>
39 #include <linux/regulator/driver.h>
40 #include <linux/regulator/fixed.h>
41 #include <linux/regulator/gpio-regulator.h>
42 #include <linux/regulator/machine.h>
43 #include <linux/sh_eth.h>
44 #include <linux/spi/flash.h>
45 #include <linux/spi/rspi.h>
46 #include <linux/spi/spi.h>
47 #include <mach/common.h>
48 #include <mach/irqs.h>
49 #include <mach/r8a7791.h>
50 #include <mach/rcar-gen2.h>
51 #include <asm/mach-types.h>
52 #include <asm/mach/arch.h>
53
54 /* DU */
55 static struct rcar_du_encoder_data koelsch_du_encoders[] = {
56         {
57                 .type = RCAR_DU_ENCODER_NONE,
58                 .output = RCAR_DU_OUTPUT_LVDS0,
59                 .connector.lvds.panel = {
60                         .width_mm = 210,
61                         .height_mm = 158,
62                         .mode = {
63                                 .clock = 65000,
64                                 .hdisplay = 1024,
65                                 .hsync_start = 1048,
66                                 .hsync_end = 1184,
67                                 .htotal = 1344,
68                                 .vdisplay = 768,
69                                 .vsync_start = 771,
70                                 .vsync_end = 777,
71                                 .vtotal = 806,
72                                 .flags = 0,
73                         },
74                 },
75         },
76 };
77
78 static const struct rcar_du_platform_data koelsch_du_pdata __initconst = {
79         .encoders = koelsch_du_encoders,
80         .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
81 };
82
83 static const struct resource du_resources[] __initconst = {
84         DEFINE_RES_MEM(0xfeb00000, 0x40000),
85         DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
86         DEFINE_RES_IRQ(gic_spi(256)),
87         DEFINE_RES_IRQ(gic_spi(268)),
88 };
89
90 static void __init koelsch_add_du_device(void)
91 {
92         struct platform_device_info info = {
93                 .name = "rcar-du-r8a7791",
94                 .id = -1,
95                 .res = du_resources,
96                 .num_res = ARRAY_SIZE(du_resources),
97                 .data = &koelsch_du_pdata,
98                 .size_data = sizeof(koelsch_du_pdata),
99                 .dma_mask = DMA_BIT_MASK(32),
100         };
101
102         platform_device_register_full(&info);
103 }
104
105 /* Ether */
106 static const struct sh_eth_plat_data ether_pdata __initconst = {
107         .phy                    = 0x1,
108         .phy_irq                = irq_pin(0),
109         .edmac_endian           = EDMAC_LITTLE_ENDIAN,
110         .phy_interface          = PHY_INTERFACE_MODE_RMII,
111         .ether_link_active_low  = 1,
112 };
113
114 static const struct resource ether_resources[] __initconst = {
115         DEFINE_RES_MEM(0xee700000, 0x400),
116         DEFINE_RES_IRQ(gic_spi(162)),
117 };
118
119 /* LEDS */
120 static struct gpio_led koelsch_leds[] = {
121         {
122                 .name           = "led8",
123                 .gpio           = RCAR_GP_PIN(2, 21),
124                 .default_state  = LEDS_GPIO_DEFSTATE_ON,
125         }, {
126                 .name           = "led7",
127                 .gpio           = RCAR_GP_PIN(2, 20),
128                 .default_state  = LEDS_GPIO_DEFSTATE_ON,
129         }, {
130                 .name           = "led6",
131                 .gpio           = RCAR_GP_PIN(2, 19),
132                 .default_state  = LEDS_GPIO_DEFSTATE_ON,
133         },
134 };
135
136 static const struct gpio_led_platform_data koelsch_leds_pdata __initconst = {
137         .leds           = koelsch_leds,
138         .num_leds       = ARRAY_SIZE(koelsch_leds),
139 };
140
141 /* GPIO KEY */
142 #define GPIO_KEY(c, g, d, ...) \
143         { .code = c, .gpio = g, .desc = d, .active_low = 1, \
144           .wakeup = 1, .debounce_interval = 20 }
145
146 static struct gpio_keys_button gpio_buttons[] = {
147         GPIO_KEY(KEY_4,         RCAR_GP_PIN(5, 3),      "SW2-pin4"),
148         GPIO_KEY(KEY_3,         RCAR_GP_PIN(5, 2),      "SW2-pin3"),
149         GPIO_KEY(KEY_2,         RCAR_GP_PIN(5, 1),      "SW2-pin2"),
150         GPIO_KEY(KEY_1,         RCAR_GP_PIN(5, 0),      "SW2-pin1"),
151         GPIO_KEY(KEY_G,         RCAR_GP_PIN(7, 6),      "SW36"),
152         GPIO_KEY(KEY_F,         RCAR_GP_PIN(7, 5),      "SW35"),
153         GPIO_KEY(KEY_E,         RCAR_GP_PIN(7, 4),      "SW34"),
154         GPIO_KEY(KEY_D,         RCAR_GP_PIN(7, 3),      "SW33"),
155         GPIO_KEY(KEY_C,         RCAR_GP_PIN(7, 2),      "SW32"),
156         GPIO_KEY(KEY_B,         RCAR_GP_PIN(7, 1),      "SW31"),
157         GPIO_KEY(KEY_A,         RCAR_GP_PIN(7, 0),      "SW30"),
158 };
159
160 static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
161         .buttons        = gpio_buttons,
162         .nbuttons       = ARRAY_SIZE(gpio_buttons),
163 };
164
165 /* QSPI */
166 static const struct resource qspi_resources[] __initconst = {
167         DEFINE_RES_MEM(0xe6b10000, 0x1000),
168         DEFINE_RES_IRQ_NAMED(gic_spi(184), "mux"),
169 };
170
171 static const struct rspi_plat_data qspi_pdata __initconst = {
172         .num_chipselect = 1,
173 };
174
175 /* SPI Flash memory (Spansion S25FL512SAGMFIG11 64 MiB) */
176 static struct mtd_partition spi_flash_part[] = {
177         {
178                 .name           = "loader",
179                 .offset         = 0x00000000,
180                 .size           = 512 * 1024,
181                 .mask_flags     = MTD_WRITEABLE,
182         },
183         {
184                 .name           = "bootenv",
185                 .offset         = MTDPART_OFS_APPEND,
186                 .size           = 512 * 1024,
187                 .mask_flags     = MTD_WRITEABLE,
188         },
189         {
190                 .name           = "data",
191                 .offset         = MTDPART_OFS_APPEND,
192                 .size           = MTDPART_SIZ_FULL,
193         },
194 };
195
196 static const struct flash_platform_data spi_flash_data = {
197         .name           = "m25p80",
198         .parts          = spi_flash_part,
199         .nr_parts       = ARRAY_SIZE(spi_flash_part),
200         .type           = "s25fl512s",
201 };
202
203 static const struct spi_board_info spi_info[] __initconst = {
204         {
205                 .modalias       = "m25p80",
206                 .platform_data  = &spi_flash_data,
207                 .mode           = SPI_MODE_0,
208                 .max_speed_hz   = 30000000,
209                 .bus_num        = 0,
210                 .chip_select    = 0,
211         },
212 };
213
214 /* SATA0 */
215 static const struct resource sata0_resources[] __initconst = {
216         DEFINE_RES_MEM(0xee300000, 0x2000),
217         DEFINE_RES_IRQ(gic_spi(105)),
218 };
219
220 static const struct platform_device_info sata0_info __initconst = {
221         .parent         = &platform_bus,
222         .name           = "sata-r8a7791",
223         .id             = 0,
224         .res            = sata0_resources,
225         .num_res        = ARRAY_SIZE(sata0_resources),
226         .dma_mask       = DMA_BIT_MASK(32),
227 };
228
229 /* I2C */
230 static const struct resource i2c_resources[] __initconst = {
231         /* I2C0 */
232         DEFINE_RES_MEM(0xE6508000, 0x40),
233         DEFINE_RES_IRQ(gic_spi(287)),
234         /* I2C1 */
235         DEFINE_RES_MEM(0xE6518000, 0x40),
236         DEFINE_RES_IRQ(gic_spi(288)),
237         /* I2C2 */
238         DEFINE_RES_MEM(0xE6530000, 0x40),
239         DEFINE_RES_IRQ(gic_spi(286)),
240         /* I2C3 */
241         DEFINE_RES_MEM(0xE6540000, 0x40),
242         DEFINE_RES_IRQ(gic_spi(290)),
243         /* I2C4 */
244         DEFINE_RES_MEM(0xE6520000, 0x40),
245         DEFINE_RES_IRQ(gic_spi(19)),
246         /* I2C5 */
247         DEFINE_RES_MEM(0xE6528000, 0x40),
248         DEFINE_RES_IRQ(gic_spi(20)),
249 };
250
251 static void __init koelsch_add_i2c(unsigned idx)
252 {
253         unsigned res_idx = idx * 2;
254
255         BUG_ON(res_idx >= ARRAY_SIZE(i2c_resources));
256
257         platform_device_register_simple("i2c-rcar_gen2", idx,
258                                         i2c_resources + res_idx, 2);
259 }
260
261 #define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)                          \
262 static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =      \
263         REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);               \
264                                                                         \
265 static struct regulator_init_data vcc_sdhi##idx##_init_data = {         \
266         .constraints = {                                                \
267                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,              \
268         },                                                              \
269         .consumer_supplies      = &vcc_sdhi##idx##_consumer,            \
270         .num_consumer_supplies  = 1,                                    \
271 };                                                                      \
272                                                                         \
273 static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
274         .supply_name    = "SDHI" #idx "Vcc",                            \
275         .microvolts     = 3300000,                                      \
276         .gpio           = vdd_pin,                                      \
277         .enable_high    = 1,                                            \
278         .init_data      = &vcc_sdhi##idx##_init_data,                   \
279 };                                                                      \
280                                                                         \
281 static struct regulator_consumer_supply vccq_sdhi##idx##_consumer =     \
282         REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);              \
283                                                                         \
284 static struct regulator_init_data vccq_sdhi##idx##_init_data = {        \
285         .constraints = {                                                \
286                 .input_uV       = 3300000,                              \
287                 .min_uV         = 1800000,                              \
288                 .max_uV         = 3300000,                              \
289                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |            \
290                                   REGULATOR_CHANGE_STATUS,              \
291         },                                                              \
292         .consumer_supplies      = &vccq_sdhi##idx##_consumer,           \
293         .num_consumer_supplies  = 1,                                    \
294 };                                                                      \
295                                                                         \
296 static struct gpio vccq_sdhi##idx##_gpio =                              \
297         { vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };            \
298                                                                         \
299 static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {        \
300         { .value = 1800000, .gpios = 0 },                               \
301         { .value = 3300000, .gpios = 1 },                               \
302 };                                                                      \
303                                                                         \
304 static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
305         .supply_name    = "vqmmc",                                      \
306         .gpios          = &vccq_sdhi##idx##_gpio,                       \
307         .nr_gpios       = 1,                                            \
308         .states         = vccq_sdhi##idx##_states,                      \
309         .nr_states      = ARRAY_SIZE(vccq_sdhi##idx##_states),          \
310         .type           = REGULATOR_VOLTAGE,                            \
311         .init_data      = &vccq_sdhi##idx##_init_data,                  \
312 };
313
314 SDHI_REGULATOR(0, RCAR_GP_PIN(7, 17), RCAR_GP_PIN(2, 12));
315 SDHI_REGULATOR(1, RCAR_GP_PIN(7, 18), RCAR_GP_PIN(2, 13));
316 SDHI_REGULATOR(2, RCAR_GP_PIN(7, 19), RCAR_GP_PIN(2, 26));
317
318 /* SDHI0 */
319 static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
320         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
321                           MMC_CAP_POWER_OFF_CARD,
322         .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
323         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT,
324 };
325
326 static struct resource sdhi0_resources[] __initdata = {
327         DEFINE_RES_MEM(0xee100000, 0x200),
328         DEFINE_RES_IRQ(gic_spi(165)),
329 };
330
331 /* SDHI1 */
332 static struct sh_mobile_sdhi_info sdhi1_info __initdata = {
333         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
334                           MMC_CAP_POWER_OFF_CARD,
335         .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
336         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT,
337 };
338
339 static struct resource sdhi1_resources[] __initdata = {
340         DEFINE_RES_MEM(0xee140000, 0x100),
341         DEFINE_RES_IRQ(gic_spi(167)),
342 };
343
344 /* SDHI2 */
345 static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
346         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
347                           MMC_CAP_POWER_OFF_CARD,
348         .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
349         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT |
350                           TMIO_MMC_WRPROTECT_DISABLE,
351 };
352
353 static struct resource sdhi2_resources[] __initdata = {
354         DEFINE_RES_MEM(0xee160000, 0x100),
355         DEFINE_RES_IRQ(gic_spi(168)),
356 };
357
358 static const struct pinctrl_map koelsch_pinctrl_map[] = {
359         /* DU */
360         PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
361                                   "du_rgb666", "du"),
362         PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
363                                   "du_sync", "du"),
364         PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
365                                   "du_clk_out_0", "du"),
366         /* Ether */
367         PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
368                                   "eth_link", "eth"),
369         PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
370                                   "eth_mdio", "eth"),
371         PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
372                                   "eth_rmii", "eth"),
373         PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
374                                   "intc_irq0", "intc"),
375         /* QSPI */
376         PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
377                                   "qspi_ctrl", "qspi"),
378         PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
379                                   "qspi_data4", "qspi"),
380         /* SCIF0 (CN19: DEBUG SERIAL0) */
381         PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791",
382                                   "scif0_data_d", "scif0"),
383         /* SCIF1 (CN20: DEBUG SERIAL1) */
384         PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
385                                   "scif1_data_d", "scif1"),
386         /* I2C1 */
387         PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.1", "pfc-r8a7791",
388                                   "i2c1_e", "i2c1"),
389         /* I2C2 */
390         PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.2", "pfc-r8a7791",
391                                   "i2c2", "i2c2"),
392         /* I2C4 */
393         PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
394                                   "i2c4_c", "i2c4"),
395         /* SDHI0 */
396         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
397                                   "sdhi0_data4", "sdhi0"),
398         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
399                                   "sdhi0_ctrl", "sdhi0"),
400         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
401                                   "sdhi0_cd", "sdhi0"),
402         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
403                                   "sdhi0_wp", "sdhi0"),
404         /* SDHI2 */
405         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
406                                   "sdhi1_data4", "sdhi1"),
407         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
408                                   "sdhi1_ctrl", "sdhi1"),
409         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
410                                   "sdhi1_cd", "sdhi1"),
411         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
412                                   "sdhi1_wp", "sdhi1"),
413         /* SDHI2 */
414         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7791",
415                                   "sdhi2_data4", "sdhi2"),
416         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7791",
417                                   "sdhi2_ctrl", "sdhi2"),
418         PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7791",
419                                   "sdhi2_cd", "sdhi2"),
420 };
421
422 static void __init koelsch_add_standard_devices(void)
423 {
424         r8a7791_clock_init();
425         pinctrl_register_mappings(koelsch_pinctrl_map,
426                                   ARRAY_SIZE(koelsch_pinctrl_map));
427         r8a7791_pinmux_init();
428         r8a7791_add_standard_devices();
429         platform_device_register_resndata(&platform_bus, "r8a7791-ether", -1,
430                                           ether_resources,
431                                           ARRAY_SIZE(ether_resources),
432                                           &ether_pdata, sizeof(ether_pdata));
433         platform_device_register_data(&platform_bus, "leds-gpio", -1,
434                                       &koelsch_leds_pdata,
435                                       sizeof(koelsch_leds_pdata));
436         platform_device_register_data(&platform_bus, "gpio-keys", -1,
437                                       &koelsch_keys_pdata,
438                                       sizeof(koelsch_keys_pdata));
439         platform_device_register_resndata(&platform_bus, "qspi", 0,
440                                           qspi_resources,
441                                           ARRAY_SIZE(qspi_resources),
442                                           &qspi_pdata, sizeof(qspi_pdata));
443         spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
444
445         koelsch_add_du_device();
446
447         platform_device_register_full(&sata0_info);
448
449         koelsch_add_i2c(1);
450         koelsch_add_i2c(2);
451         koelsch_add_i2c(4);
452         koelsch_add_i2c(5);
453
454         platform_device_register_data(&platform_bus, "reg-fixed-voltage", 0,
455                                       &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
456         platform_device_register_data(&platform_bus, "reg-fixed-voltage", 1,
457                                       &vcc_sdhi1_info, sizeof(struct fixed_voltage_config));
458         platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2,
459                                       &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
460         platform_device_register_data(&platform_bus, "gpio-regulator", 0,
461                                       &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
462         platform_device_register_data(&platform_bus, "gpio-regulator", 1,
463                                       &vccq_sdhi1_info, sizeof(struct gpio_regulator_config));
464         platform_device_register_data(&platform_bus, "gpio-regulator", 2,
465                                       &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
466
467         platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
468                                           sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
469                                           &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
470
471         platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1,
472                                           sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
473                                           &sdhi1_info, sizeof(struct sh_mobile_sdhi_info));
474
475         platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
476                                           sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
477                                           &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
478
479 }
480
481 /*
482  * Ether LEDs on the Koelsch board are named LINK and ACTIVE which corresponds
483  * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
484  * 14-15. We have to set them back to 01 from the default 00 value each time
485  * the PHY is reset. It's also important because the PHY's LED0 signal is
486  * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
487  * bounce on and off after each packet, which we apparently want to avoid.
488  */
489 static int koelsch_ksz8041_fixup(struct phy_device *phydev)
490 {
491         u16 phyctrl1 = phy_read(phydev, 0x1e);
492
493         phyctrl1 &= ~0xc000;
494         phyctrl1 |= 0x4000;
495         return phy_write(phydev, 0x1e, phyctrl1);
496 }
497
498 static void __init koelsch_init(void)
499 {
500         koelsch_add_standard_devices();
501
502         irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW);
503
504         if (IS_ENABLED(CONFIG_PHYLIB))
505                 phy_register_fixup_for_id("r8a7791-ether-ff:01",
506                                           koelsch_ksz8041_fixup);
507 }
508
509 static const char * const koelsch_boards_compat_dt[] __initconst = {
510         "renesas,koelsch",
511         NULL,
512 };
513
514 DT_MACHINE_START(KOELSCH_DT, "koelsch")
515         .smp            = smp_ops(r8a7791_smp_ops),
516         .init_early     = r8a7791_init_early,
517         .init_time      = rcar_gen2_timer_init,
518         .init_machine   = koelsch_init,
519         .init_late      = shmobile_init_late,
520         .dt_compat      = koelsch_boards_compat_dt,
521 MACHINE_END