Skip to content

Commit b76ec40

Browse files
committed
drivers: ethernet: phy: dp83867: use default speeds
use default speeds from dt to configure phy on init. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 8e7c839 commit b76ec40

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

drivers/ethernet/phy/phy_ti_dp83867.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <zephyr/logging/log.h>
2121
LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL);
2222

23+
#include "phy_common.h"
24+
2325
#define PHY_TI_DP83867_PHYSTS 0x11
2426
#define PHY_TI_DP83867_PHYSTS_LINKSTATUS_MASK BIT(10)
2527
#define PHY_TI_DP83867_PHYSTS_LINKDUPLEX_MASK BIT(13)
@@ -42,6 +44,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL);
4244
struct ti_dp83867_config {
4345
uint8_t addr;
4446
const struct device *mdio_dev;
47+
enum phy_link_speed default_speeds;
4548
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios)
4649
const struct gpio_dt_spec reset_gpio;
4750
#endif
@@ -520,6 +523,9 @@ static int phy_ti_dp83867_init(const struct device *dev)
520523
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */
521524
phy_ti_dp83867_monitor_work_handler(&data->phy_monitor_work.work);
522525

526+
/* Advertise default speeds */
527+
phy_ti_dp83867_cfg_link(dev, config->default_speeds);
528+
523529
return 0;
524530
}
525531

@@ -547,6 +553,7 @@ static DEVICE_API(ethphy, ti_dp83867_phy_api) = {
547553
static const struct ti_dp83867_config ti_dp83867_##n##_config = { \
548554
.addr = DT_INST_REG_ADDR(n), \
549555
.mdio_dev = DEVICE_DT_GET(DT_INST_PARENT(n)), \
556+
.default_speeds = PHY_INST_GENERATE_DEFAULT_SPEEDS(n), \
550557
RESET_GPIO(n) INTERRUPT_GPIO(n)}; \
551558
\
552559
static struct ti_dp83867_data ti_dp83867_##n##_data; \

dts/bindings/ethernet/phy/ti,dp83867.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ properties:
1414
int-gpios:
1515
type: phandle-array
1616
description: GPIO for interrupt signal indicating PHY state change.
17+
default-speeds:
18+
default: ["10BASE Half-Duplex", "10BASE Full-Duplex", "100BASE Half-Duplex",
19+
"100BASE Full-Duplex", "1000BASE Half-Duplex", "1000BASE Full-Duplex"]

0 commit comments

Comments
 (0)