Skip to content

Commit

Permalink
Merge pull request #20304 from benpicco/drivers-luid_get
Browse files Browse the repository at this point in the history
drivers/w5100: make use of netdev_eui48_get()
  • Loading branch information
maribu authored Jan 26, 2024
2 parents 1073df2 + a774ad9 commit ad69fc1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/w5100/w5100.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include <string.h>

#include "log.h"
#include "luid.h"
#include "assert.h"

#include "net/eui_provider.h"
#include "net/ethernet.h"
#include "net/netdev/eth.h"

Expand Down Expand Up @@ -134,7 +134,7 @@ static int init(netdev_t *netdev)
{
w5100_t *dev = (w5100_t *)netdev;
uint8_t tmp;
uint8_t hwaddr[ETHERNET_ADDR_LEN];
eui48_t hwaddr;

/* get access to the SPI bus for the duration of this function */
spi_acquire(dev->p.spi, dev->p.cs, SPI_CONF, dev->p.clk);
Expand All @@ -152,9 +152,8 @@ static int init(netdev_t *netdev)
while (rreg(dev, REG_MODE) & MODE_RESET) {}

/* initialize the device, start with writing the MAC address */
luid_get(hwaddr, ETHERNET_ADDR_LEN);
hwaddr[0] &= ~0x03; /* no group address and not globally unique */
wchunk(dev, REG_SHAR0, hwaddr, ETHERNET_ADDR_LEN);
netdev_eui48_get(netdev, &hwaddr);
wchunk(dev, REG_SHAR0, hwaddr.uint8, sizeof(hwaddr));

/* configure all memory to be used by socket 0 */
wreg(dev, REG_RMSR, RMSR_8KB_TO_S0);
Expand Down

0 comments on commit ad69fc1

Please sign in to comment.