177 DBGP (
"ifec_pci_probe: " );
210 &
priv->mdio_register, 2 );
240 DBGP (
"ifec_pci_remove\n" );
261 unsigned short intr_status;
263 DBGP (
"ifec_net_close\n" );
280 #define INTERRUPT_MASK ( SCBMaskEarlyRx | SCBMaskFlowCtl ) 295 DBGP (
"ifec_net_irq\n" );
317 DBGP (
"ifec_net_open: " );
355 cfg->byte[19] = (
options & 0x10 ) ? 0xC0 : 0x80;
361 priv->configured = 1;
364 for ( i = 10; i && !
cfg->status; i-- )
366 if ( !
cfg->status ) {
367 DBG (
"Failed to initiate!\n" );
379 DBG2 (
"rx_start\n" );
403 unsigned short intr_status;
405 DBGP (
"ifec_net_poll\n" );
412 DBG2 (
"poll - status: 0x%04X\n", intr_status );
443 DBGP (
"ifec_net_transmit\n" );
447 DBG (
"TX overflow\n" );
451 DBG2 (
"transmitting packet (%zd bytes). status = %hX, cmd=%hX\n",
455 tcb->
count = 0x01208000;
463 priv->tcb_head = tcb;
486 unsigned int bit_id )
491 unsigned int ret = 0;
494 DBGP (
"ifec_spi_read_bit\n" );
499 return ( ret & mask ) ? 1 : 0;
520 DBGP (
"ifec_spi_write_bit\n" );
544 DBGP (
"ifec_init_eeprom\n" );
555 init_at93c46 ( &
priv->eeprom, 16 );
561 if (
priv->eeprom.address_len == 8 )
562 init_at93c66 ( &
priv->eeprom, 16 );
579 DBGP (
"ifec_mdio_read\n" );
581 outl ( 0x08000000 | ( location << 16 ) | ( phy_id << 21 ),
588 if ( --boguscnt < 0 ) {
589 DBG (
" ifec_mdio_read() time out with val = %X.\n",
593 }
while (! (
val & 0x10000000 ) );
608 DBGP (
"ifec_mdio_setup\n" );
613 & 0x1f, 23 ) | 0x0422;
616 DBG2 (
"DP83840 specific setup, setting register 23 to " 617 "%hX.\n", mdi_reg23 );
623 ( (
options & 0x20) ? 0x2000 : 0 ) |
624 ( (
options & 0x10) ? 0x0100 : 0 ) );
625 DBG2 (
"set mdio_register. " );
636 int phy_id,
int location,
int value )
643 DBGP (
"ifec_mdio_write\n" );
645 outl ( 0x04000000 | ( location << 16 ) | ( phy_id << 21 ) |
value,
651 if ( --boguscnt < 0 ) {
652 DBG (
" ifec_mdio_write() time out with val = %X.\n",
656 }
while (! (
val & 0x10000000 ) );
670 DBGP (
"ifec_reset\n" );
696 DBGP (
"ifec_free\n" );
720 DBGP (
"ifec_rfd_init\n" );
740 DBGP (
"ifec_reprime_ru\n" );
755 unsigned short intr_status )
759 DBGP (
"ifec_check_ru_status\n" );
765 switch ( ( intr_status >> 2 ) & 0xf ) {
774 DBG (
"ifec_net_poll: RU reprimed.\n" );
779 DBG (
"ifec_net_poll: RU state anomaly: %i\n",
785 #define RFD_STATUS ( RFD_OK | RFDRxCol | RFDRxErr | RFDShort | \ 786 RFDDMAOverrun | RFDNoBufs | RFDCRCError ) 802 DBGP (
"ifec_rx_process\n" );
808 DBG2 (
"Got a packet: Len = %d, cur_rx = %d.\n", rx_len,
813 DBG (
"Corrupted packet received. " 814 "Status = %#08hx\n",
status );
819 DBG2 (
"Received packet: %p, len: %d\n", iob, rx_len );
853 DBGP (
"ifec_get_rx_desc\n" );
856 if ( !
priv->rx_iobs[cur] ) {
857 DBG (
"alloc_iob failed. desc. nr: %d\n", cur );
863 priv->rfds[cur] =
priv->rx_iobs[cur]->data;
879 unsigned short intr_status;
881 DBGP (
"ifec_refill_rx_ring\n" );
920 DBGP (
"ifec_rx_setup\n" );
948 DBGP (
"ifec_scb_cmd\n" );
967 unsigned long cmd_ioaddr =
priv->ioaddr +
SCBCmd;
970 DBGP (
"ifec_scb_cmd_wait\n" );
972 for ( ; wait && (
rc =
inb ( cmd_ioaddr ) ); wait-- )
976 DBG (
"ifec_scb_cmd_wait timeout!\n" );
991 DBGP (
"ifec_tx_process\n" );
997 DBG (
"ifec_tx_process : tx error!\n " );
1003 DBG2 (
"tx completion\n" );
1025 DBGP (
"ifec_tx_setup\n" );
1029 if ( !
priv->tcbs ) {
1030 DBG (
"TX-ring allocation failed\n" );
1038 for ( i = 0; i <
TCB_COUNT; i++, tcb++ ) {
1040 tcb->
count = 0x01208000;
1044 tcb->
next = tcb + 1;
1048 priv->tcb_head = --tcb;
1078 DBGP (
"ifec_tx_wake\n" );
1082 if (
priv->configured ) {
1083 priv->configured = 0;
1092 DBG2 (
"ifec_tx_wake: tx idle!\n" );
1113 PCI_ROM(0x8086, 0x1029,
"id1029",
"Intel EtherExpressPro100 ID1029", 0),
1114 PCI_ROM(0x8086, 0x1030,
"id1030",
"Intel EtherExpressPro100 ID1030", 0),
1115 PCI_ROM(0x8086, 0x1031,
"82801cam",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1116 PCI_ROM(0x8086, 0x1032,
"eepro100-1032",
"Intel PRO/100 VE Network Connection", 0),
1117 PCI_ROM(0x8086, 0x1033,
"eepro100-1033",
"Intel PRO/100 VM Network Connection", 0),
1118 PCI_ROM(0x8086, 0x1034,
"eepro100-1034",
"Intel PRO/100 VM Network Connection", 0),
1119 PCI_ROM(0x8086, 0x1035,
"eepro100-1035",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1120 PCI_ROM(0x8086, 0x1036,
"eepro100-1036",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1121 PCI_ROM(0x8086, 0x1037,
"eepro100-1037",
"Intel 82801CAM (ICH3) Chipset Ethernet Controller", 0),
1122 PCI_ROM(0x8086, 0x1038,
"id1038",
"Intel PRO/100 VM Network Connection", 0),
1123 PCI_ROM(0x8086, 0x1039,
"82562et",
"Intel PRO100 VE 82562ET", 0),
1124 PCI_ROM(0x8086, 0x103a,
"id103a",
"Intel Corporation 82559 InBusiness 10/100", 0),
1125 PCI_ROM(0x8086, 0x103b,
"82562etb",
"Intel PRO100 VE 82562ETB", 0),
1126 PCI_ROM(0x8086, 0x103c,
"eepro100-103c",
"Intel PRO/100 VM Network Connection", 0),
1127 PCI_ROM(0x8086, 0x103d,
"eepro100-103d",
"Intel PRO/100 VE Network Connection", 0),
1128 PCI_ROM(0x8086, 0x103e,
"eepro100-103e",
"Intel PRO/100 VM Network Connection", 0),
1129 PCI_ROM(0x8086, 0x1050,
"82562ez",
"Intel 82562EZ Network Connection", 0),
1130 PCI_ROM(0x8086, 0x1051,
"prove",
"Intel PRO/100 VE Network Connection", 0),
1131 PCI_ROM(0x8086, 0x1059,
"82551qm",
"Intel PRO/100 M Mobile Connection", 0),
1132 PCI_ROM(0x8086, 0x1065,
"82562-3",
"Intel 82562 based Fast Ethernet Connection", 0),
1133 PCI_ROM(0x8086, 0x1092,
"82562-3",
"Intel Pro/100 VE Network", 0),
1134 PCI_ROM(0x8086, 0x10fe,
"82552",
"Intel 82552 10/100 Network Connection", 0),
1135 PCI_ROM(0x8086, 0x1209,
"82559er",
"Intel EtherExpressPro100 82559ER", 0),
1136 PCI_ROM(0x8086, 0x1227,
"82865",
"Intel 82865 EtherExpress PRO/100A", 0),
1137 PCI_ROM(0x8086, 0x1228,
"82556",
"Intel 82556 EtherExpress PRO/100 Smart", 0),
1138 PCI_ROM(0x8086, 0x1229,
"eepro100",
"Intel EtherExpressPro100", 0),
1139 PCI_ROM(0x8086, 0x2449,
"82562em",
"Intel EtherExpressPro100 82562EM", 0),
1140 PCI_ROM(0x8086, 0x2459,
"82562-1",
"Intel 82562 based Fast Ethernet Connection", 0),
1141 PCI_ROM(0x8086, 0x245d,
"82562-2",
"Intel 82562 based Fast Ethernet Connection", 0),
1142 PCI_ROM(0x8086, 0x27dc,
"eepro100-27dc",
"Intel 82801G (ICH7) Chipset Ethernet Controller", 0),
1143 PCI_ROM(0x8086, 0x5200,
"eepro100-5200",
"Intel EtherExpress PRO/100 Intelligent Server", 0),
1144 PCI_ROM(0x8086, 0x5201,
"eepro100-5201",
"Intel EtherExpress PRO/100 Intelligent Server", 0),
static void ifec_net_poll(struct net_device *netdev)
#define EINVAL
Invalid argument.
struct bit_basher basher
Bit-bashing interface.
struct arbelprm_rc_send_wqe rc
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
struct spi_bit_basher spi
struct pci_driver ifec_driver __pci_driver
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
static void ifec_pci_remove(struct pci_device *pci)
int(* open)(struct net_device *netdev)
Open network device.
#define EEPROM_ADDR_MAC_0
#define outw(data, io_addr)
unsigned long ioaddr
I/O address.
SPI bit-bashing interface.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
static void ifec_init_eeprom(struct net_device *netdev)
struct arbelprm_completion_with_error error
static void ifec_reprime_ru(struct net_device *netdev)
static void ifec_tx_process(struct net_device *netdev)
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
static int ifec_scb_cmd(struct net_device *netdev, u32 ptr, u8 cmd)
static void ifec_refill_rx_ring(struct net_device *netdev)
static void ifec_spi_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct device dev
Generic device.
static struct pci_device_id ifec_nics[]
Dynamic memory allocation.
static void ifec_check_ru_status(struct net_device *netdev, unsigned short intr_status)
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
static int ifec_pci_probe(struct pci_device *pci)
static unsigned long ioaddr
void * memcpy(void *dest, const void *src, size_t len) __nonnull
Three-wire serial interface.
static void ifec_free(struct net_device *netdev)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static const uint16_t ifec_ee_bits[]
#define container_of(ptr, type, field)
Get containing structure.
#define EEPROM_ADDR_MDIO_REGISTER
void * priv
Driver private data.
pseudo_bit_t value[0x00020]
void init_spi_bit_basher(struct spi_bit_basher *spibit)
Initialise SPI bit-bashing interface.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static struct net_device * netdev
u32 link
Link to next descriptor.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
static int ifec_net_open(struct net_device *netdev)
int(* read)(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
static int ifec_spi_read_bit(struct bit_basher *basher, unsigned int bit_id)
FILE_LICENCE(GPL2_OR_LATER)
#define outl(data, io_addr)
static int ifec_net_transmit(struct net_device *netdev, struct io_buffer *iobuf)
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static void ifec_mdio_setup(struct net_device *netdev, int options)
static int ifec_tx_setup(struct net_device *netdev)
static void ifec_reset(struct net_device *netdev)
#define SPI_BIT_SS(slave)
Determine bit index for a particular slave.
int threewire_detect_address_len(struct spi_device *device)
Autodetect device address length.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void ifec_rfd_init(struct ifec_rfd *rfd, s16 command, u32 link)
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
static void ifec_net_irq(struct net_device *netdev, int enable)
char packet[RFD_PACKET_LEN]
A PCI device ID list entry.
static void ifec_rx_process(struct net_device *netdev)
static struct xen_remove_from_physmap * remove
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
static int ifec_rx_setup(struct net_device *netdev)
Network device management.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
static int ifec_mdio_read(struct net_device *netdev, int phy_id, int location)
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define iob_reserve(iobuf, len)
static void ifec_net_close(struct net_device *netdev)
#define outb(data, io_addr)
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
unsigned short mdio_register
static int ifec_scb_cmd_wait(struct net_device *netdev)
#define ENOBUFS
No buffer space available.
static struct tlan_private * priv
int(* probe)(struct pci_device *pci)
Probe device.
static unsigned int cur_rx
static int ifec_get_rx_desc(struct net_device *netdev, int cur, int cmd, int link)
void * data
Start of data.
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
uint8_t data[48]
Additional event data.
int nvs_read(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read from non-volatile storage device.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
#define SPI_MODE_THREEWIRE
Threewire-compatible mode.
void ifec_tx_wake(struct net_device *netdev)
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define DBG(...)
Print a debugging message.
static struct net_device_operations ifec_operations
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static struct bit_basher_operations ifec_basher_ops
static int ifec_mdio_write(struct net_device *netdev, int phy_id, int location, int value)
void * memset(void *dest, int character, size_t len) __nonnull