Skip to content

Commit 346bd7d

Browse files
cbrakekartben
authored andcommitted
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 <[email protected]>
1 parent 9bd8bd6 commit 346bd7d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/ethernet/eth_esp32.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ int eth_esp32_initialize(const struct device *dev)
282282
if (strcmp(phy_connection_type, "rmii") == 0) {
283283
emac_hal_iomux_init_rmii();
284284
#if DT_INST_NODE_HAS_PROP(0, ref_clk_output_gpios)
285-
BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 ||
285+
BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 0 ||
286+
DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 ||
286287
DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 17,
287-
"Only GPIO16/17 are allowed as a GPIO REF_CLK source!");
288+
"Only GPIO0/16/17 are allowed as a GPIO REF_CLK source!");
288289
int ref_clk_gpio = DT_INST_GPIO_PIN(0, ref_clk_output_gpios);
289290
emac_hal_iomux_rmii_clk_output(ref_clk_gpio);
290291
emac_ll_clock_enable_rmii_output(dev_data->hal.ext_regs);

drivers/mdio/mdio_esp32.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ static int mdio_esp32_initialize(const struct device *dev)
147147
#if DT_INST_NODE_HAS_PROP(0, ref_clk_output_gpios)
148148
emac_hal_init(&dev_data->hal, NULL, NULL, NULL);
149149
emac_hal_iomux_init_rmii();
150-
BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 ||
150+
BUILD_ASSERT(DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 0 ||
151+
DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 16 ||
151152
DT_INST_GPIO_PIN(0, ref_clk_output_gpios) == 17,
152-
"Only GPIO16/17 are allowed as a GPIO REF_CLK source!");
153+
"Only GPIO0/16/17 are allowed as a GPIO REF_CLK source!");
153154
int ref_clk_gpio = DT_INST_GPIO_PIN(0, ref_clk_output_gpios);
154155

155156
emac_hal_iomux_rmii_clk_output(ref_clk_gpio);

0 commit comments

Comments
 (0)