Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions drivers/ethernet/eth_lan865x.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,14 @@
return ret;
}

ret = net_eth_mac_load(&cfg->mac_cfg, ctx->mac_address);
if (ret == -ENODATA) {
LOG_DBG("No MAC address configured for %s", dev->name);
} else if (ret < 0) {

Check failure on line 432 in drivers/ethernet/eth_lan865x.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

End this if...else if construct by an else clause.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZrbCYE1F4DPIU3PqW9n&open=AZrbCYE1F4DPIU3PqW9n&pullRequest=100318
LOG_ERR("Failed to load MAC address (%d)", ret);
return ret;
}

return lan865x_gpio_reset(dev);
}

Expand Down Expand Up @@ -475,12 +483,13 @@
.reset = GPIO_DT_SPEC_INST_GET(inst, rst_gpios), \
.timeout = CONFIG_ETH_LAN865X_TIMEOUT, \
.phy = DEVICE_DT_GET( \
DT_CHILD(DT_INST_CHILD(inst, lan865x_mdio), ethernet_phy_##inst))}; \
DT_CHILD(DT_INST_CHILD(inst, lan865x_mdio), ethernet_phy_##inst)), \
.mac_cfg = NET_ETH_MAC_DT_INST_CONFIG_INIT(inst), \
}; \
\
struct oa_tc6 oa_tc6_##inst = { \
.cps = 64, .protected = 0, .spi = &lan865x_config_##inst.spi}; \
static struct lan865x_data lan865x_data_##inst = { \
.mac_address = DT_INST_PROP_OR(inst, local_mac_address, {0}), \
.tx_rx_sem = Z_SEM_INITIALIZER((lan865x_data_##inst).tx_rx_sem, 1, 1), \
.int_sem = Z_SEM_INITIALIZER((lan865x_data_##inst).int_sem, 0, 1), \
.tc6 = &oa_tc6_##inst}; \
Expand Down
2 changes: 2 additions & 0 deletions drivers/ethernet/eth_lan865x_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/ethernet.h>
#include <ethernet/eth_stats.h>
#include "oa_tc6.h"

Expand Down Expand Up @@ -50,6 +51,7 @@ struct lan865x_config {
struct gpio_dt_spec interrupt;
struct gpio_dt_spec reset;
int32_t timeout;
struct net_eth_mac_config mac_cfg;

/* MAC */
bool tx_cut_through_mode; /* 1 - tx cut through, 0 - Store and forward */
Expand Down