iPXE
|
SMSC LAN95xx 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 <ipxe/base16.h>
#include <ipxe/smbios.h>
#include "smsc95xx.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | smsc95xx_vm3_fetch_mac (struct smscusb_device *smscusb) |
Construct MAC address for Honeywell VM3. More... | |
static int | smsc95xx_fetch_mac (struct smscusb_device *smscusb) |
Fetch MAC address. More... | |
static int | smsc95xx_dump_statistics (struct smscusb_device *smscusb) |
Dump statistics (for debugging) More... | |
static int | smsc95xx_reset (struct smscusb_device *smscusb) |
Reset device. More... | |
static void | smsc95xx_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
Complete bulk IN transfer. More... | |
static int | smsc95xx_out_transmit (struct smscusb_device *smscusb, struct io_buffer *iobuf) |
Transmit packet. More... | |
static int | smsc95xx_open (struct net_device *netdev) |
Open network device. More... | |
static void | smsc95xx_close (struct net_device *netdev) |
Close network device. More... | |
static int | smsc95xx_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
static void | smsc95xx_poll (struct net_device *netdev) |
Poll for completed and received packets. More... | |
static int | smsc95xx_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
Probe device. More... | |
static void | smsc95xx_remove (struct usb_function *func) |
Remove device. More... | |
Variables | |
static struct profiler smsc95xx_in_profiler | __profiler |
Bulk IN completion profiler. More... | |
static struct usb_endpoint_driver_operations | smsc95xx_in_operations |
Bulk IN endpoint operations. More... | |
static struct net_device_operations | smsc95xx_operations |
SMSC95xx network device operations. More... | |
static struct usb_device_id | smsc95xx_ids [] |
SMSC95xx device IDs. More... | |
struct usb_driver smsc95xx_driver | __usb_driver |
SMSC LAN95xx driver. More... | |
SMSC LAN95xx USB Ethernet driver.
Definition in file smsc95xx.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Construct MAC address for Honeywell VM3.
smscusb | SMSC USB device |
rc | Return status code |
Definition at line 65 of file smsc95xx.c.
References base16_encoded_len(), DBGC, EINVAL, ENOTTY, ETH_ALEN, eth_ntoa(), find_smbios_structure(), net_device::hw_addr, len, mac, smbios_system_information::manufacturer, memset(), netdev, smscusb_device::netdev, smbios_system_information::product, rc, read_smbios_string(), read_smbios_structure(), SMBIOS_TYPE_OEM_STRINGS, SMBIOS_TYPE_SYSTEM_INFORMATION, SMSC95XX_VM3_OEM_STRING_MAC, strcmp(), strerror(), and system.
Referenced by smsc95xx_fetch_mac().
|
static |
Fetch MAC address.
smscusb | SMSC USB device |
rc | Return status code |
Definition at line 167 of file smsc95xx.c.
References DBGC, eth_ntoa(), eth_random_addr(), net_device::hw_addr, netdev, smscusb_device::netdev, rc, SMSC95XX_E2P_BASE, smsc95xx_vm3_fetch_mac(), smscusb_eeprom_fetch_mac(), and smscusb_fdt_fetch_mac().
Referenced by smsc95xx_probe().
|
static |
Dump statistics (for debugging)
smscusb | SMSC USB device |
rc | Return status code |
Definition at line 204 of file smsc95xx.c.
References DBG_LOG, DBGC, le32_to_cpu, rc, rx, SMSC95XX_RX_STATISTICS, SMSC95XX_TX_STATISTICS, smscusb_get_statistics(), strerror(), and tx.
Referenced by smsc95xx_close().
|
static |
Reset device.
smscusb | SMSC USB device |
rc | Return status code |
Definition at line 260 of file smsc95xx.c.
References DBGC, ETIMEDOUT, rc, SMSC95XX_HW_CFG, SMSC95XX_HW_CFG_LRST, SMSC95XX_LED_GPIO_CFG, SMSC95XX_LED_GPIO_CFG_GPCTL0_NFDX_LED, SMSC95XX_LED_GPIO_CFG_GPCTL1_NLNKA_LED, SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED, SMSC95XX_RESET_DELAY_US, smscusb_readl(), smscusb_writel(), strerror(), and udelay().
Referenced by smsc95xx_close(), smsc95xx_open(), and smsc95xx_probe().
|
static |
Complete bulk IN transfer.
ep | USB endpoint |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 309 of file smsc95xx.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, iob_unput, le32_to_cpu, netdev, smscusb_device::netdev, netdev_rx(), netdev_rx_err(), usb_endpoint::open, profile_start(), profile_stop(), rc, SMSC95XX_RX_CRC, SMSC95XX_RX_LATE, SMSC95XX_RX_RUNT, strerror(), and smscusb_device::usbnet.
|
static |
Transmit packet.
smscusb | SMSC USB device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 380 of file smsc95xx.c.
References cpu_to_le32, header, iob_ensure_headroom(), iob_len(), iob_push, len, usbnet_device::out, profile_start(), profile_stop(), rc, SMSC95XX_TX_FIRST, SMSC95XX_TX_LAST, SMSC95XX_TX_LEN, usb_stream(), and smscusb_device::usbnet.
Referenced by smsc95xx_transmit().
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 418 of file smsc95xx.c.
References DBGC, smscusb_device::int_sts, netdev, net_device::priv, rc, SMSC95XX_ADDR_BASE, SMSC95XX_BULK_IN_DLY, SMSC95XX_BULK_IN_DLY_SET, SMSC95XX_HW_CFG, SMSC95XX_HW_CFG_BIR, SMSC95XX_INT_EP_CTL, SMSC95XX_INT_EP_CTL_PHY_EN, SMSC95XX_INT_EP_CTL_RXDF_EN, SMSC95XX_MAC_CR, SMSC95XX_MAC_CR_FDPX, SMSC95XX_MAC_CR_MCPAS, SMSC95XX_MAC_CR_PASSBAD, SMSC95XX_MAC_CR_PRMS, SMSC95XX_MAC_CR_RXALL, SMSC95XX_MAC_CR_RXEN, SMSC95XX_MAC_CR_TXEN, SMSC95XX_MII_PHY_INTR_MASK, SMSC95XX_PHY_INTR_ANEG_DONE, SMSC95XX_PHY_INTR_LINK_DOWN, smsc95xx_reset(), SMSC95XX_TX_CFG, SMSC95XX_TX_CFG_ON, smscusb_mii_open(), smscusb_set_address(), smscusb_writel(), strerror(), smscusb_device::usbnet, usbnet_close(), and usbnet_open().
|
static |
Close network device.
netdev | Network device |
Definition at line 494 of file smsc95xx.c.
References netdev, net_device::priv, smsc95xx_dump_statistics(), smsc95xx_reset(), smscusb_device::usbnet, and usbnet_close().
|
static |
Transmit packet.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 514 of file smsc95xx.c.
References netdev, net_device::priv, rc, and smsc95xx_out_transmit().
|
static |
Poll for completed and received packets.
netdev | Network device |
Definition at line 531 of file smsc95xx.c.
References smscusb_device::bus, DBGC, DBGC2, ENOBUFS, ENOTTY, smscusb_device::int_sts, netdev, netdev_rx_err(), NULL, net_device::priv, rc, SMSC95XX_INT_STS, SMSC95XX_INT_STS_PHY_INT, SMSC95XX_INT_STS_RXDF_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 598 of file smsc95xx.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(), smsc95xx_fetch_mac(), SMSC95XX_IN_MAX_FILL, SMSC95XX_IN_MTU, smsc95xx_in_operations, SMSC95XX_MII_BASE, SMSC95XX_MII_PHY_INTR_SOURCE, smsc95xx_operations, smsc95xx_reset(), 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 661 of file smsc95xx.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 45 of file smsc95xx.c.
|
static |
Bulk IN endpoint operations.
Definition at line 369 of file smsc95xx.c.
Referenced by smsc95xx_probe().
|
static |
SMSC95xx network device operations.
Definition at line 577 of file smsc95xx.c.
Referenced by smsc95xx_probe().
|
static |
SMSC95xx device IDs.
Definition at line 670 of file smsc95xx.c.
struct usb_driver smsc95xx_driver __usb_driver |
SMSC LAN95xx driver.
Definition at line 764 of file smsc95xx.c.