diff options
Diffstat (limited to 'drivers/net/enc28j60.c')
-rw-r--r-- | drivers/net/enc28j60.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 3628a88f7d..9455c6f5ea 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -46,6 +46,7 @@ struct enc28j60_net { /* store MAC address here while hardware is in the reset state */ u8 hwaddr[ETH_ALEN]; struct mii_bus miibus; + void *rx_buffer; }; /* @@ -273,7 +274,7 @@ static void enc28j60_mem_read(struct enc28j60_net *priv, { enc28j60_regw_write(priv, ERDPTL, addr); - if (IS_ENABLED(CONFIG_ENC28J60_WRITEVERIFY)) { + if (IS_ENABLED(CONFIG_DRIVER_NET_ENC28J60_WRITEVERIFY)) { u16 reg; reg = enc28j60_regw_read(priv, ERDPTL); if (reg != addr) @@ -293,7 +294,7 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data) /* Set the write pointer to start of transmit buffer area */ enc28j60_regw_write(priv, EWRPTL, TXSTART_INIT); - if (IS_ENABLED(CONFIG_ENC28J60_WRITEVERIFY)) { + if (IS_ENABLED(CONFIG_DRIVER_NET_ENC28J60_WRITEVERIFY)) { u16 reg; reg = enc28j60_regw_read(priv, EWRPTL); if (reg != TXSTART_INIT) @@ -670,7 +671,7 @@ static void enc28j60_hw_disable(struct enc28j60_net *priv) static inline void enc28j60_dump_rsv(struct enc28j60_net *priv, const char *msg, u16 pk_ptr, int len, u16 sts) { - struct device_d *dev = &priv->edev.dev; + struct device *dev = &priv->edev.dev; dev_dbg(dev, "%s - NextPk: 0x%04x - RSV:\n", msg, pk_ptr); @@ -710,7 +711,7 @@ static int enc28j60_eth_send(struct eth_device *edev, void *packet, enc28j60_packet_write(priv, packet_length, packet); /* readback and verify written data */ - if (IS_ENABLED(CONFIG_ENC28J60_WRITEVERIFY)) { + if (IS_ENABLED(CONFIG_DRIVER_NET_ENC28J60_WRITEVERIFY)) { int test_len, k; u8 test_buf[64]; /* limit the test to the first 64 bytes */ int okflag; @@ -793,9 +794,9 @@ static void enc28j60_hw_rx(struct eth_device *edev) /* copy the packet from the receive buffer */ enc28j60_mem_read(priv, rx_packet_start(priv->next_pk_ptr), - len, NetRxPackets[0]); + len, priv->rx_buffer); - net_receive(edev, NetRxPackets[0], len); + net_receive(edev, priv->rx_buffer, len); } /* @@ -808,7 +809,7 @@ static void enc28j60_hw_rx(struct eth_device *edev) enc28j60_regw_write(priv, ERXRDPTL, erxrdpt); - if (IS_ENABLED(CONFIG_ENC28J60_WRITEVERIFY)) { + if (IS_ENABLED(CONFIG_DRIVER_NET_ENC28J60_WRITEVERIFY)) { u16 reg; reg = enc28j60_regw_read(priv, ERXRDPTL); if (reg != erxrdpt) @@ -922,7 +923,7 @@ static void enc28j60_eth_halt(struct eth_device *edev) enc28j60_lowpower(priv, true); } -static int enc28j60_probe(struct device_d *dev) +static int enc28j60_probe(struct device *dev) { struct eth_device *edev; struct enc28j60_net *priv; @@ -931,6 +932,7 @@ static int enc28j60_probe(struct device_d *dev) priv = xzalloc(sizeof(*priv)); priv->spi = (struct spi_device *)dev->type_data; + priv->rx_buffer = net_alloc_packet(); edev = &priv->edev; edev->priv = priv; @@ -998,8 +1000,9 @@ static __maybe_unused struct of_device_id enc28j60_dt_ids[] = { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, enc28j60_dt_ids); -static struct driver_d enc28j60_driver = { +static struct driver enc28j60_driver = { .name = DRV_NAME, .probe = enc28j60_probe, .of_compatible = DRV_OF_COMPAT(enc28j60_dt_ids), |