1 /*
2  * Copyright (c) 2022 Grant Ramsay <grant.ramsay@hotmail.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/init.h>
8 #include <zephyr/drivers/gpio.h>
9 
10 #define IP101GRI_RESET_N_PIN	5
11 
board_esp32_ethernet_kit_init(void)12 static int board_esp32_ethernet_kit_init(void)
13 {
14 	const struct device *gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));
15 
16 	if (!device_is_ready(gpio)) {
17 		return -ENODEV;
18 	}
19 
20 	/* Enable the Ethernet phy */
21 	int res = gpio_pin_configure(
22 		gpio, IP101GRI_RESET_N_PIN,
23 		GPIO_OUTPUT | GPIO_OUTPUT_INIT_HIGH);
24 
25 	return res;
26 }
27 
28 SYS_INIT(board_esp32_ethernet_kit_init, PRE_KERNEL_2, CONFIG_GPIO_INIT_PRIORITY);
29