Skip to content

Commit 185bb90

Browse files
committed
drivers: ethernet: remove phy_configure_link() usage
remove the use of phy_configure_link() in the ethernet drivers. The user can now select the default speeds via DT prop, doing another phy_configure_link() in the eth driver would overwrite that. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent fba0631 commit 185bb90

File tree

2 files changed

+4
-56
lines changed

2 files changed

+4
-56
lines changed

drivers/ethernet/eth_nxp_enet.c

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -457,49 +457,12 @@ static void eth_nxp_enet_rx_thread(struct k_work *work)
457457
ENET_EnableInterrupts(data->base, kENET_RxFrameInterrupt);
458458
}
459459

460-
static int nxp_enet_phy_configure(const struct device *phy, uint8_t phy_mode)
461-
{
462-
enum phy_link_speed speeds = LINK_HALF_10BASE | LINK_FULL_10BASE |
463-
LINK_HALF_100BASE | LINK_FULL_100BASE;
464-
int ret;
465-
struct phy_link_state state;
466-
467-
if (COND_CODE_1(IS_ENABLED(CONFIG_ETH_NXP_ENET_1G),
468-
(phy_mode == NXP_ENET_RGMII_MODE), (0))) {
469-
speeds |= (LINK_HALF_1000BASE | LINK_FULL_1000BASE);
470-
}
471-
472-
/* Configure the PHY */
473-
ret = phy_configure_link(phy, speeds);
474-
475-
if (ret == -ENOTSUP) {
476-
phy_get_link_state(phy, &state);
477-
478-
if (state.is_up) {
479-
LOG_WRN("phy_configure_link returned -ENOTSUP, but link is up. "
480-
"Speed: %s, %s-duplex",
481-
PHY_LINK_IS_SPEED_1000M(state.speed) ? "1 Gbits" :
482-
PHY_LINK_IS_SPEED_100M(state.speed) ? "100 Mbits" : "10 Mbits",
483-
PHY_LINK_IS_FULL_DUPLEX(state.speed) ? "full" : "half");
484-
} else {
485-
LOG_ERR("phy_configure_link returned -ENOTSUP and link is down.");
486-
return -ENETDOWN;
487-
}
488-
} else if (ret) {
489-
LOG_ERR("phy_configure_link failed with error: %d", ret);
490-
return ret;
491-
}
492-
493-
return 0;
494-
}
495-
496460
static void nxp_enet_phy_cb(const struct device *phy,
497461
struct phy_link_state *state,
498462
void *eth_dev)
499463
{
500464
const struct device *dev = eth_dev;
501465
struct nxp_enet_mac_data *data = dev->data;
502-
const struct nxp_enet_mac_config *config = dev->config;
503466
enet_mii_speed_t speed;
504467
enet_mii_duplex_t duplex;
505468

@@ -523,16 +486,13 @@ static void nxp_enet_phy_cb(const struct device *phy,
523486
}
524487

525488
ENET_SetMII(data->base, speed, duplex);
526-
}
527-
528-
LOG_INF("Link is %s", state->is_up ? "up" : "down");
529489

530-
if (!state->is_up) {
531-
net_eth_carrier_off(data->iface);
532-
nxp_enet_phy_configure(phy, config->phy_mode);
533-
} else {
534490
net_eth_carrier_on(data->iface);
491+
} else {
492+
net_eth_carrier_off(data->iface);
535493
}
494+
495+
LOG_INF("Link is %s", state->is_up ? "up" : "down");
536496
}
537497

538498
static void eth_nxp_enet_iface_init(struct net_if *iface)
@@ -792,11 +752,6 @@ static int eth_nxp_enet_init(const struct device *dev)
792752

793753
ENET_ActiveRead(data->base);
794754

795-
err = nxp_enet_phy_configure(config->phy_dev, config->phy_mode);
796-
if (err) {
797-
return err;
798-
}
799-
800755
LOG_DBG("%s MAC %02x:%02x:%02x:%02x:%02x:%02x",
801756
dev->name,
802757
data->mac_addr[0], data->mac_addr[1],

drivers/ethernet/eth_xilinx_axienet.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,6 @@ static int xilinx_axienet_probe(const struct device *dev)
528528
XILINX_AXIENET_RECEIVER_CONFIGURATION_FLOW_CONTROL_OFFSET,
529529
XILINX_AXIENET_RECEIVER_CONFIGURATION_FLOW_CONTROL_EN_MASK);
530530

531-
/* at time of writing, hardware does not support half duplex */
532-
err = phy_configure_link(config->phy, LINK_FULL_10BASE | LINK_FULL_100BASE |
533-
LINK_FULL_1000BASE);
534-
if (err) {
535-
LOG_WRN("Could not configure PHY: %d", -err);
536-
}
537-
538531
LOG_INF("RX Checksum offloading %s",
539532
config->have_rx_csum_offload ? "requested" : "disabled");
540533
LOG_INF("TX Checksum offloading %s",

0 commit comments

Comments
 (0)