Skip to content

Commit 855631a

Browse files
ckhardinhenrikbrixandersen
authored andcommitted
drivers: ethernet: lan9250: add support for a random mac address
Extend the lan9250 driver to support using a local administered unicast random mac address during init. This follows the device tree settings for zephyr_random_mac_address from other ethernet drivers for the added support. Signed-off-by: Charles Hardin <[email protected]>
1 parent 286cefb commit 855631a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

drivers/ethernet/eth_lan9250.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ static int lan9250_init(const struct device *dev)
697697
return ret;
698698
}
699699
lan9250_configure(dev);
700+
701+
(void)net_eth_mac_load(&config->mac_cfg, context->mac_address);
700702
lan9250_set_macaddr(dev);
701703

702704
k_thread_create(&context->thread, context->thread_stack,
@@ -719,6 +721,7 @@ static int lan9250_init(const struct device *dev)
719721
.spi = SPI_DT_SPEC_INST_GET(inst, SPI_WORD_SET(8)), \
720722
.interrupt = GPIO_DT_SPEC_INST_GET(inst, int_gpios), \
721723
.timeout = CONFIG_ETH_LAN9250_BUF_ALLOC_TIMEOUT, \
724+
.mac_cfg = NET_ETH_MAC_DT_INST_CONFIG_INIT(inst), \
722725
}; \
723726
\
724727
ETH_NET_DEVICE_DT_INST_DEFINE(inst, lan9250_init, NULL, &lan9250_##inst##_runtime, \

drivers/ethernet/eth_lan9250_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ struct lan9250_config {
312312
struct gpio_dt_spec reset;
313313
uint8_t full_duplex;
314314
int32_t timeout;
315+
struct net_eth_mac_config mac_cfg;
315316
};
316317

317318
struct lan9250_runtime {

0 commit comments

Comments
 (0)