iPXE
|
SMSC LAN75xx USB Ethernet driver. More...
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/ethernet.h>
#include <ipxe/usb.h>
#include <ipxe/usbnet.h>
#include <ipxe/profile.h>
#include "smsc75xx.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | smsc75xx_dump_statistics (struct smscusb_device *smscusb) |
Dump statistics (for debugging) More... | |
static int | smsc75xx_reset (struct smscusb_device *smscusb) |
Reset device. More... | |
static void | smsc75xx_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
Complete bulk IN transfer. More... | |
static int | smsc75xx_out_transmit (struct smscusb_device *smscusb, struct io_buffer *iobuf) |
Transmit packet. More... | |
static int | smsc75xx_open (struct net_device *netdev) |
Open network device. More... | |
static void | smsc75xx_close (struct net_device *netdev) |
Close network device. More... | |
int | smsc75xx_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
void | smsc75xx_poll (struct net_device *netdev) |
Poll for completed and received packets. More... | |
static int | smsc75xx_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
Probe device. More... | |
static void | smsc75xx_remove (struct usb_function *func) |
Remove device. More... | |
Variables | |
static struct profiler smsc75xx_in_profiler | __profiler |
Bulk IN completion profiler. More... | |
struct usb_endpoint_driver_operations | smsc75xx_in_operations |
Bulk IN endpoint operations. More... | |
static struct net_device_operations | smsc75xx_operations |
SMSC75xx network device operations. More... | |
static struct usb_device_id | smsc75xx_ids [] |
SMSC75xx device IDs. More... | |
struct usb_driver smsc75xx_driver | __usb_driver |
SMSC LAN75xx driver. More... | |
SMSC LAN75xx USB Ethernet driver.
Definition in file smsc75xx.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int smsc75xx_dump_statistics | ( | struct smscusb_device * | smscusb | ) |
Dump statistics (for debugging)
smscusb | SMSC USB device |
rc | Return status code |
Definition at line 63 of file smsc75xx.c.
References smsc75xx_rx_error_statistics::alignment, smsc75xx_byte_statistics::broadcast, smsc75xx_frame_statistics::broadcast, smsc75xx_rx_statistics::byte, smsc75xx_tx_statistics::byte, smsc75xx_tx_error_statistics::carrier, smsc75xx_tx_error_statistics::count, DBG_LOG, DBGC, smsc75xx_tx_error_statistics::deferral, smsc75xx_rx_error_statistics::dropped, smsc75xx_rx_statistics::err, smsc75xx_tx_statistics::err, smsc75xx_tx_error_statistics::excessive, smsc75xx_rx_error_statistics::fcs, smsc75xx_tx_error_statistics::fcs, smsc75xx_rx_error_statistics::fragment, smsc75xx_rx_statistics::frame, smsc75xx_tx_statistics::frame, smsc75xx_rx_error_statistics::jabber, smsc75xx_tx_error_statistics::late, le32_to_cpu, smsc75xx_byte_statistics::multicast, smsc75xx_frame_statistics::multicast, smsc75xx_tx_error_statistics::multiple, smsc75xx_rx_error_statistics::oversize, smsc75xx_frame_statistics::pause, rc, smsc75xx_statistics::rx, smsc75xx_tx_error_statistics::single, smscusb_get_statistics(), strerror(), smsc75xx_statistics::tx, smsc75xx_rx_error_statistics::undersize, smsc75xx_byte_statistics::unicast, and smsc75xx_frame_statistics::unicast.
Referenced by lan78xx_close(), and smsc75xx_close().
|
static |
Reset device.
smscusb | SMSC USB device |
rc | Return status code |
Definition at line 133 of file smsc75xx.c.
References DBGC, ETIMEDOUT, mdelay(), rc, SMSC75XX_HW_CFG, SMSC75XX_HW_CFG_LRST, SMSC75XX_RESET_MAX_WAIT_MS, smscusb_readl(), and smscusb_writel().
Referenced by smsc75xx_close(), smsc75xx_open(), and smsc75xx_probe().
|
static |
Complete bulk IN transfer.
ep | USB endpoint |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 176 of file smsc75xx.c.
References container_of, cpu_to_le32, io_buffer::data, DBGC, DBGC_HDA, EINVAL, EIO, free_iob(), header, usbnet_device::in, iob_disown, iob_len(), iob_pull, le32_to_cpu, netdev, smscusb_device::netdev, netdev_rx(), netdev_rx_err(), usb_endpoint::open, profile_start(), profile_stop(), rc, SMSC75XX_RX_RED, strerror(), and smscusb_device::usbnet.
|
static |
Transmit packet.
smscusb | SMSC USB device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 244 of file smsc75xx.c.
References cpu_to_le32, header, iob_ensure_headroom(), iob_len(), iob_push, len, usbnet_device::out, profile_start(), profile_stop(), rc, SMSC75XX_TX_FCS, usb_stream(), and smscusb_device::usbnet.
Referenced by smsc75xx_transmit().
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 282 of file smsc75xx.c.
References DBGC, smscusb_device::int_sts, netdev, net_device::priv, rc, SMSC75XX_ADDR_FILT_BASE, SMSC75XX_BULK_IN_DLY, SMSC75XX_BULK_IN_DLY_SET, SMSC75XX_FCT_RX_CTL, SMSC75XX_FCT_RX_CTL_BAD, SMSC75XX_FCT_RX_CTL_EN, SMSC75XX_FCT_TX_CTL, SMSC75XX_FCT_TX_CTL_EN, SMSC75XX_HW_CFG, SMSC75XX_HW_CFG_BIR, SMSC75XX_INT_EP_CTL, SMSC75XX_INT_EP_CTL_PHY_EN, SMSC75XX_INT_EP_CTL_RDFO_EN, SMSC75XX_MAC_RX, SMSC75XX_MAC_RX_EN, SMSC75XX_MAC_RX_FCS, SMSC75XX_MAC_RX_MAX_SIZE_DEFAULT, SMSC75XX_MAC_TX, SMSC75XX_MAC_TX_EN, SMSC75XX_MII_PHY_INTR_MASK, SMSC75XX_PHY_INTR_ANEG_DONE, SMSC75XX_PHY_INTR_LINK_DOWN, smsc75xx_reset(), SMSC75XX_RFE_CTL, SMSC75XX_RFE_CTL_AB, SMSC75XX_RFE_CTL_AM, SMSC75XX_RFE_CTL_AU, SMSC75XX_RX_ADDR_BASE, smscusb_mii_open(), smscusb_set_address(), smscusb_set_filter(), smscusb_writel(), strerror(), smscusb_device::usbnet, usbnet_close(), and usbnet_open().
|
static |
Close network device.
netdev | Network device |
Definition at line 382 of file smsc75xx.c.
References DBG_LOG, netdev, net_device::priv, smsc75xx_dump_statistics(), smsc75xx_reset(), smscusb_device::usbnet, and usbnet_close().
int smsc75xx_transmit | ( | struct net_device * | netdev, |
struct io_buffer * | iobuf | ||
) |
Transmit packet.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 403 of file smsc75xx.c.
References netdev, net_device::priv, rc, and smsc75xx_out_transmit().
void smsc75xx_poll | ( | struct net_device * | netdev | ) |
Poll for completed and received packets.
netdev | Network device |
Definition at line 419 of file smsc75xx.c.
References smscusb_device::bus, DBGC, DBGC2, ENOBUFS, ENOTTY, smscusb_device::int_sts, netdev, netdev_rx_err(), NULL, net_device::priv, rc, SMSC75XX_INT_STS, SMSC75XX_INT_STS_PHY_INT, SMSC75XX_INT_STS_RDFO_INT, smscusb_mii_check_link(), smscusb_writel(), usb_poll(), smscusb_device::usbnet, and usbnet_refill().
|
static |
Probe device.
func | USB function |
config | Configuration descriptor |
rc | Return status code |
Definition at line 485 of file smsc75xx.c.
References alloc_etherdev(), DBGC, net_device::dev, usb_function::dev, ENOMEM, usbnet_device::in, memset(), usb_function::name, netdev, netdev_init(), netdev_nullify(), netdev_put(), net_device::priv, rc, register_netdev(), SMSC75XX_E2P_BASE, SMSC75XX_IN_MAX_FILL, SMSC75XX_IN_MTU, smsc75xx_in_operations, SMSC75XX_MII_BASE, SMSC75XX_MII_PHY_INTR_SOURCE, smsc75xx_operations, smsc75xx_reset(), smscusb_eeprom_fetch_mac(), smscusb_init(), smscusb_mii_init(), strerror(), unregister_netdev(), usb_func_set_drvdata(), usb_refill_init(), smscusb_device::usbnet, and usbnet_describe().
|
static |
Remove device.
func | USB function |
Definition at line 547 of file smsc75xx.c.
References netdev, netdev_nullify(), netdev_put(), unregister_netdev(), and usb_func_get_drvdata().
|
static |
Bulk IN completion profiler.
Bulk OUT profiler.
Definition at line 43 of file smsc75xx.c.
struct usb_endpoint_driver_operations smsc75xx_in_operations |
Bulk IN endpoint operations.
Definition at line 233 of file smsc75xx.c.
Referenced by lan78xx_probe(), and smsc75xx_probe().
|
static |
SMSC75xx network device operations.
Definition at line 464 of file smsc75xx.c.
Referenced by smsc75xx_probe().
|
static |
SMSC75xx device IDs.
Definition at line 556 of file smsc75xx.c.
struct usb_driver smsc75xx_driver __usb_driver |
SMSC LAN75xx driver.
Definition at line 570 of file smsc75xx.c.