54 #define drv_version "v1.12" 55 #define drv_date "2004-03-21" 60 #define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) 61 #define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) 64 static int mtu = 1514;
85 static char media[] =
"autosense";
92 #define TX_RING_SIZE 2 93 #define TX_QUEUE_LEN 10 94 #define RX_RING_SIZE 4 99 #define TX_TIME_OUT (4*HZ) 100 #define PKT_BUF_SZ 1536 240 #define rxb rx_tx_buf.rxb 241 #define txb rx_tx_buf.txb 245 #define EEPROM_SIZE 128 254 #define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0) 280 #define EEPROM_SA_OFFSET 0x10 281 #define DEFAULT_INTR (IntrRxDMADone | IntrPCIErr | \ 282 IntrDrvRqst | IntrTxDone | StatsMax | \ 286 static int mdio_read(
struct nic *
nic,
int phy_id,
unsigned int location);
306 duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040;
309 DBG (
"%s: Setting %s-duplex based on MII #%d " 404 for (i = 0; i < 192; i++)
414 DBG (
"%s: Done sundance_reset, status: Rx %hX Tx %hX " 415 "MAC Control %hX, %hX %hX\n",
425 unsigned int intr_status;
464 pkt_len = frame_status & 0x1fff;
466 if (frame_status & 0x001f4000) {
467 DBG (
"Polling frame_status error\n" );
471 printf(
"Poll Error: pkt_len < rx_copybreak");
578 printf(
" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n",
582 for (i = 0; i < 3; i++) {
609 DBG (
"%s: %s at ioaddr %hX, ",
614 int phy, phy_idx = 0;
617 for (phy = 1; phy < 32 && phy_idx <
MII_CNT; phy++) {
619 if (mii_status != 0xffff && mii_status != 0x0000) {
623 if ((mii_status & 0x0040) == 0)
631 printf(
"%s: No MII transceiver found!\n",
683 printf(
"Override speed=%d, %s duplex\n",
701 DBG(
"sundance: NIC reset did not complete.\n");
711 u16 mii_advertise, mii_lpa;
715 mii_advertise &= mii_lpa;
754 int boguscnt = 10000;
761 while (--boguscnt > 0);
775 #define mdio_in(mdio_addr) inb(mdio_addr) 776 #define mdio_out(value, mdio_addr) outb(value, mdio_addr) 777 #define mdio_delay(mdio_addr) inb(mdio_addr) 783 #define MDIO_EnbIn (0) 784 #define MDIO_WRITE0 (MDIO_EnbOutput) 785 #define MDIO_WRITE1 (MDIO_Data | MDIO_EnbOutput) 794 while (--
bits >= 0) {
806 int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location;
813 for (i = 15; i >= 0; i--) {
823 for (i = 19; i > 0; i--) {
831 return (
retval >> 1) & 0xffff;
836 unsigned int location,
int value)
840 (0x5002 << 16) | (phy_id << 23) | (location << 18) |
value;
847 for (i = 31; i >= 0; i--) {
856 for (i = 2; i > 0; i--) {
871 memset(mc_filter, 0xff,
sizeof(mc_filter));
875 mc_filter[3] |= 0x0200;
876 for (i = 0; i < 4; i++)
883 PCI_ROM(0x1186, 0x1002,
"dfe530txs",
"D-Link DFE530TXS (Sundance ST201 Alta)", 0),
884 PCI_ROM(0x13f0, 0x0200,
"ip100a",
"IC+ IP100A", 0),
885 PCI_ROM(0x13f0, 0x0201,
"sundance",
"ST201 Sundance 'Alta' based Adaptor", 0),
uint8_t irq
Interrupt number.
static void sundance_reset(struct nic *nic)
static int sundance_probe(struct nic *nic, struct pci_device *pci)
int printf(const char *fmt,...)
Write a formatted string to the console.
static void init_ring(struct nic *nic __unused)
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
int mii_preamble_required
static void sundance_irq(struct nic *nic, irq_action_t action)
#define le32_to_cpu(value)
#define outw(data, io_addr)
unsigned long ioaddr
I/O address.
#define mdio_out(value, mdio_addr)
static struct netdev_desc tx_ring[TX_RING_SIZE]
static void sundance_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
static unsigned char ee_data[EEPROM_SIZE]
#define ADVERTISE_100FULL
static struct netdev_desc rx_ring[RX_RING_SIZE]
int strcasecmp(const char *first, const char *second)
Compare case-insensitive strings.
FILE_LICENCE(GPL2_OR_LATER)
static void mdio_sync(long mdio_addr)
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
int dummy_connect(struct nic *nic __unused)
void writeb(uint8_t data, volatile uint8_t *io_addr)
Write byte to memory-mapped device.
static void set_rx_mode(struct nic *nic)
DRIVER("SUNDANCE/PCI", nic_driver, pci_driver, sundance_driver, sundance_probe, sundance_disable)
static unsigned long ioaddr
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
uint16_t device
Device ID.
static struct sundance_private sdx
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
static void sundance_disable(struct nic *nic __unused)
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static struct sundance_private * sdc
#define cpu_to_le32(value)
static int sundance_poll(struct nic *nic, int retrieve)
#define outl(data, io_addr)
#define mdio_delay(mdio_addr)
#define mdio_in(mdio_addr)
A PCI device ID list entry.
#define le16_to_cpu(value)
static void mdio_write(struct nic *nic, int phy_id, unsigned int location, int value)
uint16_t vendor
Vendor ID.
static struct nic_operations sundance_operations
unsigned char * node_addr
#define outb(data, io_addr)
static void check_duplex(struct nic *nic)
static volatile void * bits
Media Independent Interface constants.
static struct pci_device_id sundance_nics[]
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
struct pci_device_id * id
Driver device ID.
#define virt_to_le32desc(addr)
struct mii_if_info mii_if
#define PCI_REVISION
PCI revision.
static int eeprom_read(long ioaddr, int location)
PCI_DRIVER(sundance_driver, sundance_nics, PCI_NO_CLASS)
#define ADVERTISE_100HALF
static int mdio_read(struct nic *nic, int phy_id, unsigned int location)
unsigned long currticks(void)
Get current system time in ticks.
#define DBG(...)
Print a debugging message.
struct nic_operations * nic_op
unsigned char phys[MII_CNT]
int(* connect)(struct nic *)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.