Skip to content

Commit

Permalink
driver: eth_esp32: fix shared clock check
Browse files Browse the repository at this point in the history
Both MDIO and Ethernet drivers share the same clock subsystem.
After clock control update in zephyrproject-rtos#73807, clock_control_on()
now returns -EALREADY for already initialized clock subsystem.
As a result, ethernet driver won't initialize as needed.

Fixes zephyrproject-rtos#74440

Signed-off-by: Sylvio Alves <[email protected]>
  • Loading branch information
sylvioalves committed Jun 20, 2024
1 parent b38d430 commit d687e15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/ethernet/eth_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ int eth_esp32_initialize(const struct device *dev)
clock_control_subsys_t clock_subsys =
(clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(eth), offset);

/* clock is shared, so do not bail out if already enabled */
res = clock_control_on(clock_dev, clock_subsys);
if (res != 0) {
if (res < 0 && res != -EALREADY) {
goto err;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/mdio/mdio_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ static int mdio_esp32_initialize(const struct device *dev)
clock_control_subsys_t clock_subsys =
(clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(mdio), offset);

/* clock is shared, so do not bail out if already enabled */
res = clock_control_on(clock_dev, clock_subsys);
if (res != 0) {
if (res < 0 && res != -EALREADY) {
goto err;
}

Expand Down

0 comments on commit d687e15

Please sign in to comment.