From 346bd7d16d6cfaecab58ace05227b5532cabf62b Mon Sep 17 00:00:00 2001 From: Cliff Brake Date: Mon, 14 Apr 2025 15:37:02 -0400 Subject: [PATCH] drivers: eth/mdio: esp32: enable GPIO0 for phy clock out Currently, GPIO16/17 are supported for Ethernet phy clock out, but some boards are also using GPIO0. This change allows GPIO0 to be configured. Signed-off-by: Cliff Brake --- drivers/ethernet/eth_esp32.c | 5 +++-- drivers/mdio/mdio_esp32.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/ethernet/eth_esp32.c b/drivers/ethernet/eth_esp32.c index 4cd3d5b13d7..166064db2d5 100644 --- a/drivers/ethernet/eth_esp32.c +++ b/drivers/ethernet/eth_esp32.c @@ -282,9 +282,10 @@ int eth_esp32_initialize(const struct device *dev) if (strcmp(phy_connection_type, "rmii") == 0) { emac_hal_iomux_init_rmii(); #if DT_INST_NODE_HAS_PROP(0, ref_clk_output_gpios) - BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 || + BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 0 || + DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 || DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 17, - "Only GPIO16/17 are allowed as a GPIO REF_CLK source!"); + "Only GPIO0/16/17 are allowed as a GPIO REF_CLK source!"); int ref_clk_gpio = DT_INST_GPIO_PIN(0, ref_clk_output_gpios); emac_hal_iomux_rmii_clk_output(ref_clk_gpio); emac_ll_clock_enable_rmii_output(dev_data->hal.ext_regs); diff --git a/drivers/mdio/mdio_esp32.c b/drivers/mdio/mdio_esp32.c index 9079d49e741..7dd8995b654 100644 --- a/drivers/mdio/mdio_esp32.c +++ b/drivers/mdio/mdio_esp32.c @@ -147,9 +147,10 @@ static int mdio_esp32_initialize(const struct device *dev) #if DT_INST_NODE_HAS_PROP(0, ref_clk_output_gpios) emac_hal_init(&dev_data->hal, NULL, NULL, NULL); emac_hal_iomux_init_rmii(); - BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 || + BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 0 || + DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 || DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 17, - "Only GPIO16/17 are allowed as a GPIO REF_CLK source!"); + "Only GPIO0/16/17 are allowed as a GPIO REF_CLK source!"); int ref_clk_gpio = DT_INST_GPIO_PIN(0, ref_clk_output_gpios); emac_hal_iomux_rmii_clk_output(ref_clk_gpio);