Skip to content

Commit cc29fc1

Browse files
sylvioalvesnashif
authored andcommitted
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 <[email protected]>
1 parent 3b726de commit cc29fc1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/ethernet/eth_esp32.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ int eth_esp32_initialize(const struct device *dev)
212212
clock_control_subsys_t clock_subsys =
213213
(clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(eth), offset);
214214

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

drivers/mdio/mdio_esp32.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ static int mdio_esp32_initialize(const struct device *dev)
104104
clock_control_subsys_t clock_subsys =
105105
(clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(mdio), offset);
106106

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

0 commit comments

Comments
 (0)