FreeBSD kernel usb device Code
|
#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <sys/random.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_media.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include "opt_platform.h"
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/net/usb_ethernet.h>
#include <dev/usb/net/if_smscreg.h>
#include "miibus_if.h"
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR smsc_debug |
#define | SMSC_DEV(p, i) { USB_VPI(USB_VENDOR_SMC2, USB_PRODUCT_SMC2_##p, i) } |
#define | smsc_dbg_printf(sc, fmt, args...) do { } while (0) |
#define | smsc_warn_printf(sc, fmt, args...) device_printf((sc)->sc_ue.ue_dev, "warning: " fmt, ##args) |
#define | smsc_err_printf(sc, fmt, args...) device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args) |
#define | ETHER_IS_VALID(addr) (!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
SYSCTL_NODE (_hw_usb, OID_AUTO, smsc, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB smsc") | |
SYSCTL_BOOL (_hw_usb_smsc, OID_AUTO, smsc_rx_packet_batching, CTLFLAG_RDTUN, &smsc_rx_packet_batching, 0, "If set, allows packet batching to increase throughput and latency. " "Else throughput and latency is decreased.") | |
static int | smsc_attach_post_sub (struct usb_ether *ue) |
static int | smsc_ifmedia_upd (struct ifnet *) |
static void | smsc_ifmedia_sts (struct ifnet *, struct ifmediareq *) |
static int | smsc_chip_init (struct smsc_softc *sc) |
static int | smsc_ioctl (struct ifnet *ifp, u_long cmd, caddr_t data) |
static int | smsc_read_reg (struct smsc_softc *sc, uint32_t off, uint32_t *data) |
static int | smsc_write_reg (struct smsc_softc *sc, uint32_t off, uint32_t data) |
static int | smsc_wait_for_bits (struct smsc_softc *sc, uint32_t reg, uint32_t bits) |
static int | smsc_eeprom_read (struct smsc_softc *sc, uint16_t off, uint8_t *buf, uint16_t buflen) |
static int | smsc_miibus_readreg (device_t dev, int phy, int reg) |
static int | smsc_miibus_writereg (device_t dev, int phy, int reg, int val) |
static void | smsc_miibus_statchg (device_t dev) |
static uint32_t | smsc_hash (uint8_t addr[ETHER_ADDR_LEN]) |
static u_int | smsc_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt) |
static void | smsc_setmulti (struct usb_ether *ue) |
static void | smsc_setpromisc (struct usb_ether *ue) |
static int | smsc_sethwcsum (struct smsc_softc *sc) |
static int | smsc_setmacaddress (struct smsc_softc *sc, const uint8_t *addr) |
static void | smsc_reset (struct smsc_softc *sc) |
static void | smsc_init (struct usb_ether *ue) |
static void | smsc_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | smsc_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | smsc_tick (struct usb_ether *ue) |
static void | smsc_start (struct usb_ether *ue) |
static void | smsc_stop (struct usb_ether *ue) |
static int | smsc_phy_init (struct smsc_softc *sc) |
static void | smsc_attach_post (struct usb_ether *ue) |
static int | smsc_probe (device_t dev) |
static int | smsc_attach (device_t dev) |
static int | smsc_detach (device_t dev) |
DRIVER_MODULE (smsc, uhub, smsc_driver, smsc_devclass, NULL, 0) | |
DRIVER_MODULE (miibus, smsc, miibus_driver, miibus_devclass, 0, 0) | |
MODULE_DEPEND (smsc, uether, 1, 1, 1) | |
MODULE_DEPEND (smsc, usb, 1, 1, 1) | |
MODULE_DEPEND (smsc, ether, 1, 1, 1) | |
MODULE_DEPEND (smsc, miibus, 1, 1, 1) | |
MODULE_VERSION (smsc, 1) | |
USB_PNP_HOST_INFO (smsc_devs) | |
Variables | |
static bool | smsc_rx_packet_batching = 1 |
static const struct usb_device_id | smsc_devs [] |
static device_probe_t | smsc_probe |
static device_attach_t | smsc_attach |
static device_detach_t | smsc_detach |
static usb_callback_t | smsc_bulk_read_callback |
static usb_callback_t | smsc_bulk_write_callback |
static miibus_readreg_t | smsc_miibus_readreg |
static miibus_writereg_t | smsc_miibus_writereg |
static miibus_statchg_t | smsc_miibus_statchg |
static uether_fn_t | smsc_attach_post |
static uether_fn_t | smsc_init |
static uether_fn_t | smsc_stop |
static uether_fn_t | smsc_start |
static uether_fn_t | smsc_tick |
static uether_fn_t | smsc_setmulti |
static uether_fn_t | smsc_setpromisc |
static const struct usb_config | smsc_config [SMSC_N_TRANSFER] |
static const struct usb_ether_methods | smsc_ue_methods |
static device_method_t | smsc_methods [] |
static driver_t | smsc_driver |
static devclass_t | smsc_devclass |
#define smsc_dbg_printf | ( | sc, | |
fmt, | |||
args... | |||
) | do { } while (0) |
#define SMSC_DEV | ( | p, | |
i | |||
) | { USB_VPI(USB_VENDOR_SMC2, USB_PRODUCT_SMC2_##p, i) } |
#define smsc_err_printf | ( | sc, | |
fmt, | |||
args... | |||
) | device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args) |
#define smsc_warn_printf | ( | sc, | |
fmt, | |||
args... | |||
) | device_printf((sc)->sc_ue.ue_dev, "warning: " fmt, ##args) |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | miibus | , |
smsc | , | ||
miibus_driver | , | ||
miibus_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | smsc | , |
uhub | , | ||
smsc_driver | , | ||
smsc_devclass | , | ||
NULL | , | ||
0 | |||
) |
MODULE_DEPEND | ( | smsc | , |
ether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | smsc | , |
miibus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | smsc | , |
uether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | smsc | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | smsc | , |
1 | |||
) |
|
static |
smsc_attach - Attach the interface. @dev: smsc device handle
Allocate softc structures, do ifmedia setup and ethernet/BPF attach.
RETURNS: Returns 0 on success or a negative error code.
Definition at line 1687 of file if_smsc.c.
References dev, usb_attach_arg::device, device_set_usb_desc(), smsc_softc::sc_flags, smsc_softc::sc_mtx, smsc_softc::sc_ue, smsc_softc::sc_xfer, smsc_config, smsc_detach, SMSC_IFACE_IDX, SMSC_N_TRANSFER, smsc_ue_methods, usb_ether::ue_dev, usb_ether::ue_methods, usb_ether::ue_mtx, usb_ether::ue_sc, usb_ether::ue_udev, uether_ifattach(), USB_GET_DRIVER_INFO, and usbd_transfer_setup().
|
static |
smsc_attach_post - Called after the driver attached to the USB interface @ue: the USB ethernet device
This is where the chip is intialised for the first time. This is different from the smsc_init() function in that that one is designed to setup the H/W to match the UE settings and can be called after a reset.
Definition at line 1554 of file if_smsc.c.
References ETHER_IS_VALID, smsc_softc::sc_phyno, smsc_softc::sc_ue, smsc_chip_init(), smsc_dbg_printf, smsc_eeprom_read(), SMSC_MAC_ADDRH, SMSC_MAC_ADDRL, smsc_read_reg(), usb_ether::ue_dev, usb_ether::ue_eaddr, uether_getsc(), and usb_fdt_get_mac_addr().
|
static |
smsc_attach_post_sub - Called after the driver attached to the USB interface @ue: the USB ethernet device
Most of this is boilerplate code and copied from the base USB ethernet driver. It has been overriden so that we can indicate to the system that the chip supports H/W checksumming.
RETURNS: Returns 0 on success or a negative error code.
Definition at line 1614 of file if_smsc.c.
References error, smsc_softc::sc_phyno, smsc_ioctl(), usb_ether::ue_dev, usb_ether::ue_ifp, usb_ether::ue_methods, usb_ether_methods::ue_mii_sts, usb_ether::ue_miibus, uether_getsc(), uether_ifmedia_upd(), uether_init(), and uether_start().
|
static |
smsc_bulk_read_callback - Read callback used to process the USB URB @xfer: the USB transfer @error:
Reads the URB data which can contain one or more ethernet frames, the frames are copyed into a mbuf and given to the system.
LOCKING: No locking required, doesn't access internal driver settings.
Definition at line 948 of file if_smsc.c.
References error, smsc_softc::sc_ue, smsc_dbg_printf, SMSC_RX_STAT_COLLISION, SMSC_RX_STAT_ERROR, SMSC_RX_STAT_FRM_LENGTH, smsc_warn_printf, uether_getifp(), uether_newbuf(), uether_rxflush(), uether_rxmbuf(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_out(), usbd_errstr(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
|
static |
smsc_bulk_write_callback - Write callback used to send ethernet frame(s) @xfer: the USB transfer @error: error code if the transfers is in an errored state
The main write function that pulls ethernet frames off the queue and sends them out.
LOCKING:
Definition at line 1119 of file if_smsc.c.
References error, smsc_softc::sc_flags, smsc_softc::sc_ue, smsc_err_printf, SMSC_FLAG_LINK, SMSC_TX_CTRL_0_BUF_SIZE, SMSC_TX_CTRL_0_FIRST_SEG, SMSC_TX_CTRL_0_LAST_SEG, SMSC_TX_CTRL_1_PKT_LENGTH, uether_getifp(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_in(), usbd_errstr(), usbd_m_copy_in(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_frame_offset(), usbd_xfer_set_frames(), usbd_xfer_set_stall(), and usbd_xfer_softc().
|
static |
smsc_chip_init - Initialises the chip after power on @sc: driver soft context
This initialisation sequence is modelled on the procedure in the Linux driver.
RETURNS: Returns 0 on success or an error code on failure.
Definition at line 1334 of file if_smsc.c.
References AFC_CFG_DEFAULT, smsc_softc::sc_mac_csr, smsc_softc::sc_mtx, smsc_softc::sc_rev_id, smsc_softc::sc_ue, SMSC_AFC_CFG, SMSC_BULK_IN_DLY, SMSC_BURST_CAP, smsc_err_printf, SMSC_FLOW, SMSC_HW_CFG, SMSC_HW_CFG_BCE, SMSC_HW_CFG_BIR, SMSC_HW_CFG_LRST, SMSC_HW_CFG_MEF, SMSC_HW_CFG_RXDOFF, SMSC_ID_REV, SMSC_ID_REV_CHIP_ID_MASK, SMSC_ID_REV_CHIP_REV_MASK, SMSC_INTR_STATUS, SMSC_LED_GPIO_CFG, SMSC_LED_GPIO_CFG_FDX_LED, SMSC_LED_GPIO_CFG_LNK_LED, SMSC_LED_GPIO_CFG_SPD_LED, SMSC_LOCK, SMSC_MAC_CSR, SMSC_MAC_CSR_RXEN, SMSC_MAC_CSR_TXEN, smsc_phy_init(), SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST, smsc_read_reg(), smsc_rx_packet_batching, smsc_setmacaddress(), SMSC_TX_CFG, SMSC_TX_CFG_ON, SMSC_UNLOCK, SMSC_VLAN1, smsc_wait_for_bits(), smsc_warn_printf, smsc_write_reg(), usb_ether::ue_dev, usb_ether::ue_eaddr, usb_ether::ue_udev, USB_SPEED_HIGH, and usbd_get_speed().
Referenced by smsc_attach_post(), and smsc_reset().
|
static |
smsc_detach - Detach the interface. @dev: smsc device handle
RETURNS: Returns 0.
Definition at line 1736 of file if_smsc.c.
References dev, smsc_softc::sc_mtx, smsc_softc::sc_ue, smsc_softc::sc_xfer, SMSC_N_TRANSFER, uether_ifdetach(), and usbd_transfer_unsetup().
|
static |
smsc_eeprom_read - Reads the attached EEPROM @sc: soft context @off: the eeprom address offset @buf: stores the bytes @buflen: the number of bytes to read
Simply reads bytes from an attached eeprom.
LOCKING: The function takes and releases the device lock if it is not already held.
RETURNS: 0 on success, or a USB_ERR_?? error code on failure.
Definition at line 374 of file if_smsc.c.
References smsc_softc::sc_mtx, smsc_softc::sc_ue, SMSC_EEPROM_CMD, SMSC_EEPROM_CMD_ADDR_MASK, SMSC_EEPROM_CMD_BUSY, SMSC_EEPROM_CMD_TIMEOUT, SMSC_EEPROM_DATA, SMSC_LOCK, smsc_read_reg(), SMSC_UNLOCK, smsc_wait_for_bits(), smsc_warn_printf, smsc_write_reg(), uether_pause(), USB_ERR_IOERROR, USB_MS_TO_TICKS, and val.
Referenced by smsc_attach_post().
|
inlinestatic |
smsc_hash - Calculate the hash of a mac address @addr: The mac address to calculate the hash on
This function is used when configuring a range of m'cast mac addresses to filter on. The hash of the mac address is put in the device's mac hash table.
RETURNS: Returns a value from 0-63 value which is the hash of the mac address.
Definition at line 685 of file if_smsc.c.
References addr.
Referenced by smsc_hash_maddr().
|
static |
Definition at line 691 of file if_smsc.c.
References smsc_hash().
Referenced by smsc_setmulti().
|
static |
smsc_ifmedia_sts - Report current media status @ifp: inet interface pointer @ifmr: interface media request
Basically boilerplate code that simply calls the mii functions to get the media status.
LOCKING: Internally takes and releases the device lock.
Definition at line 661 of file if_smsc.c.
References smsc_softc::sc_ue, SMSC_LOCK, SMSC_UNLOCK, and uether_getmii().
|
static |
smsc_ifmedia_upd - Set media options @ifp: interface pointer
Basically boilerplate code that simply calls the mii functions to set the media options.
LOCKING: The device lock must be held before this function is called.
RETURNS: Returns 0 on success or a negative error code.
Definition at line 634 of file if_smsc.c.
References smsc_softc::sc_ue, SMSC_LOCK_ASSERT, and uether_getmii().
Referenced by smsc_init().
|
static |
smsc_init - Initialises the LAN95xx chip @ue: USB ether interface
Called when the interface is brought up (i.e. ifconfig ue0 up), this initialise the interface and the rx/tx pipes.
LOCKING: Should be called with the SMSC lock held.
Definition at line 901 of file if_smsc.c.
References smsc_softc::sc_xfer, SMSC_BULK_DT_WR, smsc_dbg_printf, smsc_ifmedia_upd(), SMSC_LOCK_ASSERT, smsc_reset(), smsc_sethwcsum(), smsc_setmacaddress(), smsc_setmulti, smsc_start, smsc_stop, uether_getifp(), uether_getsc(), and usbd_xfer_set_stall().
|
static |
smsc_ioctl - ioctl function for the device @ifp: interface pointer @cmd: the ioctl command @data: data passed in the ioctl call, typically a pointer to struct ifreq.
The ioctl routine is overridden to detect change requests for the H/W checksum capabilities.
RETURNS: 0 on success and an error code on failure.
Definition at line 1501 of file if_smsc.c.
References data, SMSC_LOCK, SMSC_UNLOCK, uether_getsc(), uether_init(), and uether_ioctl().
Referenced by smsc_attach_post_sub().
|
static |
smsc_miibus_readreg - Reads a MII/MDIO register @dev: usb ether device @phy: the number of phy reading from @reg: the register address
Attempts to read a phy register over the MII bus.
LOCKING: Takes and releases the device mutex lock if not already held.
RETURNS: Returns the 16-bits read from the MII register, if this function fails 0 is returned.
Definition at line 444 of file if_smsc.c.
References addr, dev, reg, smsc_softc::sc_mtx, SMSC_LOCK, SMSC_MII_ADDR, SMSC_MII_BUSY, SMSC_MII_DATA, SMSC_MII_READ, smsc_read_reg(), SMSC_UNLOCK, smsc_wait_for_bits(), smsc_warn_printf, smsc_write_reg(), and val.
|
static |
smsc_miibus_statchg - Called to detect phy status change @dev: usb ether device
This function is called periodically by the system to poll for status changes of the link.
LOCKING: Takes and releases the device mutex lock if not already held.
Definition at line 536 of file if_smsc.c.
References dev, smsc_softc::sc_flags, smsc_softc::sc_mac_csr, smsc_softc::sc_mtx, smsc_softc::sc_ue, SMSC_AFC_CFG, smsc_dbg_printf, SMSC_FLAG_LINK, SMSC_FLOW, SMSC_LOCK, SMSC_MAC_CSR, SMSC_MAC_CSR_FDPX, SMSC_MAC_CSR_RCVOWN, smsc_read_reg(), SMSC_UNLOCK, smsc_warn_printf, smsc_write_reg(), uether_getifp(), and uether_getmii().
|
static |
smsc_miibus_writereg - Writes a MII/MDIO register @dev: usb ether device @phy: the number of phy writing to @reg: the register address @val: the value to write
Attempts to write a phy register over the MII bus.
LOCKING: Takes and releases the device mutex lock if not already held.
RETURNS: Always returns 0 regardless of success or failure.
Definition at line 492 of file if_smsc.c.
References addr, dev, reg, smsc_softc::sc_mtx, smsc_softc::sc_phyno, SMSC_LOCK, SMSC_MII_ADDR, SMSC_MII_BUSY, SMSC_MII_DATA, SMSC_MII_WRITE, SMSC_UNLOCK, smsc_wait_for_bits(), smsc_warn_printf, smsc_write_reg(), and val.
|
static |
smsc_phy_init - Initialises the in-built SMSC phy @sc: driver soft context
Resets the PHY part of the chip and then initialises it to default values. The 'link down' and 'auto-negotiation complete' interrupts from the PHY are also enabled, however we don't monitor the interrupt endpoints for the moment.
RETURNS: Returns 0 on success or EIO if failed to reset the PHY.
Definition at line 1282 of file if_smsc.c.
References smsc_softc::sc_phyno, smsc_softc::sc_ue, smsc_err_printf, SMSC_LOCK_ASSERT, smsc_miibus_readreg, smsc_miibus_writereg, SMSC_PHY_INTR_ANEG_COMP, SMSC_PHY_INTR_LINK_DOWN, SMSC_PHY_INTR_MASK, SMSC_PHY_INTR_STAT, usb_ether::ue_dev, uether_pause(), and USB_MS_TO_TICKS.
Referenced by smsc_chip_init().
|
static |
smsc_probe - Probe the interface. @dev: smsc device handle
Checks if the device is a match for this driver.
RETURNS: Returns 0 on success or an error code on failure.
Definition at line 1663 of file if_smsc.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, SMSC_CONFIG_INDEX, smsc_devs, SMSC_IFACE_IDX, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
smsc_read_reg - Reads a 32-bit register on the device @sc: driver soft context @off: offset of the register @data: pointer a value that will be populated with the register value
LOCKING: The device lock must be held before calling this function.
RETURNS: 0 on success, a USB_ERR_?? error code on failure.
Definition at line 264 of file if_smsc.c.
References data, req, smsc_softc::sc_ue, SMSC_LOCK_ASSERT, SMSC_UR_READ_REG, smsc_warn_printf, uether_do_request, USETW, and UT_READ_VENDOR_DEVICE.
Referenced by smsc_attach_post(), smsc_chip_init(), smsc_eeprom_read(), smsc_miibus_readreg(), smsc_miibus_statchg(), smsc_sethwcsum(), and smsc_wait_for_bits().
|
static |
smsc_reset - Reset the SMSC chip @sc: device soft context
LOCKING: Should be called with the SMSC lock held.
Definition at line 871 of file if_smsc.c.
References usb_config_descriptor::bConfigurationValue, smsc_softc::sc_mtx, smsc_softc::sc_ue, smsc_chip_init(), smsc_warn_printf, usb_ether::ue_udev, uether_pause(), usbd_get_config_descriptor(), and usbd_req_set_config().
Referenced by smsc_init().
|
static |
smsc_sethwcsum - Enable or disable H/W UDP and TCP checksumming @sc: driver soft context
LOCKING: Should be called with the SMSC lock held.
RETURNS: Returns 0 on success or a negative error code.
Definition at line 789 of file if_smsc.c.
References smsc_softc::sc_ue, SMSC_COE_CTRL, SMSC_COE_CTRL_RX_EN, SMSC_COE_CTRL_TX_EN, SMSC_LOCK_ASSERT, smsc_read_reg(), smsc_warn_printf, smsc_write_reg(), uether_getifp(), and val.
Referenced by smsc_init().
|
static |
smsc_setmacaddress - Sets the mac address in the device @sc: driver soft context @addr: pointer to array contain at least 6 bytes of the mac
Writes the MAC address into the device, usually the MAC is programmed with values from the EEPROM.
LOCKING: Should be called with the SMSC lock held.
RETURNS: Returns 0 on success or a negative error code.
Definition at line 842 of file if_smsc.c.
References addr, smsc_dbg_printf, SMSC_LOCK_ASSERT, SMSC_MAC_ADDRH, SMSC_MAC_ADDRL, smsc_write_reg(), and val.
Referenced by smsc_chip_init(), and smsc_init().
|
static |
smsc_setmulti - Setup multicast @ue: usb ethernet device context
Tells the device to either accept frames with a multicast mac address, a select group of m'cast mac addresses or just the devices mac address.
LOCKING: Should be called with the SMSC lock held.
Definition at line 712 of file if_smsc.c.
References smsc_softc::sc_mac_csr, smsc_dbg_printf, smsc_hash_maddr(), SMSC_HASHH, SMSC_HASHL, SMSC_LOCK_ASSERT, SMSC_MAC_CSR, SMSC_MAC_CSR_HPFILT, SMSC_MAC_CSR_MCPAS, SMSC_MAC_CSR_PRMS, smsc_write_reg(), uether_getifp(), and uether_getsc().
|
static |
smsc_setpromisc - Enables/disables promiscuous mode @ue: usb ethernet device context
LOCKING: Should be called with the SMSC lock held.
Definition at line 761 of file if_smsc.c.
References smsc_softc::sc_mac_csr, smsc_dbg_printf, SMSC_LOCK_ASSERT, SMSC_MAC_CSR, SMSC_MAC_CSR_PRMS, smsc_write_reg(), uether_getifp(), and uether_getsc().
|
static |
smsc_start - Starts communication with the LAN95xx chip @ue: USB ether interface
Definition at line 1233 of file if_smsc.c.
References smsc_softc::sc_xfer, SMSC_BULK_DT_RD, SMSC_BULK_DT_WR, uether_getsc(), and usbd_transfer_start().
|
static |
smsc_stop - Stops communication with the LAN95xx chip @ue: USB ether interface
Definition at line 1252 of file if_smsc.c.
References smsc_softc::sc_flags, smsc_softc::sc_xfer, SMSC_BULK_DT_RD, SMSC_BULK_DT_WR, SMSC_LOCK_ASSERT, uether_getifp(), uether_getsc(), and usbd_transfer_stop().
|
static |
smsc_tick - Called periodically to monitor the state of the LAN95xx chip @ue: USB ether interface
Simply calls the mii status functions to check the state of the link.
LOCKING: Should be called with the SMSC lock held.
Definition at line 1210 of file if_smsc.c.
References smsc_softc::sc_flags, smsc_softc::sc_ue, SMSC_FLAG_LINK, SMSC_LOCK_ASSERT, smsc_miibus_statchg, smsc_start, usb_ether::ue_dev, uether_getmii(), and uether_getsc().
|
static |
smsc_wait_for_bits - Polls on a register value until bits are cleared @sc: soft context @reg: offset of the register @bits: if the bits are clear the function returns
LOCKING: The device lock must be held before calling this function.
RETURNS: 0 on success, or a USB_ERR_?? error code on failure.
Definition at line 336 of file if_smsc.c.
References reg, smsc_softc::sc_ue, SMSC_LOCK_ASSERT, smsc_read_reg(), uether_pause(), USB_ERR_TIMEOUT, USB_MS_TO_TICKS, and val.
Referenced by smsc_chip_init(), smsc_eeprom_read(), smsc_miibus_readreg(), and smsc_miibus_writereg().
|
static |
smsc_write_reg - Writes a 32-bit register on the device @sc: driver soft context @off: offset of the register @data: the 32-bit value to write into the register
LOCKING: The device lock must be held before calling this function.
RETURNS: 0 on success, a USB_ERR_?? error code on failure.
Definition at line 300 of file if_smsc.c.
References data, req, smsc_softc::sc_ue, SMSC_LOCK_ASSERT, SMSC_UR_WRITE_REG, smsc_warn_printf, uether_do_request, USETW, and UT_WRITE_VENDOR_DEVICE.
Referenced by smsc_chip_init(), smsc_eeprom_read(), smsc_miibus_readreg(), smsc_miibus_statchg(), smsc_miibus_writereg(), smsc_sethwcsum(), smsc_setmacaddress(), smsc_setmulti(), and smsc_setpromisc().
SYSCTL_BOOL | ( | _hw_usb_smsc | , |
OID_AUTO | , | ||
smsc_rx_packet_batching | , | ||
CTLFLAG_RDTUN | , | ||
& | smsc_rx_packet_batching, | ||
0 | , | ||
"If | set, | ||
allows packet batching to increase throughput and latency. " "Else throughput and latency is decreased." | |||
) |
SYSCTL_NODE | ( | _hw_usb | , |
OID_AUTO | , | ||
smsc | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
"USB smsc" | |||
) |
USB_PNP_HOST_INFO | ( | smsc_devs | ) |
|
static |
|
static |
|
static |
|
static |
Definition at line 210 of file if_smsc.c.
Referenced by smsc_attach().
|
static |
Definition at line 186 of file if_smsc.c.
Referenced by smsc_attach().
|
static |
Definition at line 142 of file if_smsc.c.
Referenced by smsc_probe().
|
static |
|
static |
|
static |
|
static |
Definition at line 191 of file if_smsc.c.
Referenced by smsc_phy_init().
|
static |
Definition at line 193 of file if_smsc.c.
Referenced by smsc_tick().
|
static |
Definition at line 192 of file if_smsc.c.
Referenced by smsc_phy_init().
|
static |
Definition at line 125 of file if_smsc.c.
Referenced by smsc_chip_init().
|
static |
Definition at line 201 of file if_smsc.c.
Referenced by smsc_init().
|
static |
|
static |
Definition at line 199 of file if_smsc.c.
Referenced by smsc_init(), and smsc_tick().
|
static |
Definition at line 198 of file if_smsc.c.
Referenced by smsc_init().
|
static |
|
static |
Definition at line 237 of file if_smsc.c.
Referenced by smsc_attach().