45 { .name =
"smscusb.intr" };
67 DBGCIO ( smscusb,
"SMSCUSB %p [%03x] <= %08x\n",
71 DBGC ( smscusb,
"SMSCUSB %p could not write %03x: %s\n",
94 DBGC ( smscusb,
"SMSCUSB %p could not read %03x: %s\n",
98 DBGCIO ( smscusb,
"SMSCUSB %p [%03x] => %08x\n",
119 unsigned int e2p_base ) {
139 DBGC ( smscusb,
"SMSCUSB %p timed out waiting for EEPROM\n",
153 unsigned int e2p_base,
193 unsigned int e2p_base,
unsigned int address,
217 unsigned int e2p_base ) {
228 DBGC ( smscusb,
"SMSCUSB %p has no EEPROM MAC (%s)\n",
233 DBGC ( smscusb,
"SMSCUSB %p using EEPROM MAC %s\n",
253 unsigned int otp_base ) {
269 &otp_power ) ) != 0 )
278 DBGC ( smscusb,
"SMSCUSB %p timed out waiting for OTP power up\n",
291 unsigned int otp_base ) {
302 &otp_status ) ) != 0 )
311 DBGC ( smscusb,
"SMSCUSB %p timed out waiting for OTP\n",
325 unsigned int otp_base,
373 unsigned int otp_base,
unsigned int address,
402 unsigned int otp_base ) {
422 DBGC ( smscusb,
"SMSCUSB %p unknown OTP signature %#02x\n",
434 DBGC ( smscusb,
"SMSCUSB %p has no layout %#02x OTP MAC (%s)\n",
439 DBGC ( smscusb,
"SMSCUSB %p using layout %#02x OTP MAC %s\n",
472 DBGC ( smscusb,
"SMSCUSB %p using FDT MAC %s\n",
502 &mii_access ) ) != 0 )
511 DBGC ( smscusb,
"SMSCUSB %p timed out waiting for MII\n",
542 mii_access ) ) != 0 )
568 unsigned int data ) {
592 mii_access ) ) != 0 )
623 DBGC ( smscusb,
"SMSCUSB %p could not get PHY interrupt "
631 DBGC ( smscusb,
"SMSCUSB %p could not acknowledge PHY "
632 "interrupt: %s\n", smscusb,
strerror (
rc ) );
638 DBGC ( smscusb,
"SMSCUSB %p could not check link: %s\n",
643 DBGC ( smscusb,
"SMSCUSB %p link %s (intr %#04x)\n",
657 unsigned int phy_mask,
unsigned int intrs ) {
661 if ( (
rc =
mii_write ( &smscusb->
mii, phy_mask, intrs ) ) != 0 ) {
662 DBGC ( smscusb,
"SMSCUSB %p could not set PHY interrupt "
688 unsigned int addr_base ) {
700 mac.addr.h ) ) != 0 )
706 mac.addr.l ) ) != 0 )
720 unsigned int filt_base ) {
733 mac.addr.h ) ) != 0 )
739 mac.addr.l ) ) != 0 )
775 DBGC ( smscusb,
"SMSCUSB %p interrupt failed: %s\n",
784 DBGC ( smscusb,
"SMSCUSB %p malformed interrupt\n",
#define NULL
NULL pointer (VOID *)
u8 signature
CPU signature.
struct arbelprm_rc_send_wqe rc
pseudo_bit_t value[0x00020]
struct bofm_section_header done
uint16_t offset
Offset to command line.
uint8_t data[48]
Additional event data.
uint64_t address
Base address.
uint8_t mac[ETH_ALEN]
MAC address.
uint8_t intr
Interrupts enabled.
static int mii_read(int phy_id, int location)
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
int fdt_mac(struct fdt *fdt, unsigned int offset, struct net_device *netdev)
Get MAC address from property.
int fdt_alias(struct fdt *fdt, const char *name, unsigned int *offset)
Find node by alias.
struct fdt sysfdt
The system flattened device tree (if present)
static struct net_device * netdev
#define __unused
Declare a variable or data structure as unused.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ETIMEDOUT
Connection timed out.
#define ENOTSUP
Operation not supported.
#define ENODEV
No such device.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define le32_to_cpu(value)
#define cpu_to_le32(value)
#define __profiler
Declare a profiler.
static void profile_stop(struct profiler *profiler)
Stop profiling.
static void profile_start(struct profiler *profiler)
Start profiling.
Universal Serial Bus (USB)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static int mii_write(struct mii_device *mii, unsigned int reg, unsigned int data)
Write to MII register.
int mii_check_link(struct mii_device *mii, struct net_device *netdev)
Update link status via MII.
static unsigned int unsigned int reg
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static int smscusb_eeprom_read(struct smscusb_device *smscusb, unsigned int e2p_base, unsigned int address, void *data, size_t len)
Read data from EEPROM.
int smscusb_eeprom_fetch_mac(struct smscusb_device *smscusb, unsigned int e2p_base)
Fetch MAC address from EEPROM.
static void smscusb_out_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk OUT transfer.
struct usb_endpoint_driver_operations smscusb_out_operations
Bulk OUT endpoint operations.
static int smscusb_mii_wait(struct smscusb_device *smscusb)
Wait for MII to become idle.
int smscusb_otp_fetch_mac(struct smscusb_device *smscusb, unsigned int otp_base)
Fetch MAC address from OTP.
static int smscusb_mii_read(struct mii_interface *mdio, unsigned int phy __unused, unsigned int reg)
Read from MII register.
static int smscusb_eeprom_read_byte(struct smscusb_device *smscusb, unsigned int e2p_base, unsigned int address)
Read byte from EEPROM.
struct usb_endpoint_driver_operations smscusb_intr_operations
Interrupt endpoint operations.
int smscusb_fdt_fetch_mac(struct smscusb_device *smscusb)
Fetch MAC address from device tree.
static int smscusb_otp_read_byte(struct smscusb_device *smscusb, unsigned int otp_base, unsigned int address)
Read byte from OTP.
int smscusb_set_address(struct smscusb_device *smscusb, unsigned int addr_base)
Set receive address.
static int smscusb_mii_write(struct mii_interface *mdio, unsigned int phy __unused, unsigned int reg, unsigned int data)
Write to MII register.
int smscusb_set_filter(struct smscusb_device *smscusb, unsigned int filt_base)
Set receive filter.
int smscusb_raw_readl(struct smscusb_device *smscusb, unsigned int address, uint32_t *value)
Read register (without byte-swapping)
struct mii_operations smscusb_mii_operations
MII operations.
static void smscusb_intr_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete interrupt transfer.
static int smscusb_otp_power_up(struct smscusb_device *smscusb, unsigned int otp_base)
Power up OTP.
int smscusb_mii_open(struct smscusb_device *smscusb, unsigned int phy_mask, unsigned int intrs)
Enable PHY interrupts and update link status.
static int smscusb_eeprom_wait(struct smscusb_device *smscusb, unsigned int e2p_base)
Wait for EEPROM to become idle.
int smscusb_raw_writel(struct smscusb_device *smscusb, unsigned int address, uint32_t value)
Write register (without byte-swapping)
int smscusb_mii_check_link(struct smscusb_device *smscusb)
Check link status.
static int smscusb_otp_read(struct smscusb_device *smscusb, unsigned int otp_base, unsigned int address, void *data, size_t len)
Read data from OTP.
static int smscusb_otp_wait(struct smscusb_device *smscusb, unsigned int otp_base)
Wait for OTP to become idle.
SMSC USB Ethernet drivers.
#define SMSCUSB_OTP_GO
OTP command initiation register offset.
#define SMSCUSB_MII_MAX_WAIT_MS
Maximum time to wait for MII (in milliseconds)
#define SMSCUSB_MII_DATA
MII data register offset.
#define SMSCUSB_MII_ACCESS_PHY_ADDRESS
PHY address.
#define SMSCUSB_OTP_2_MAC
OTP layout 2 MAC address offset.
#define SMSCUSB_OTP_ADDRH
OTP address high byte register offset.
#define SMSCUSB_OTP_POWER
OTP power register offset.
#define SMSCUSB_E2P_DATA_GET(e2p_data)
EEPROM data.
#define SMSCUSB_OTP_STATUS_BUSY
OTP busy.
#define SMSCUSB_E2P_CMD
EEPROM command register offset.
#define SMSCUSB_MII_ACCESS_MIIBZY
MII busy.
#define SMSCUSB_ADDR_FILTH_VALID
Address valid.
#define SMSCUSB_RX_ADDRL
MAC receive address low register offset.
#define SMSCUSB_REGISTER_READ
Register read command.
#define SMSCUSB_REGISTER_WRITE
Register write command.
#define SMSCUSB_EEPROM_MAC
MAC address EEPROM address.
#define SMSCUSB_EEPROM_MAX_WAIT_MS
Maximum time to wait for EEPROM (in milliseconds)
#define SMSCUSB_MII_ACCESS_MIIRINDA(addr)
MII register.
#define SMSCUSB_OTP_POWER_DOWN
OTP power down.
#define SMSCUSB_ADDR_FILTH(n)
MAC address perfect filter N high register offset.
#define SMSCUSB_OTP_1_SIG
OTP layout 1 signature.
#define SMSCUSB_OTP_STATUS
OTP status register offset.
#define SMSCUSB_E2P_DATA
EEPROM data register offset.
#define SMSCUSB_E2P_CMD_EPC_BSY
EPC busy.
#define SMSCUSB_E2P_CMD_EPC_ADDR(addr)
EPC address.
#define SMSCUSB_OTP_1_MAC
OTP layout 1 MAC address offset.
#define SMSCUSB_ADDR_FILTL(n)
MAC address perfect filter N low register offset.
#define SMSCUSB_OTP_MAX_WAIT_MS
Maximum time to wait for OTP (in milliseconds)
#define SMSCUSB_OTP_GO_GO
Initiate command.
static int smscusb_readl(struct smscusb_device *smscusb, unsigned int address, uint32_t *value)
Read register.
#define SMSCUSB_MII_ACCESS
MII access register offset.
#define SMSCUSB_MII_ACCESS_MIIWNR
MII write.
#define SMSCUSB_OTP_ADDRL
OTP address low byte register offset.
#define SMSCUSB_E2P_CMD_EPC_CMD_READ
READ command.
static int smscusb_writel(struct smscusb_device *smscusb, unsigned int address, uint32_t value)
Write register.
#define SMSCUSB_OTP_2_SIG
OTP layout 2 signature.
#define SMSCUSB_RX_ADDRH
MAC receive address high register offset.
#define SMSCUSB_MII_DATA_GET(mii_data)
Get data.
#define SMSCUSB_OTP_CMD_READ
Read command.
#define SMSCUSB_OTP_CMD
OTP command selection register offset.
#define SMSCUSB_MII_DATA_SET(data)
Set data.
#define SMSCUSB_OTP_DATA
OTP data register offset.
#define SMSCUSB_OTP_DATA_GET(otp_data)
OTP data.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
void * data
Start of data.
MII interface operations.
A data structure for storing profiling information.
struct usb_device * usb
USB device.
struct net_device * netdev
Network device.
struct mii_device mii
MII device.
uint16_t mii_base
MII register base.
uint32_t int_sts
Interrupt status.
uint16_t phy_source
PHY interrupt source register.
struct mii_interface mdio
MII interface.
struct usbnet_device usbnet
USB network device.
USB endpoint driver operations.
int open
Endpoint is open.
struct usb_endpoint out
Bulk OUT endpoint.
struct usb_endpoint intr
Interrupt endpoint.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.