iPXE
|
Davicom DM96xx USB Ethernet driver. More...
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ipxe/ethernet.h>
#include <ipxe/usb.h>
#include <ipxe/usbnet.h>
#include "dm96xx.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | dm96xx_reset (struct dm96xx_device *dm96xx) |
Reset device. More... | |
static int | dm96xx_read_mac (struct dm96xx_device *dm96xx, uint8_t *mac) |
Read MAC address. More... | |
static int | dm96xx_write_mac (struct dm96xx_device *dm96xx, uint8_t *mac) |
Write MAC address. More... | |
static void | dm96xx_link_nsr (struct dm96xx_device *dm96xx, unsigned int nsr) |
Update link status based on network status register. More... | |
static int | dm96xx_check_link (struct dm96xx_device *dm96xx) |
Get link status. More... | |
static int | dm96xx_rx_mode (struct dm96xx_device *dm96xx) |
Set DM9601-compatible RX header mode. More... | |
static void | dm96xx_intr_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
Complete interrupt transfer. More... | |
static void | dm96xx_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
Complete bulk IN transfer. More... | |
static int | dm96xx_out_transmit (struct dm96xx_device *dm96xx, struct io_buffer *iobuf) |
Transmit packet. More... | |
static void | dm96xx_out_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
Complete bulk OUT transfer. More... | |
static int | dm96xx_open (struct net_device *netdev) |
Open network device. More... | |
static void | dm96xx_close (struct net_device *netdev) |
Close network device. More... | |
static int | dm96xx_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
static void | dm96xx_poll (struct net_device *netdev) |
Poll for completed and received packets. More... | |
static int | dm96xx_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
Probe device. More... | |
static void | dm96xx_remove (struct usb_function *func) |
Remove device. More... | |
Variables | |
static struct usb_endpoint_driver_operations | dm96xx_intr_operations |
Interrupt endpoint operations. More... | |
static struct usb_endpoint_driver_operations | dm96xx_in_operations |
Bulk IN endpoint operations. More... | |
static struct usb_endpoint_driver_operations | dm96xx_out_operations |
Bulk OUT endpoint operations. More... | |
static struct net_device_operations | dm96xx_operations |
DM96xx network device operations. More... | |
static struct usb_device_id | dm96xx_ids [] |
DM96xx device IDs. More... | |
struct usb_driver dm96xx_driver | __usb_driver |
Davicom DM96xx driver. More... | |
Davicom DM96xx USB Ethernet driver.
Definition in file dm96xx.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Reset device.
dm96xx | DM96xx device |
rc | Return status code |
Definition at line 53 of file dm96xx.c.
References DBGC, DM96XX_NCR, DM96XX_NCR_RST, dm96xx_read_register(), DM96XX_RESET_DELAY_US, dm96xx_write_register(), EIO, rc, strerror(), and udelay().
Referenced by dm96xx_close(), and dm96xx_probe().
|
static |
Read MAC address.
dm96xx | DM96xx device |
mac | MAC address to fill in |
rc | Return status code |
Definition at line 92 of file dm96xx.c.
References DBGC, DM96XX_PAR, dm96xx_read_registers(), ETH_ALEN, mac, rc, and strerror().
Referenced by dm96xx_probe().
|
static |
Write MAC address.
dm96xx | DM96xx device |
mac | MAC address |
rc | Return status code |
Definition at line 113 of file dm96xx.c.
References DBGC, DM96XX_PAR, dm96xx_write_registers(), ETH_ALEN, mac, rc, and strerror().
Referenced by dm96xx_open().
|
static |
Update link status based on network status register.
dm96xx | DM96xx device |
nsr | Network status register |
Definition at line 133 of file dm96xx.c.
References DM96XX_NSR_LINKST, netdev, dm96xx_device::netdev, netdev_link_down(), netdev_link_ok(), and netdev_link_up().
Referenced by dm96xx_check_link(), and dm96xx_intr_complete().
|
static |
Get link status.
dm96xx | DM96xx device |
rc | Return status code |
Definition at line 151 of file dm96xx.c.
References DBGC, dm96xx_link_nsr(), DM96XX_NSR, dm96xx_read_register(), rc, and strerror().
Referenced by dm96xx_open(), and dm96xx_probe().
|
static |
Set DM9601-compatible RX header mode.
dm96xx | DM96xx device |
rc | Return status code |
Definition at line 176 of file dm96xx.c.
References DBGC, DM96XX_CHIPR, DM96XX_CHIPR_9601, DM96XX_MODE_CTL, DM96XX_MODE_CTL_MODE, dm96xx_read_register(), dm96xx_write_register(), rc, and strerror().
Referenced by dm96xx_open().
|
static |
Complete interrupt transfer.
ep | USB endpoint |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 229 of file dm96xx.c.
References container_of, io_buffer::data, DBGC, DBGC_HDA, dm96xx_link_nsr(), done, EINVAL, free_iob(), intr, usbnet_device::intr, iob_len(), len, netdev, dm96xx_device::netdev, netdev_rx_err(), NULL, usb_endpoint::open, rc, strerror(), and dm96xx_device::usbnet.
|
static |
Complete bulk IN transfer.
ep | USB endpoint |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 279 of file dm96xx.c.
References container_of, io_buffer::data, DBGC, DBGC_HDA, DM96XX_RSR_MF, EINVAL, EIO, free_iob(), header, usbnet_device::in, iob_disown, iob_len(), iob_pull, iob_unput, netdev, dm96xx_device::netdev, netdev_rx(), netdev_rx_err(), usb_endpoint::open, rc, strerror(), and dm96xx_device::usbnet.
|
static |
Transmit packet.
dm96xx | DM96xx device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 342 of file dm96xx.c.
References cpu_to_le16, header, iob_ensure_headroom(), iob_len(), iob_push, len, usbnet_device::out, rc, usb_stream(), and dm96xx_device::usbnet.
Referenced by dm96xx_transmit().
|
static |
Complete bulk OUT transfer.
ep | USB endpoint |
iobuf | I/O buffer |
rc | Completion status code |
Definition at line 368 of file dm96xx.c.
References container_of, netdev, dm96xx_device::netdev, netdev_tx_complete_err(), usbnet_device::out, rc, and dm96xx_device::usbnet.
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 396 of file dm96xx.c.
References DBGC, dm96xx_check_link(), DM96XX_RCR, DM96XX_RCR_ALL, DM96XX_RCR_PRMSC, DM96XX_RCR_RUNT, DM96XX_RCR_RXEN, dm96xx_rx_mode(), dm96xx_write_mac(), dm96xx_write_register(), net_device::ll_addr, netdev, net_device::priv, rc, strerror(), dm96xx_device::usbnet, usbnet_close(), and usbnet_open().
|
static |
Close network device.
netdev | Network device |
Definition at line 445 of file dm96xx.c.
References dm96xx_reset(), netdev, net_device::priv, dm96xx_device::usbnet, and usbnet_close().
|
static |
Transmit packet.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 462 of file dm96xx.c.
References dm96xx_out_transmit(), netdev, net_device::priv, and rc.
|
static |
Poll for completed and received packets.
netdev | Network device |
Definition at line 479 of file dm96xx.c.
References dm96xx_device::bus, netdev, netdev_rx_err(), NULL, net_device::priv, rc, usb_poll(), dm96xx_device::usbnet, and usbnet_refill().
|
static |
Probe device.
func | USB function |
config | Configuration descriptor |
rc | Return status code |
Definition at line 513 of file dm96xx.c.
References alloc_etherdev(), dm96xx_device::bus, usb_hub::bus, DBGC, net_device::dev, usb_function::dev, dm96xx_check_link(), DM96XX_IN_MAX_FILL, DM96XX_IN_MTU, dm96xx_in_operations, DM96XX_INTR_MAX_FILL, dm96xx_intr_operations, dm96xx_operations, dm96xx_out_operations, dm96xx_read_mac(), dm96xx_reset(), ENOMEM, usb_port::hub, net_device::hw_addr, usbnet_device::in, usbnet_device::intr, memset(), usb_function::name, netdev, dm96xx_device::netdev, netdev_init(), netdev_nullify(), netdev_put(), usb_device::port, net_device::priv, rc, register_netdev(), strerror(), unregister_netdev(), dm96xx_device::usb, usb_function::usb, usb_func_set_drvdata(), usb_refill_init(), dm96xx_device::usbnet, usbnet_describe(), and usbnet_init().
|
static |
Remove device.
func | USB function |
Definition at line 583 of file dm96xx.c.
References netdev, netdev_nullify(), netdev_put(), unregister_netdev(), and usb_func_get_drvdata().
|
static |
Interrupt endpoint operations.
Definition at line 268 of file dm96xx.c.
Referenced by dm96xx_probe().
|
static |
Bulk IN endpoint operations.
Definition at line 331 of file dm96xx.c.
Referenced by dm96xx_probe().
|
static |
Bulk OUT endpoint operations.
Definition at line 379 of file dm96xx.c.
Referenced by dm96xx_probe().
|
static |
DM96xx network device operations.
Definition at line 492 of file dm96xx.c.
Referenced by dm96xx_probe().
|
static |
struct usb_driver dm96xx_driver __usb_driver |
Davicom DM96xx driver.