boards: xtensa/esp32_ethernet_kit: Init Ethernet phy

Initialises the Ethernet phy hardware.
Sets phy RESET_N pin high shortly after boot

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
This commit is contained in:
Grant Ramsay 2022-09-20 19:46:09 +12:00 committed by Anas Nashif
parent 7bc8211aa4
commit 58de4291d5
3 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_GPIO_ESP32)
zephyr_library()
zephyr_library_sources(board_init.c)
endif()

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022 Grant Ramsay <grant.ramsay@hotmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/gpio.h>
#define IP101GRI_RESET_N_PIN 5
static int board_esp32_ethernet_kit_init(const struct device *dev)
{
ARG_UNUSED(dev);
const struct device *gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));
if (!device_is_ready(gpio)) {
return -ENODEV;
}
/* Enable the Ethernet phy */
int res = gpio_pin_configure(
gpio, IP101GRI_RESET_N_PIN,
GPIO_OUTPUT | GPIO_OUTPUT_INIT_HIGH);
return res;
}
SYS_INIT(board_esp32_ethernet_kit_init, PRE_KERNEL_2, CONFIG_GPIO_INIT_PRIORITY);

View file

@ -495,6 +495,12 @@ You can debug an application in the usual way. Here is an example for the :ref:`
:board: esp32_ethernet_kit
:goals: debug
Board Init
-----------------
RESET_N (GPIO5) is automatically set high to enable the Ethernet PHY
during board initialization (board_init.c)
Related Documents
-----------------