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