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