|
iPXE
|
Synopsys DesignWare MAC network driver. More...
#include <stdint.h>#include <string.h>#include <errno.h>#include <byteswap.h>#include <ipxe/netdevice.h>#include <ipxe/ethernet.h>#include <ipxe/if_ether.h>#include <ipxe/iobuf.h>#include <ipxe/timer.h>#include <ipxe/devtree.h>#include <ipxe/fdt.h>#include "dwmac.h"Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static void | dwmac_dump_mac (struct dwmac *dwmac) |
| Dump MAC registers (for debugging) More... | |
| static void | dwmac_dump_dma (struct dwmac *dwmac) |
| Dump DMA registers (for debugging) More... | |
| static void | dwmac_dump (struct dwmac *dwmac) |
| Dump all registers (for debugging) More... | |
| static int | dwmac_reset (struct dwmac *dwmac) |
| Reset hardware. More... | |
| static void | dwmac_check_link (struct net_device *netdev) |
| Check link state. More... | |
| static int | dwmac_create_ring (struct dwmac *dwmac, struct dwmac_ring *ring) |
| Create descriptor ring. More... | |
| static void | dwmac_destroy_ring (struct dwmac *dwmac, struct dwmac_ring *ring) |
| Destroy descriptor ring. More... | |
| static void | dwmac_refill_rx (struct dwmac *dwmac) |
| Refill receive descriptor ring. More... | |
| static int | dwmac_open (struct net_device *netdev) |
| Open network device. More... | |
| static void | dwmac_close (struct net_device *netdev) |
| Close network device. More... | |
| static int | dwmac_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| Transmit packet. More... | |
| static void | dwmac_poll_tx (struct net_device *netdev) |
| Poll for completed packets. More... | |
| static void | dwmac_poll_rx (struct net_device *netdev) |
| Poll for received packets. More... | |
| static void | dwmac_poll (struct net_device *netdev) |
| Poll for completed and received packets. More... | |
| static int | dwmac_probe (struct dt_device *dt, unsigned int offset) |
| Probe devicetree device. More... | |
| static void | dwmac_remove (struct dt_device *dt) |
| Remove devicetree device. More... | |
Variables | |
| static struct net_device_operations | dwmac_operations |
| DesignWare MAC network device operations. More... | |
| static const char * | dwmac_ids [] |
| DesignWare MAC compatible model identifiers. More... | |
| struct dt_driver dwmac_driver | __dt_driver |
| DesignWare MAC devicetree driver. More... | |
Synopsys DesignWare MAC network driver.
Definition in file dwmac.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Dump MAC registers (for debugging)
| dwmac | DesignWare MAC device |
Definition at line 57 of file dwmac.c.
References DBG_LOG, DBGC, DWMAC_CFG, DWMAC_DEBUG, DWMAC_FILTER, DWMAC_FLOW, DWMAC_GMII, DWMAC_ISR, DWMAC_VER, dwmac::name, readl(), and dwmac::regs.
Referenced by dwmac_dump().
|
static |
Dump DMA registers (for debugging)
| dwmac | DesignWare MAC device |
Definition at line 80 of file dwmac.c.
References DBG_LOG, DBGC, DWMAC_AHB, DWMAC_AXI, DWMAC_BUS, DWMAC_DROP, DWMAC_FEATURE, DWMAC_OP, DWMAC_RXBASE, DWMAC_RXBUF, DWMAC_RXDESC, DWMAC_STATUS, DWMAC_TXBASE, DWMAC_TXBUF, DWMAC_TXDESC, dwmac::name, readl(), dwmac::regs, status, and writel().
Referenced by dwmac_dump().
|
static |
Dump all registers (for debugging)
| dwmac | DesignWare MAC device |
Definition at line 115 of file dwmac.c.
References dwmac_dump_dma(), and dwmac_dump_mac().
Referenced by dwmac_poll_rx(), and dwmac_poll_tx().
|
static |
Reset hardware.
| dwmac | DesignWare MAC device |
| rc | Return status code |
Definition at line 135 of file dwmac.c.
References bus, DBGC, DWMAC_BUS, DWMAC_BUS_SWR, DWMAC_RESET_MAX_WAIT_MS, ETIMEDOUT, mdelay(), dwmac::name, readl(), dwmac::regs, and writel().
Referenced by dwmac_close(), dwmac_probe(), and dwmac_remove().
|
static |
Check link state.
| netdev | Network device |
Definition at line 171 of file dwmac.c.
References DBGC, DWMAC_GMII, DWMAC_GMII_LINK, dwmac::name, netdev, netdev_link_down(), netdev_link_up(), net_device::priv, readl(), and dwmac::regs.
Referenced by dwmac_open(), dwmac_poll(), and dwmac_probe().
|
static |
Create descriptor ring.
| dwmac | DesignWare MAC device |
| ring | Descriptor ring |
| rc | Return status code |
Definition at line 201 of file dwmac.c.
References assert(), base, dwmac_ring::count, cpu_to_le16, dwmac_ring::ctrl, DBGC, desc, dwmac_ring::desc, dwmac::dma, dma(), dma_alloc(), DWMAC_CTRL_CHAIN, DWMAC_DMA, DWMAC_RX_LEN, DWMAC_SIZE_RX_CHAIN, ENOMEM, dwmac_ring::len, dwmac_ring::map, memset(), dwmac::name, next, dwmac_ring::qbase, dwmac::regs, wmb(), and writel().
Referenced by dwmac_open().
|
static |
Destroy descriptor ring.
| dwmac | DesignWare MAC device |
| ring | Descriptor ring |
Definition at line 242 of file dwmac.c.
References dwmac_ring::cons, dwmac_ring::desc, dma_free(), DWMAC_DMA, dwmac_ring::len, dwmac_ring::map, NULL, dwmac_ring::prod, dwmac_ring::qbase, dwmac::regs, and writel().
Referenced by dwmac_close(), and dwmac_open().
|
static |
Refill receive descriptor ring.
| dwmac | DesignWare MAC device |
Definition at line 260 of file dwmac.c.
References alloc_rx_iob(), assert(), dwmac_ring::cons, cpu_to_le32, io_buffer::data, DBGC2, dwmac_ring::desc, dwmac::dma, DWMAC_NUM_RX_DESC, DWMAC_RX_LEN, DWMAC_RXPOLL, DWMAC_STAT_OWN, iob_dma(), dwmac::name, NULL, dwmac_ring::prod, dwmac::regs, rx, dwmac::rx, dwmac::rx_iobuf, wmb(), and writel().
Referenced by dwmac_open(), and dwmac_poll().
|
static |
Open network device.
| netdev | Network device |
| rc | Return status code |
Definition at line 308 of file dwmac.c.
References DWMAC_ADDRH, DWMAC_ADDRL, DWMAC_CFG, DWMAC_CFG_DO, DWMAC_CFG_FD, DWMAC_CFG_RXEN, DWMAC_CFG_TXEN, dwmac_check_link(), dwmac_create_ring(), dwmac_destroy_ring(), DWMAC_FILTER, DWMAC_FILTER_PR, DWMAC_OP, DWMAC_OP_RXEN, DWMAC_OP_RXSF, DWMAC_OP_TXEN, DWMAC_OP_TXSF, dwmac_refill_rx(), ETH_ALEN, net_device::ll_addr, mac, memcpy(), netdev, net_device::priv, rc, dwmac::regs, dwmac::rx, dwmac::tx, and writel().
|
static |
Close network device.
| netdev | Network device |
Definition at line 357 of file dwmac.c.
References dwmac_destroy_ring(), DWMAC_NUM_RX_DESC, dwmac_reset(), free_rx_iob(), netdev, NULL, net_device::priv, dwmac::rx, dwmac::rx_iobuf, and dwmac::tx.
|
static |
Transmit packet.
| netdev | Network device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 385 of file dwmac.c.
References dwmac_ring::cons, cpu_to_le16, cpu_to_le32, io_buffer::data, DBGC, DBGC2, dwmac_ring::desc, DWMAC_NUM_TX_DESC, DWMAC_STAT_OWN, DWMAC_STAT_TX_CHAIN, DWMAC_STAT_TX_FIRST, DWMAC_STAT_TX_LAST, DWMAC_TXPOLL, ENOBUFS, iob_dma(), iob_len(), dwmac::name, netdev, net_device::priv, dwmac_ring::prod, dwmac::regs, tx, dwmac::tx, wmb(), and writel().
|
static |
Poll for completed packets.
@V netdev Network device
Definition at line 425 of file dwmac.c.
References dwmac_ring::cons, cpu_to_le32, DBGC, DBGC2, dwmac_ring::desc, dwmac_dump(), DWMAC_NUM_TX_DESC, DWMAC_STAT_ERR, DWMAC_STAT_OWN, EIO, le32_to_cpu, dwmac::name, netdev, netdev_tx_complete_next(), netdev_tx_complete_next_err(), net_device::priv, dwmac_ring::prod, tx, and dwmac::tx.
Referenced by dwmac_poll().
|
static |
Poll for received packets.
| netdev | Network device |
Definition at line 461 of file dwmac.c.
References assert(), dwmac_ring::cons, cpu_to_le32, DBGC, DBGC2, dwmac_ring::desc, dwmac_dump(), DWMAC_NUM_RX_DESC, DWMAC_STAT_ERR, DWMAC_STAT_OWN, DWMAC_STAT_RX_FIRST, DWMAC_STAT_RX_LAST, DWMAC_STAT_RX_LEN, EIO, iob_put, le32_to_cpu, len, dwmac::name, netdev, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, dwmac_ring::prod, rx, dwmac::rx, dwmac::rx_iobuf, and stat.
Referenced by dwmac_poll().
|
static |
Poll for completed and received packets.
| netdev | Network device |
Definition at line 510 of file dwmac.c.
References dwmac_check_link(), dwmac_poll_rx(), dwmac_poll_tx(), dwmac_refill_rx(), DWMAC_STATUS, DWMAC_STATUS_LINK, netdev, net_device::priv, readl(), dwmac::regs, and status.
|
static |
Probe devicetree device.
| dt | Devicetree device |
| offset | Starting node offset |
| rc | Return status code |
Definition at line 551 of file dwmac.c.
References alloc_etherdev(), DBGC, dt_device::dev, net_device::dev, dt_device::dma, dwmac::dma, net_device::dma, dt_ioremap(), dt_set_drvdata(), DWMAC_ADDRH, DWMAC_ADDRL, dwmac_check_link(), DWMAC_CTRL_CHAIN, DWMAC_CTRL_TX_FIRST, DWMAC_CTRL_TX_LAST, DWMAC_NUM_RX_DESC, DWMAC_NUM_TX_DESC, dwmac_operations, DWMAC_REG_IDX, DWMAC_REG_LEN, dwmac_reset(), DWMAC_RXBASE, DWMAC_TXBASE, DWMAC_VER, DWMAC_VER_CORE_MAJOR, DWMAC_VER_CORE_MINOR, DWMAC_VER_USER_MAJOR, DWMAC_VER_USER_MINOR, ENODEV, ENOMEM, ETH_ALEN, fdt_mac(), iounmap(), net_device::ll_addr, mac, memcpy(), memset(), device::name, dwmac::name, netdev, netdev_init(), netdev_nullify(), netdev_put(), offset, net_device::priv, rc, readl(), register_netdev(), dwmac::regs, dwmac::rx, strerror(), sysfdt, dwmac::tx, unregister_netdev(), and version.
|
static |
Remove devicetree device.
| dt | Devicetree device |
Definition at line 634 of file dwmac.c.
References dt_get_drvdata(), dwmac_reset(), iounmap(), netdev, netdev_nullify(), netdev_put(), net_device::priv, dwmac::regs, and unregister_netdev().
|
static |
DesignWare MAC network device operations.
Definition at line 530 of file dwmac.c.
Referenced by dwmac_probe().
|
static |
| struct dt_driver dwmac_driver __dt_driver |
DesignWare MAC devicetree driver.
1.8.15