Skip to content

Commit 0a2ddba

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 b447bbd commit 0a2ddba

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
@@ -458,49 +458,12 @@ static void eth_nxp_enet_rx_thread(struct k_work *work)
458458
ENET_EnableInterrupts(data->base, kENET_RxFrameInterrupt);
459459
}
460460

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

@@ -524,16 +487,13 @@ static void nxp_enet_phy_cb(const struct device *phy,
524487
}
525488

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

531-
if (!state->is_up) {
532-
net_eth_carrier_off(data->iface);
533-
nxp_enet_phy_configure(phy, config->phy_mode);
534-
} else {
535491
net_eth_carrier_on(data->iface);
492+
} else {
493+
net_eth_carrier_off(data->iface);
536494
}
495+
496+
LOG_INF("Link is %s", state->is_up ? "up" : "down");
537497
}
538498

539499
static void eth_nxp_enet_iface_init(struct net_if *iface)
@@ -793,11 +753,6 @@ static int eth_nxp_enet_init(const struct device *dev)
793753

794754
ENET_ActiveRead(data->base);
795755

796-
err = nxp_enet_phy_configure(config->phy_dev, config->phy_mode);
797-
if (err) {
798-
return err;
799-
}
800-
801756
LOG_DBG("%s MAC %02x:%02x:%02x:%02x:%02x:%02x",
802757
dev->name,
803758
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,
533-
LINK_FULL_10BASE | LINK_FULL_100BASE | LINK_FULL_1000BASE, 0);
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)