47 PCI_ROM(0x10b7, 0x1700,
"3C940",
"3COM 3C940", 0),
48 PCI_ROM(0x10b7, 0x80eb,
"3C940B",
"3COM 3C940", 0),
49 PCI_ROM(0x1148, 0x4300,
"GE",
"Syskonnect GE", 0),
50 PCI_ROM(0x1148, 0x4320,
"YU",
"Syskonnect YU", 0),
51 PCI_ROM(0x1186, 0x4C00,
"DGE510T",
"DLink DGE-510T", 0),
52 PCI_ROM(0x1186, 0x4b01,
"DGE530T",
"DLink DGE-530T", 0),
53 PCI_ROM(0x11ab, 0x4320,
"id4320",
"Marvell id4320", 0),
54 PCI_ROM(0x11ab, 0x5005,
"id5005",
"Marvell id5005", 0),
55 PCI_ROM(0x1371, 0x434e,
"Gigacard",
"CNET Gigacard", 0),
56 PCI_ROM(0x1737, 0x1064,
"EG1064",
"Linksys EG1064", 0),
57 PCI_ROM(0x1737, 0xffff,
"id_any",
"Linksys [any]", 0)
129 return hwkhz(
hw) * usec / 1000;
322 for (i = 0, e = ring->
start, d = vaddr; i <
num; i++, e++, d++) {
401 DBG2(
PFX "%s: Link is up at %d Mbps, %s duplex\n",
453 DBG(
PFX "%s: phy read timed out\n",
510 const u8 zero[8] = { 0 };
576 DBG(
PFX "%s: remote fault\n",
592 DBG(
PFX "%s: duplex mismatch\n",
629 static const struct {
633 { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 },
634 { 0x17, 0x0013 }, { 0x15, 0x0404 }, { 0x17, 0x8006 },
635 { 0x15, 0x0132 }, { 0x17, 0x8006 }, { 0x15, 0x0232 },
636 { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 },
638 { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1204 },
639 { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 },
658 C0hack[i].
reg, C0hack[i].
val);
668 A1hack[i].
reg, A1hack[i].
val);
776 DBG(
PFX "%s: remote fault\n",
792 DBG(
PFX "%s: duplex mismatch\n",
838 for (i = 0; i < 3; i++) {
858 const u8 zero[6] = { 0 };
860 for (i = 0; i < 10; i++) {
868 DBG(
PFX "%s: genesis reset failed\n", dev->
name);
894 switch(
hw->phy_type) {
907 for (i = 1; i < 16; i++)
1002 unsigned retries = 1000;
1022 }
while (--retries > 0);
1136 DBGIO(
PFX "%s: phy interrupt status 0x%x\n",
1140 DBG(
PFX "%s: uncorrectable pair swap error\n",
1173 DBG(
PFX "%s: phy write timeout port %x reg %x val %x\n",
1203 DBG(
PFX "%s: phy read timeout port %x reg %x val %x\n",
1273 switch (skge->
speed) {
1369 switch (skge->
speed) {
1572 u16 istatus, phystat;
1577 DBGIO(
PFX "%s: phy interrupt status 0x%x 0x%x\n",
1588 reason =
"master/slave fault";
1638 DBG(
PFX "%s: autonegotiation failed (%s)\n",
1679 u32 watermark = 0x600;
1712 u32 chunk, ram_addr;
1727 DBG(
PFX "pci_alloc_consistent region crosses 4G boundary\n");
1754 chunk = (
hw->ram_size -
hw->ram_offset) / (
hw->ports * 2);
1755 ram_addr =
hw->ram_offset + 2 * chunk *
port;
1895 DBGIO(
PFX "%s: tx queued, slot %td, len %d\n",
1902 DBG(
PFX "%s: transmit queue full\n", dev->
name);
1988 DBG(
"descr %zd: alloc_iob() failed\n",
2038 DBG2(
"received packet, len %d\n",
len);
2101 static const struct {
2114 static char buf[16];
2120 snprintf(buf,
sizeof buf,
"chipid 0x%x",
hw->chip_id);
2132 u16 ctst, pci_status;
2133 u8 t8, mac_cfg, pmd_type;
2159 hw->copper = (pmd_type ==
'T' || pmd_type ==
'1');
2161 switch (
hw->chip_id) {
2163 switch (
hw->phy_type) {
2171 DBG(
PFX "unsupported phy type 0x%x\n",
2187 DBG(
PFX "unsupported chip type 0x%x\n",
2201 hw->ram_size = 0x100000;
2202 hw->ram_offset = 0x80000;
2204 hw->ram_size = t8 * 512;
2207 hw->ram_size = 0x20000;
2209 hw->ram_size = t8 * 4096;
2227 DBG(
PFX "stuck hardware sensor bit\n");
2239 for (i = 0; i <
hw->ports; i++) {
2251 for (i = 0; i <
hw->ports; i++)
2281 for (i = 0; i <
hw->ports; i++) {
2299 DBG(
PFX "etherdev alloc failed\n");
2303 dev->dev = &
hw->pdev->dev;
2336 int err, using_dac = 0;
2343 DBG(
PFX "cannot allocate hardware struct\n");
2344 goto err_out_free_regions;
2353 DBG(
PFX "cannot map device registers\n");
2354 goto err_out_free_hw;
2359 goto err_out_iounmap;
2361 DBG(
PFX " addr 0x%llx irq %d chip %s rev %d\n",
2367 goto err_out_led_off;
2373 DBG(
PFX "cannot register net device\n");
2374 goto err_out_free_netdev;
2384 DBG(
PFX "register of second port failed\n");
2394 err_out_free_netdev:
2403 err_out_free_regions:
2416 if ((dev1 =
hw->dev[1]))
static void yukon_link_down(struct skge_port *skge)
#define EINVAL
Invalid argument.
static void yukon_reset(struct skge_hw *hw, int port)
uint8_t irq
Interrupt number.
static u16 xm_read16(const struct skge_hw *hw, int port, int reg)
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
static const u32 portmask[]
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
static void xm_write16(const struct skge_hw *hw, int port, int r, u16 v)
static void xm_link_timer(struct skge_port *skge)
#define EBUSY
Device or resource busy.
static void gma_write16(const struct skge_hw *hw, int port, int r, u16 v)
static void skge_net_irq(struct net_device *dev, int enable)
struct net_device * dev[2]
static unsigned int unsigned int reg
static void xm_write32(const struct skge_hw *hw, int port, int r, u32 v)
#define GM_SMI_CT_PHY_AD(x)
#define PHY_M_LED_MO_RX(x)
#define SUPPORTED_1000baseT_Half
static u32 hwkhz(const struct skge_hw *hw)
int(* open)(struct net_device *netdev)
Open network device.
static void skge_show_addr(struct net_device *dev)
unsigned long ioaddr
I/O address.
static void skge_rx_reuse(struct skge_element *e, unsigned int size)
#define SUPPORTED_Autoneg
#define PHY_M_LED_MO_DUP(x)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
#define ADVERTISED_100baseT_Half
static void skge_link_down(struct skge_port *skge)
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
static void yukon_mac_init(struct skge_hw *hw, int port)
uint8_t size
Entry size (in 32-bit words)
#define SUPPORTED_100baseT_Full
static struct net_device_operations skge_operations
static void yukon_phy_intr(struct skge_port *skge)
static void xm_link_down(struct skge_hw *hw, int port)
static struct net_device * skge_devinit(struct skge_hw *hw, int port, int highmem __unused)
static int skge_probe(struct pci_device *pdev)
static int skge_up(struct net_device *dev)
struct skge_element * next
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#define PCI_BASE_ADDRESS_0
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
static void yukon_stop(struct skge_port *skge)
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
static void bcom_check_link(struct skge_hw *hw, int port)
static void skge_phyirq(struct skge_hw *hw)
static void skge_remove(struct pci_device *pdev)
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static const char * netdev_addr(struct net_device *netdev)
Get printable network device link-layer address.
#define SUPPORTED_10baseT_Half
static u32 skge_read32(const struct skge_hw *hw, int reg)
Dynamic memory allocation.
#define ADVERTISED_1000baseT_Half
#define RB_ADDR(offs, queue)
uint32_t start
Starting offset.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static int is_yukon_lite_a0(struct skge_hw *hw)
#define TX_JAM_IPG_VAL(x)
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define GM_GPCR_SPEED_1000
static int __gm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
enum pause_status flow_status
static const char * skge_board_name(const struct skge_hw *hw)
static const u16 fiber_pause_map[]
#define PHY_M_LED_BLINK_RT(x)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define PHY_B_AS_PAUSE_MSK
#define PHY_M_EC_M_DSC(x)
#define PCI_STATUS_ERROR_BITS
struct skge_element * start
void * priv
Driver private data.
static void xm_outhash(const struct skge_hw *hw, int port, int reg, const u8 *hash)
#define __unused
Declare a variable or data structure as unused.
static void genesis_init(struct skge_hw *hw)
static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val)
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static u32 xm_read32(const struct skge_hw *hw, int port, int reg)
static u16 yukon_speed(const struct skge_hw *hw __unused, u16 aux)
static int xm_check_link(struct net_device *dev)
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
#define PHY_M_PS_PAUSE_MSK
#define PHY_M_EC_S_DSC(x)
static u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec)
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
static void bcom_phy_init(struct skge_port *skge)
static u8 skge_read8(const struct skge_hw *hw, int reg)
#define TX_IPG_JAM_DATA(x)
void unregister_netdev(struct net_device *netdev)
Unregister network device.
static void skge_write16(const struct skge_hw *hw, int reg, u16 val)
static struct pci_device_id skge_id_table[]
static void skge_rx_clean(struct skge_port *skge)
#define GPC_HWCFG_GMII_COP
static void skge_tx_done(struct net_device *dev)
static const struct @105 skge_chips[]
static void skge_link_up(struct skge_port *skge)
static void(* free)(struct refcnt *refcnt))
static const int rxqaddr[]
void * zalloc(size_t size)
Allocate cleared memory.
struct skge_element * to_clean
#define PHY_M_LED_PULS_DUR(x)
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.
#define EOPNOTSUPP
Operation not supported on socket.
static void skge_qset(struct skge_port *skge, u16 q, const struct skge_element *e)
static int skge_tx_avail(const struct skge_ring *ring)
static void xm_outaddr(const struct skge_hw *hw, int port, int reg, const u8 *addr)
static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg)
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void skge_poll(struct net_device *dev)
#define TX_JAM_LEN_VAL(x)
#define SK_REG(port, reg)
#define PCI_STATUS
PCI status.
#define SUPPORTED_10baseT_Full
static int skge_reset(struct skge_hw *hw)
static __always_inline int struct dma_mapping * map
A PCI device ID list entry.
static void skge_rx_stop(struct skge_hw *hw, int port)
#define SUPPORTED_100baseT_Half
static void genesis_stop(struct skge_port *skge)
static struct xen_remove_from_physmap * remove
static void skge_rx_setup(struct skge_port *skge __unused, struct skge_element *e, struct io_buffer *iob, unsigned int bufsize)
Network device operations.
uint16_t ext
Extended status.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
Network device management.
struct net_device * netdev
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
static u16 gma_read16(const struct skge_hw *hw, int port, int reg)
static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len)
static void skge_tx_clean(struct net_device *dev)
char name[NETDEV_NAME_LEN]
Name of this network device.
#define PHY_M_LED_MO_1000(x)
enum pause_control flow_control
int(* probe)(struct pci_device *pci)
Probe device.
#define GPC_HWCFG_GMII_FIB
static void bcom_phy_intr(struct skge_port *skge)
static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base, size_t num)
static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg)
void skge_free(struct net_device *dev)
void * data
Start of data.
#define EIO
Input/output error.
struct pci_driver skge_driver __pci_driver
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static void yukon_link_up(struct skge_port *skge)
#define Q_ADDR(reg, offs)
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val)
uint32_t end
Ending offset.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
static void yukon_init(struct skge_hw *hw, int port)
#define SUPPORTED_1000baseT_Full
static int skge_xmit_frame(struct net_device *dev, struct io_buffer *iob)
#define ADVERTISED_10baseT_Full
uint16_t reason
Rejection reason.
static void xm_phy_init(struct skge_port *skge)
static void genesis_link_up(struct skge_port *skge)
#define GM_SMI_CT_REG_AD(x)
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
static void skge_down(struct net_device *dev)
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
#define PHY_M_EC_MAC_S(x)
void mb(void)
Memory barrier.
#define DATA_BLIND_VAL(x)
static const int txqaddr[]
#define PHY_M_LED_MO_10(x)
static void gma_set_addr(struct skge_hw *hw, int port, int reg, const u8 *addr)
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
static int bad_phy_status(const struct skge_hw *hw, u32 status)
static void skge_rx_refill(struct net_device *dev)
#define DBG(...)
Print a debugging message.
#define GM_GPCR_AU_ALL_DIS
uint32_t supported
Bitmask of supported AENQ groups (device -> host)
static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val)
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
uint8_t bufsize
Size of the packet, in bytes.
#define PHY_M_LED_MO_100(x)
static void skge_rx_done(struct net_device *dev)
static void skge_led(struct skge_port *skge, enum led_mode mode)
static void yukon_suspend(struct skge_hw *hw, int port)
#define ADVERTISED_1000baseT_Full
#define NULL
NULL pointer (VOID *)
static void genesis_reset(struct skge_hw *hw, int port)
#define ADVERTISED_100baseT_Full
#define ETIMEDOUT
Connection timed out.
#define GPC_ANEG_ADV_ALL_M
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static u16 phy_length(const struct skge_hw *hw, u32 status)
struct skge_element * to_use
#define ADVERTISED_10baseT_Half
static void skge_write32(const struct skge_hw *hw, int reg, u32 val)
static u16 skge_read16(const struct skge_hw *hw, int reg)
static void genesis_mac_init(struct skge_hw *hw, int port)
static u32 skge_supported_modes(const struct skge_hw *hw)
static const u16 phy_pause_map[]
void * memset(void *dest, int character, size_t len) __nonnull
static const uint8_t r[3][4]
MD4 shift amounts.
static void skge_write8(const struct skge_hw *hw, int reg, u8 val)