driver: eth_esp32: fix shared clock check

Both MDIO and Ethernet drivers share the same clock subsystem.
After clock control update in #73807, clock_control_on()
now returns -EALREADY for already initialized clock subsystem.
As a result, ethernet driver won't initialize as needed.

Fixes #74440

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This commit is contained in:
Sylvio Alves 2024-06-17 17:01:43 -03:00 committed by Anas Nashif
parent 3b726dee53
commit cc29fc1182
2 changed files with 4 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}