iPXE
skge.c File Reference
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>
#include "skge.h"

Go to the source code of this file.

Enumerations

enum  led_mode { LED_MODE_OFF , LED_MODE_ON , LED_MODE_TST }

Functions

 FILE_LICENCE (GPL2_ONLY)
static int skge_up (struct net_device *dev)
static void skge_down (struct net_device *dev)
static void skge_tx_clean (struct net_device *dev)
static int xm_phy_write (struct skge_hw *hw, int port, u16 reg, u16 val)
static int gm_phy_write (struct skge_hw *hw, int port, u16 reg, u16 val)
static void yukon_init (struct skge_hw *hw, int port)
static void genesis_mac_init (struct skge_hw *hw, int port)
static void genesis_link_up (struct skge_port *skge)
static void skge_phyirq (struct skge_hw *hw)
static void skge_poll (struct net_device *dev)
static int skge_xmit_frame (struct net_device *dev, struct io_buffer *iob)
static void skge_net_irq (struct net_device *dev, int enable)
static void skge_rx_refill (struct net_device *dev)
static u32 skge_supported_modes (const struct skge_hw *hw)
static u32 hwkhz (const struct skge_hw *hw)
static u32 skge_usecs2clk (const struct skge_hw *hw, u32 usec)
static void skge_led (struct skge_port *skge, enum led_mode mode)
static int skge_ring_alloc (struct skge_ring *ring, void *vaddr, u32 base, size_t num)
static void skge_rx_setup (struct skge_port *skge __unused, struct skge_element *e, struct io_buffer *iob, unsigned int bufsize)
static void skge_rx_reuse (struct skge_element *e, unsigned int size)
static void skge_rx_clean (struct skge_port *skge)
static void skge_link_up (struct skge_port *skge)
static void skge_link_down (struct skge_port *skge)
static void xm_link_down (struct skge_hw *hw, int port)
static int __xm_phy_read (struct skge_hw *hw, int port, u16 reg, u16 *val)
static u16 xm_phy_read (struct skge_hw *hw, int port, u16 reg)
static void genesis_init (struct skge_hw *hw)
static void genesis_reset (struct skge_hw *hw, int port)
static void bcom_check_link (struct skge_hw *hw, int port)
static void bcom_phy_init (struct skge_port *skge)
static void xm_phy_init (struct skge_port *skge)
static int xm_check_link (struct net_device *dev)
static void xm_link_timer (struct skge_port *skge)
static void genesis_stop (struct skge_port *skge)
static void bcom_phy_intr (struct skge_port *skge)
static int __gm_phy_read (struct skge_hw *hw, int port, u16 reg, u16 *val)
static u16 gm_phy_read (struct skge_hw *hw, int port, u16 reg)
static void yukon_reset (struct skge_hw *hw, int port)
static int is_yukon_lite_a0 (struct skge_hw *hw)
static void yukon_mac_init (struct skge_hw *hw, int port)
static void yukon_suspend (struct skge_hw *hw, int port)
static void yukon_stop (struct skge_port *skge)
static u16 yukon_speed (const struct skge_hw *hw __unused, u16 aux)
static void yukon_link_up (struct skge_port *skge)
static void yukon_link_down (struct skge_port *skge)
static void yukon_phy_intr (struct skge_port *skge)
static void skge_ramset (struct skge_hw *hw, u16 q, u32 start, size_t len)
static void skge_qset (struct skge_port *skge, u16 q, const struct skge_element *e)
void skge_free (struct net_device *dev)
static void skge_rx_stop (struct skge_hw *hw, int port)
static int skge_tx_avail (const struct skge_ring *ring)
static u16 phy_length (const struct skge_hw *hw, u32 status)
static int bad_phy_status (const struct skge_hw *hw, u32 status)
static void skge_tx_done (struct net_device *dev)
static void skge_rx_done (struct net_device *dev)
static const char * skge_board_name (const struct skge_hw *hw)
static int skge_reset (struct skge_hw *hw)
static struct net_deviceskge_devinit (struct skge_hw *hw, int port, int highmem __unused)
static void skge_show_addr (struct net_device *dev)
static int skge_probe (struct pci_device *pdev)
static void skge_remove (struct pci_device *pdev)

Variables

static struct pci_device_id skge_id_table []
static struct net_device_operations skge_operations
static const int txqaddr [] = { Q_XA1, Q_XA2 }
static const int rxqaddr [] = { Q_R1, Q_R2 }
static const u32 portmask [] = { IS_PORT_1, IS_PORT_2 }
static const u16 phy_pause_map []
static const u16 fiber_pause_map []
struct { 
   u8   id 
   const char *   name 
skge_chips []
struct pci_driver skge_driver __pci_driver

Enumeration Type Documentation

◆ led_mode

enum led_mode
Enumerator
LED_MODE_OFF 
LED_MODE_ON 
LED_MODE_TST 

Definition at line 133 of file skge.c.

@ LED_MODE_OFF
Definition skge.c:133
@ LED_MODE_ON
Definition skge.c:133
@ LED_MODE_TST
Definition skge.c:133

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY )

◆ skge_up()

int skge_up ( struct net_device * dev)
static

Definition at line 1708 of file skge.c.

1709{
1710 struct skge_port *skge = dev->priv;
1711 struct skge_hw *hw = skge->hw;
1712 int port = skge->port;
1713 u32 chunk, ram_addr;
1714 int err;
1715
1716 DBG2(PFX "%s: enabling interface\n", dev->name);
1717
1719 skge->dma = virt_to_bus(skge->mem);
1720 if (!skge->mem)
1721 return -ENOMEM;
1722 memset(skge->mem, 0, RING_SIZE);
1723
1724 assert(!(skge->dma & 7));
1725
1726 /* FIXME: find out whether 64 bit iPXE will be loaded > 4GB */
1727 if ((u64)skge->dma >> 32 != ((u64) skge->dma + RING_SIZE) >> 32) {
1728 DBG(PFX "pci_alloc_consistent region crosses 4G boundary\n");
1729 err = -EINVAL;
1730 goto err;
1731 }
1732
1733 err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma, NUM_RX_DESC);
1734 if (err)
1735 goto err;
1736
1737 /* this call relies on e->iob and d->control to be 0
1738 * This is assured by calling memset() on skge->mem and using zalloc()
1739 * for the skge_element structures.
1740 */
1742
1743 err = skge_ring_alloc(&skge->tx_ring, skge->mem + RX_RING_SIZE,
1744 skge->dma + RX_RING_SIZE, NUM_TX_DESC);
1745 if (err)
1746 goto err;
1747
1748 /* Initialize MAC */
1749 if (hw->chip_id == CHIP_ID_GENESIS)
1751 else
1753
1754 /* Configure RAMbuffers - equally between ports and tx/rx */
1755 chunk = (hw->ram_size - hw->ram_offset) / (hw->ports * 2);
1756 ram_addr = hw->ram_offset + 2 * chunk * port;
1757
1758 skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
1759 skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);
1760
1761 assert(!(skge->tx_ring.to_use != skge->tx_ring.to_clean));
1762 skge_ramset(hw, txqaddr[port], ram_addr+chunk, chunk);
1763 skge_qset(skge, txqaddr[port], skge->tx_ring.to_use);
1764
1765 /* Start receiver BMU */
1766 wmb();
1768 skge_led(skge, LED_MODE_ON);
1769
1770 hw->intr_mask |= portmask[port];
1771 skge_write32(hw, B0_IMSK, hw->intr_mask);
1772
1773 return 0;
1774
1775 err:
1776 skge_rx_clean(skge);
1777 skge_free(dev);
1778
1779 return err;
1780}
#define RX_RING_SIZE
Definition 3c515.c:86
u8 port
Port number.
Definition CIB_PRM.h:3
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define DBG2(...)
Definition compiler.h:515
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define EINVAL
Invalid argument.
Definition errno.h:429
#define ENOMEM
Not enough space.
Definition errno.h:535
#define NUM_RX_DESC
Definition igbvf.h:281
#define NUM_TX_DESC
Definition igbvf.h:280
#define wmb()
Definition io.h:546
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
uint64_t u64
Definition stdint.h:26
void * memset(void *dest, int character, size_t len) __nonnull
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition malloc.c:707
#define PFX
Definition sis190.h:34
static void yukon_mac_init(struct skge_hw *hw, int port)
Definition skge.c:1327
static void genesis_mac_init(struct skge_hw *hw, int port)
Definition skge.c:853
static const int rxqaddr[]
Definition skge.c:87
static const int txqaddr[]
Definition skge.c:86
static const u32 portmask[]
Definition skge.c:88
static void skge_qset(struct skge_port *skge, u16 q, const struct skge_element *e)
Definition skge.c:1676
static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base, size_t num)
Definition skge.c:312
static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len)
Definition skge.c:1645
static void skge_rx_refill(struct net_device *dev)
Definition skge.c:1963
void skge_free(struct net_device *dev)
Definition skge.c:1693
static void skge_led(struct skge_port *skge, enum led_mode mode)
Definition skge.c:134
static void skge_rx_clean(struct skge_port *skge)
Definition skge.c:379
static void skge_write32(const struct skge_hw *hw, int reg, u32 val)
Definition skge.h:2532
#define RING_SIZE
Definition skge.h:32
#define Q_ADDR(reg, offs)
Definition skge.h:534
#define SKGE_RING_ALIGN
Definition skge.h:26
@ B0_IMSK
Definition skge.h:82
@ CHIP_ID_GENESIS
Definition skge.h:318
static void skge_write8(const struct skge_hw *hw, int reg, u8 val)
Definition skge.h:2542
@ Q_CSR
Definition skge.h:523
@ CSR_IRQ_CL_F
Definition skge.h:786
@ CSR_START
Definition skge.h:783
Definition hw.c:16
void * priv
Driver private data.
Definition netdevice.h:432
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition netdevice.h:363
struct net_device * dev[2]
Definition skge.h:2464
struct skge_hw * hw
Definition skge.h:2496
int port
Definition skge.h:2498
void * mem
Definition skge.h:2510
u32 dma
Definition skge.h:2511
struct skge_ring tx_ring
Definition skge.h:2500
struct skge_ring rx_ring
Definition skge.h:2501
struct skge_element * to_clean
Definition skge.h:2454
struct skge_element * to_use
Definition skge.h:2455
#define u32
Definition vga.h:21

References assert, B0_IMSK, CHIP_ID_GENESIS, CSR_IRQ_CL_F, CSR_START, DBG, DBG2, skge_hw::dev, skge_port::dma, EINVAL, ENOMEM, genesis_mac_init(), skge_port::hw, LED_MODE_ON, malloc_phys(), skge_port::mem, memset(), net_device::name, NUM_RX_DESC, NUM_TX_DESC, PFX, port, skge_port::port, portmask, net_device::priv, Q_ADDR, Q_CSR, RING_SIZE, skge_port::rx_ring, RX_RING_SIZE, rxqaddr, skge_free(), skge_led(), skge_qset(), skge_ramset(), SKGE_RING_ALIGN, skge_ring_alloc(), skge_rx_clean(), skge_rx_refill(), skge_write32(), skge_write8(), skge_ring::to_clean, skge_ring::to_use, skge_port::tx_ring, txqaddr, u32, virt_to_bus(), wmb, and yukon_mac_init().

◆ skge_down()

void skge_down ( struct net_device * dev)
static

Definition at line 1791 of file skge.c.

1792{
1793 struct skge_port *skge = dev->priv;
1794 struct skge_hw *hw = skge->hw;
1795 int port = skge->port;
1796
1797 if (skge->mem == NULL)
1798 return;
1799
1800 DBG2(PFX "%s: disabling interface\n", dev->name);
1801
1802 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
1803 skge->use_xm_link_timer = 0;
1804
1806
1807 hw->intr_mask &= ~portmask[port];
1808 skge_write32(hw, B0_IMSK, hw->intr_mask);
1809
1810 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
1811 if (hw->chip_id == CHIP_ID_GENESIS)
1812 genesis_stop(skge);
1813 else
1814 yukon_stop(skge);
1815
1816 /* Stop transmitter */
1820
1821
1822 /* Disable Force Sync bit and Enable Alloc bit */
1825
1826 /* Stop Interval Timer and Limit Counter of Tx Arbiter */
1829
1830 /* Reset PCI FIFO */
1833
1834 /* Reset the RAM Buffer async Tx queue */
1836
1838
1839 if (hw->chip_id == CHIP_ID_GENESIS) {
1842 } else {
1845 }
1846
1847 skge_led(skge, LED_MODE_OFF);
1848
1850
1851 skge_rx_clean(skge);
1852
1853 skge_free(dev);
1854 return;
1855}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition netdevice.c:231
static void yukon_stop(struct skge_port *skge)
Definition skge.c:1493
static void skge_rx_stop(struct skge_hw *hw, int port)
Definition skge.c:1783
static void skge_tx_clean(struct net_device *dev)
Definition skge.c:1910
static void genesis_stop(struct skge_port *skge)
Definition skge.c:999
@ RB_RST_SET
Definition skge.h:831
@ RB_DIS_OP_MD
Definition skge.h:829
#define CSR_SET_RESET
Definition skge.h:790
@ TXA_DIS_FSYNC
Definition skge.h:478
@ TXA_STOP_RC
Definition skge.h:482
@ TXA_DIS_ALLOC
Definition skge.h:480
@ GMF_RST_SET
Definition skge.h:1924
@ SK_PHY_XMAC
Definition skge.h:573
@ RB_CTRL
Definition skge.h:550
@ LED_OFF
Definition skge.h:719
@ TX_MFF_CTRL2
Definition skge.h:845
@ RX_GMF_CTRL_T
Definition skge.h:726
@ TX_GMF_CTRL_T
Definition skge.h:873
@ LNK_LED_REG
Definition skge.h:616
@ RX_MFF_CTRL2
Definition skge.h:603
@ MFF_RST_SET
Definition skge.h:688
#define SK_REG(port, reg)
Definition skge.h:2548
#define RB_ADDR(offs, queue)
Definition skge.h:590
@ Q_XA2
Definition skge.h:562
@ Q_XA1
Definition skge.h:560
@ TXA_ITI_INI
Definition skge.h:492
@ TXA_CTRL
Definition skge.h:496
@ TXA_LIM_INI
Definition skge.h:494
@ CSR_STOP
Definition skge.h:782
int use_xm_link_timer
Definition skge.h:2512

References B0_IMSK, CHIP_ID_GENESIS, CSR_SET_RESET, CSR_STOP, DBG2, skge_hw::dev, genesis_stop(), GMF_RST_SET, skge_port::hw, LED_MODE_OFF, LED_OFF, LNK_LED_REG, skge_port::mem, MFF_RST_SET, net_device::name, netdev_link_down(), NULL, PFX, port, skge_port::port, portmask, net_device::priv, Q_ADDR, Q_CSR, Q_XA1, Q_XA2, RB_ADDR, RB_CTRL, RB_DIS_OP_MD, RB_RST_SET, RX_GMF_CTRL_T, RX_MFF_CTRL2, SK_PHY_XMAC, SK_REG, skge_free(), skge_led(), skge_rx_clean(), skge_rx_stop(), skge_tx_clean(), skge_write32(), skge_write8(), TX_GMF_CTRL_T, TX_MFF_CTRL2, TXA_CTRL, TXA_DIS_ALLOC, TXA_DIS_FSYNC, TXA_ITI_INI, TXA_LIM_INI, TXA_STOP_RC, txqaddr, skge_port::use_xm_link_timer, and yukon_stop().

◆ skge_tx_clean()

void skge_tx_clean ( struct net_device * dev)
static

Definition at line 1910 of file skge.c.

1911{
1912 struct skge_port *skge = dev->priv;
1913 struct skge_element *e;
1914
1915 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) {
1916 struct skge_tx_desc *td = e->desc;
1917 td->control = 0;
1918 }
1919
1920 skge->tx_ring.to_clean = e;
1921}
struct skge_element * next
Definition skge.h:2448
void * desc
Definition skge.h:2449
u32 control
Definition skge.h:2436

References skge_tx_desc::control, skge_element::desc, skge_element::next, net_device::priv, skge_ring::to_clean, skge_ring::to_use, and skge_port::tx_ring.

Referenced by skge_down().

◆ xm_phy_write()

int xm_phy_write ( struct skge_hw * hw,
int port,
u16 reg,
u16 val )
static

Definition at line 459 of file skge.c.

460{
461 int i;
462
463 xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr);
464 for (i = 0; i < PHY_RETRIES; i++) {
466 goto ready;
467 udelay(1);
468 }
469 return -EIO;
470
471 ready:
473 for (i = 0; i < PHY_RETRIES; i++) {
475 return 0;
476 udelay(1);
477 }
478 return -ETIMEDOUT;
479}
#define ETIMEDOUT
Connection timed out.
Definition errno.h:670
#define EIO
Input/output error.
Definition errno.h:434
void __asmcall int val
Definition setjmp.h:12
static unsigned int unsigned int reg
Definition myson.h:162
#define PHY_RETRIES
Definition skge.h:28
@ XM_MMU_PHY_BUSY
Definition skge.h:2169
@ XM_PHY_DATA
Definition skge.h:2073
@ XM_PHY_ADDR
Definition skge.h:2072
@ XM_MMU_CMD
Definition skge.h:2062
static u16 xm_read16(const struct skge_hw *hw, int port, int reg)
Definition skge.h:2560
static void xm_write16(const struct skge_hw *hw, int port, int r, u16 v)
Definition skge.h:2571
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

References EIO, ETIMEDOUT, PHY_RETRIES, port, reg, u16, udelay(), val, XM_MMU_CMD, XM_MMU_PHY_BUSY, XM_PHY_ADDR, XM_PHY_DATA, xm_read16(), and xm_write16().

Referenced by bcom_phy_init(), bcom_phy_intr(), genesis_link_up(), skge_led(), and xm_phy_init().

◆ gm_phy_write()

int gm_phy_write ( struct skge_hw * hw,
int port,
u16 reg,
u16 val )
static

Definition at line 1160 of file skge.c.

1161{
1162 int i;
1163
1166 GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg));
1167 for (i = 0; i < PHY_RETRIES; i++) {
1168 udelay(1);
1169
1171 return 0;
1172 }
1173
1174 DBG(PFX "%s: phy write timeout port %x reg %x val %x\n",
1175 hw->dev[port]->name,
1176 port, reg, val);
1177 return -EIO;
1178}
static void gma_write16(const struct skge_hw *hw, int port, int r, u16 v)
Definition skge.h:2607
#define GM_SMI_CT_PHY_AD(x)
Definition skge.h:1869
@ GM_SMI_CT_BUSY
Definition skge.h:1866
@ GM_SMI_CTRL
Definition skge.h:1709
@ GM_SMI_DATA
Definition skge.h:1710
#define GM_SMI_CT_REG_AD(x)
Definition skge.h:1870
static u16 gma_read16(const struct skge_hw *hw, int port, int reg)
Definition skge.h:2596

References DBG, EIO, GM_SMI_CT_BUSY, GM_SMI_CT_PHY_AD, GM_SMI_CT_REG_AD, GM_SMI_CTRL, GM_SMI_DATA, gma_read16(), gma_write16(), PFX, PHY_RETRIES, port, reg, u16, udelay(), and val.

Referenced by skge_led(), yukon_init(), yukon_link_down(), yukon_link_up(), yukon_reset(), and yukon_suspend().

◆ yukon_init()

void yukon_init ( struct skge_hw * hw,
int port )
static

Definition at line 1211 of file skge.c.

1212{
1213 struct skge_port *skge = hw->dev[port]->priv;
1214 u16 ctrl, ct1000, adv;
1215
1216 if (skge->autoneg == AUTONEG_ENABLE) {
1218
1222
1223 ectrl |= PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1);
1224
1226 }
1227
1229 if (skge->autoneg == AUTONEG_DISABLE)
1230 ctrl &= ~PHY_CT_ANE;
1231
1232 ctrl |= PHY_CT_RESET;
1234
1235 ctrl = 0;
1236 ct1000 = 0;
1237 adv = PHY_AN_CSMA;
1238
1239 if (skge->autoneg == AUTONEG_ENABLE) {
1240 if (hw->copper) {
1242 ct1000 |= PHY_M_1000C_AFD;
1244 ct1000 |= PHY_M_1000C_AHD;
1246 adv |= PHY_M_AN_100_FD;
1248 adv |= PHY_M_AN_100_HD;
1250 adv |= PHY_M_AN_10_FD;
1252 adv |= PHY_M_AN_10_HD;
1253
1254 /* Set Flow-control capabilities */
1255 adv |= phy_pause_map[skge->flow_control];
1256 } else {
1258 adv |= PHY_M_AN_1000X_AFD;
1260 adv |= PHY_M_AN_1000X_AHD;
1261
1262 adv |= fiber_pause_map[skge->flow_control];
1263 }
1264
1265 /* Restart Auto-negotiation */
1267 } else {
1268 /* forced speed/duplex settings */
1269 ct1000 = PHY_M_1000C_MSE;
1270
1271 if (skge->duplex == DUPLEX_FULL)
1273
1274 switch (skge->speed) {
1275 case SPEED_1000:
1277 break;
1278 case SPEED_100:
1279 ctrl |= PHY_CT_SP100;
1280 break;
1281 }
1282
1283 ctrl |= PHY_CT_RESET;
1284 }
1285
1287
1290
1291 /* Enable phy interrupt on autonegotiation complete (or link up) */
1292 if (skge->autoneg == AUTONEG_ENABLE)
1294 else
1296}
#define SPEED_100
Definition atl1e.h:51
#define SPEED_1000
Definition atl1e.h:52
#define ADVERTISED_1000baseT_Full
Definition bnx2.h:47
#define AUTONEG_DISABLE
Definition bnx2.h:83
#define AUTONEG_ENABLE
Definition bnx2.h:84
#define DUPLEX_FULL
Definition bnx2.h:63
#define ADVERTISED_100baseT_Half
Definition bnx2.h:44
#define ADVERTISED_100baseT_Full
Definition bnx2.h:45
#define ADVERTISED_10baseT_Full
Definition bnx2.h:43
#define ADVERTISED_1000baseT_Half
Definition bnx2.h:46
#define ADVERTISED_10baseT_Half
Definition bnx2.h:42
uint8_t ctrl
Ring control.
Definition dwmac.h:7
static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val)
Definition skge.c:1160
static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg)
Definition skge.c:1200
static const u16 phy_pause_map[]
Definition skge.c:537
static const u16 fiber_pause_map[]
Definition skge.c:545
@ PHY_M_EC_M_DSC_MSK
Definition skge.h:1489
@ PHY_M_EC_S_DSC_MSK
Definition skge.h:1491
@ PHY_M_EC_MAC_S_MSK
Definition skge.h:1498
@ PHY_CT_RE_CFG
Definition skge.h:1078
@ PHY_CT_ANE
Definition skge.h:1075
@ PHY_CT_DUP_MD
Definition skge.h:1079
@ PHY_CT_RESET
Definition skge.h:1072
#define PHY_M_EC_M_DSC(x)
Definition skge.h:1504
#define PHY_M_EC_MAC_S(x)
Definition skge.h:1506
@ PHY_M_AN_1000X_AHD
Definition skge.h:1367
@ PHY_M_AN_1000X_AFD
Definition skge.h:1368
@ PHY_AN_CSMA
Definition skge.h:1138
@ PHY_MARV_INT_MASK
Definition skge.h:1049
@ PHY_MARV_1000T_CTRL
Definition skge.h:1044
@ PHY_MARV_CTRL
Definition skge.h:1034
@ PHY_MARV_AUNE_ADV
Definition skge.h:1038
@ PHY_MARV_EXT_CTRL
Definition skge.h:1051
#define PHY_M_EC_S_DSC(x)
Definition skge.h:1505
@ PHY_M_1000C_AHD
Definition skge.h:1386
@ PHY_M_1000C_MSE
Definition skge.h:1382
@ PHY_M_1000C_AFD
Definition skge.h:1385
@ PHY_M_IS_DEF_MSK
Definition skge.h:1477
@ PHY_M_IS_AN_MSK
Definition skge.h:1480
@ MAC_TX_CLK_25_MHZ
Definition skge.h:1513
@ PHY_CT_SP1000
Definition skge.h:1085
@ PHY_CT_SP100
Definition skge.h:1086
@ PHY_M_AN_10_HD
Definition skge.h:1359
@ PHY_M_AN_10_FD
Definition skge.h:1358
@ PHY_M_AN_100_HD
Definition skge.h:1357
@ PHY_M_AN_100_FD
Definition skge.h:1356
u32 advertising
Definition skge.h:2508
u16 speed
Definition skge.h:2507
u8 autoneg
Definition skge.h:2505
u8 duplex
Definition skge.h:2506
enum pause_control flow_control
Definition skge.h:2503
#define u16
Definition vga.h:20

References ADVERTISED_1000baseT_Full, ADVERTISED_1000baseT_Half, ADVERTISED_100baseT_Full, ADVERTISED_100baseT_Half, ADVERTISED_10baseT_Full, ADVERTISED_10baseT_Half, skge_port::advertising, skge_port::autoneg, AUTONEG_DISABLE, AUTONEG_ENABLE, ctrl, skge_port::duplex, DUPLEX_FULL, fiber_pause_map, skge_port::flow_control, gm_phy_read(), gm_phy_write(), MAC_TX_CLK_25_MHZ, PHY_AN_CSMA, PHY_CT_ANE, PHY_CT_DUP_MD, PHY_CT_RE_CFG, PHY_CT_RESET, PHY_CT_SP100, PHY_CT_SP1000, PHY_M_1000C_AFD, PHY_M_1000C_AHD, PHY_M_1000C_MSE, PHY_M_AN_1000X_AFD, PHY_M_AN_1000X_AHD, PHY_M_AN_100_FD, PHY_M_AN_100_HD, PHY_M_AN_10_FD, PHY_M_AN_10_HD, PHY_M_EC_M_DSC, PHY_M_EC_M_DSC_MSK, PHY_M_EC_MAC_S, PHY_M_EC_MAC_S_MSK, PHY_M_EC_S_DSC, PHY_M_EC_S_DSC_MSK, PHY_M_IS_AN_MSK, PHY_M_IS_DEF_MSK, PHY_MARV_1000T_CTRL, PHY_MARV_AUNE_ADV, PHY_MARV_CTRL, PHY_MARV_EXT_CTRL, PHY_MARV_INT_MASK, phy_pause_map, port, skge_port::speed, SPEED_100, SPEED_1000, and u16.

Referenced by yukon_link_down(), and yukon_mac_init().

◆ genesis_mac_init()

void genesis_mac_init ( struct skge_hw * hw,
int port )
static

Definition at line 853 of file skge.c.

854{
855 struct net_device *dev = hw->dev[port];
856 struct skge_port *skge = dev->priv;
857 int i;
858 u32 r;
859 const u8 zero[6] = { 0 };
860
861 for (i = 0; i < 10; i++) {
865 goto reset_ok;
866 udelay(1);
867 }
868
869 DBG(PFX "%s: genesis reset failed\n", dev->name);
870
871 reset_ok:
872 /* Unreset the XMAC. */
874
875 /*
876 * Perform additional initialization for external PHYs,
877 * namely for the 1000baseTX cards that use the XMAC's
878 * GMII mode.
879 */
880 if (hw->phy_type != SK_PHY_XMAC) {
881 /* Take external Phy out of reset */
883 if (port == 0)
884 r |= GP_DIR_0|GP_IO_0;
885 else
886 r |= GP_DIR_2|GP_IO_2;
887
889
890 /* Enable GMII interface */
892 }
893
894
895 switch(hw->phy_type) {
896 case SK_PHY_XMAC:
897 xm_phy_init(skge);
898 break;
899 case SK_PHY_BCOM:
900 bcom_phy_init(skge);
902 }
903
904 /* Set Station Address */
905 xm_outaddr(hw, port, XM_SA, dev->ll_addr);
906
907 /* We don't use match addresses so clear */
908 for (i = 1; i < 16; i++)
909 xm_outaddr(hw, port, XM_EXM(i), zero);
910
911 /* Clear MIB counters */
914 /* Clear two times according to Errata #3 */
917
918 /* configure Rx High Water Mark (XM_RX_HI_WM) */
919 xm_write16(hw, port, XM_RX_HI_WM, 1450);
920
921 /* We don't need the FCS appended to the packet. */
923
924 if (skge->duplex == DUPLEX_HALF) {
925 /*
926 * If in manual half duplex mode the other side might be in
927 * full duplex mode, so ignore if a carrier extension is not seen
928 * on frames received
929 */
930 r |= XM_RX_DIS_CEXT;
931 }
933
934 /* We want short frames padded to 60 bytes. */
936
937 xm_write16(hw, port, XM_TX_THR, 512);
938
939 /*
940 * Enable the reception of all error frames. This is is
941 * a necessary evil due to the design of the XMAC. The
942 * XMAC's receive FIFO is only 8K in size, however jumbo
943 * frames can be up to 9000 bytes in length. When bad
944 * frame filtering is enabled, the XMAC's RX FIFO operates
945 * in 'store and forward' mode. For this to work, the
946 * entire frame has to fit into the FIFO, but that means
947 * that jumbo frames larger than 8192 bytes will be
948 * truncated. Disabling all bad frame filtering causes
949 * the RX FIFO to operate in streaming mode, in which
950 * case the XMAC will start transferring frames out of the
951 * RX FIFO as soon as the FIFO threshold is reached.
952 */
954
955
956 /*
957 * Initialize the Receive Counter Event Mask (XM_RX_EV_MSK)
958 * - Enable all bits excepting 'Octets Rx OK Low CntOv'
959 * and 'Octets Rx OK Hi Cnt Ov'.
960 */
962
963 /*
964 * Initialize the Transmit Counter Event Mask (XM_TX_EV_MSK)
965 * - Enable all bits excepting 'Octets Tx OK Low CntOv'
966 * and 'Octets Tx OK Hi Cnt Ov'.
967 */
969
970 /* Configure MAC arbiter */
972
973 /* configure timeout values */
978
983
984 /* Configure Rx MAC FIFO */
988
989 /* Configure Tx MAC FIFO */
993
994 /* enable timeout timers */
996 (port == 0) ? PA_ENA_TO_TX1 : PA_ENA_TO_TX2);
997}
#define DUPLEX_HALF
Definition bnx2.h:62
#define u8
Definition igbvf_osdep.h:40
static const uint8_t r[3][4]
MD4 shift amounts.
Definition md4.c:54
static void xm_phy_init(struct skge_port *skge)
Definition skge.c:719
static void bcom_check_link(struct skge_hw *hw, int port)
Definition skge.c:554
static void bcom_phy_init(struct skge_port *skge)
Definition skge.c:622
@ XM_TX_AUTO_PAD
Definition skge.h:2191
#define XM_DEF_MODE
Definition skge.h:2337
@ XM_SC_CLR_TXC
Definition skge.h:2347
@ XM_SC_CLR_RXC
Definition skge.h:2346
static void xm_outaddr(const struct skge_hw *hw, int port, int reg, const u8 *addr)
Definition skge.h:2585
@ SK_PHY_BCOM
Definition skge.h:574
@ MA_RST_CLR
Definition skge.h:433
static u16 skge_read16(const struct skge_hw *hw, int reg)
Definition skge.h:2522
#define XM_EXM(reg)
Definition skge.h:2089
@ XM_HW_GMII_MD
Definition skge.h:2258
@ MFF_CLR_MAC_RST
Definition skge.h:651
@ MFF_SET_MAC_RST
Definition skge.h:652
@ MFF_TX_CTRL_DEF
Definition skge.h:654
@ XM_RX_LENERR_OK
Definition skge.h:2208
@ XM_RX_STRIP_FCS
Definition skge.h:2214
@ XM_RX_DIS_CEXT
Definition skge.h:2218
#define XMT_DEF_MSK
Definition skge.h:2420
@ XM_HW_CFG
Definition skge.h:2077
@ XM_TX_CMD
Definition skge.h:2067
@ XM_RX_CMD
Definition skge.h:2071
@ XM_TX_THR
Definition skge.h:2080
@ TX_MFF_CTRL1
Definition skge.h:842
@ B3_MA_TOINI_RX2
Definition skge.h:158
@ B2_GP_IO
Definition skge.h:128
@ B3_MA_TOINI_TX2
Definition skge.h:160
@ B3_MA_RCINI_TX2
Definition skge.h:170
@ B3_MA_TOINI_TX1
Definition skge.h:159
@ B3_MA_TO_CTRL
Definition skge.h:165
@ B3_PA_CTRL
Definition skge.h:185
@ B3_MA_RCINI_RX1
Definition skge.h:167
@ B3_MA_TOINI_RX1
Definition skge.h:157
@ B3_MA_RCINI_TX1
Definition skge.h:169
@ B3_MA_RCINI_RX2
Definition skge.h:168
static void xm_write32(const struct skge_hw *hw, int port, int r, u32 v)
Definition skge.h:2565
@ RX_MFF_CTRL1
Definition skge.h:600
@ GP_DIR_0
Definition skge.h:358
@ GP_IO_2
Definition skge.h:367
@ GP_DIR_2
Definition skge.h:356
@ GP_IO_0
Definition skge.h:369
@ MFF_RST_CLR
Definition skge.h:687
@ MFF_ENA_OP_MD
Definition skge.h:685
@ MFF_ENA_TIM_PAT
Definition skge.h:624
static void skge_write16(const struct skge_hw *hw, int reg, u16 val)
Definition skge.h:2537
#define XMR_DEF_MSK
Definition skge.h:2386
static u32 skge_read32(const struct skge_hw *hw, int reg)
Definition skge.h:2517
@ PA_ENA_TO_TX2
Definition skge.h:451
@ PA_ENA_TO_TX1
Definition skge.h:453
@ XM_RX_EV_MSK
Definition skge.h:2107
@ XM_TX_EV_MSK
Definition skge.h:2108
@ XM_SA
Definition skge.h:2094
@ XM_MODE
Definition skge.h:2100
@ XM_STAT_CMD
Definition skge.h:2104
@ XM_RX_HI_WM
Definition skge.h:2097
A network device.
Definition netdevice.h:353
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition netdevice.h:388

References B2_GP_IO, B3_MA_RCINI_RX1, B3_MA_RCINI_RX2, B3_MA_RCINI_TX1, B3_MA_RCINI_TX2, B3_MA_TO_CTRL, B3_MA_TOINI_RX1, B3_MA_TOINI_RX2, B3_MA_TOINI_TX1, B3_MA_TOINI_TX2, B3_PA_CTRL, bcom_check_link(), bcom_phy_init(), DBG, net_device::dev, skge_port::duplex, DUPLEX_HALF, GP_DIR_0, GP_DIR_2, GP_IO_0, GP_IO_2, net_device::ll_addr, MA_RST_CLR, MFF_CLR_MAC_RST, MFF_ENA_OP_MD, MFF_ENA_TIM_PAT, MFF_RST_CLR, MFF_SET_MAC_RST, MFF_TX_CTRL_DEF, net_device::name, PA_ENA_TO_TX1, PA_ENA_TO_TX2, PFX, port, net_device::priv, r, RX_MFF_CTRL1, RX_MFF_CTRL2, SK_PHY_BCOM, SK_PHY_XMAC, SK_REG, skge_read16(), skge_read32(), skge_write16(), skge_write32(), skge_write8(), TX_MFF_CTRL1, TX_MFF_CTRL2, u32, u8, udelay(), XM_DEF_MODE, XM_EXM, XM_HW_CFG, XM_HW_GMII_MD, XM_MODE, xm_outaddr(), xm_phy_init(), XM_RX_CMD, XM_RX_DIS_CEXT, XM_RX_EV_MSK, XM_RX_HI_WM, XM_RX_LENERR_OK, XM_RX_STRIP_FCS, XM_SA, XM_SC_CLR_RXC, XM_SC_CLR_TXC, XM_STAT_CMD, XM_TX_AUTO_PAD, XM_TX_CMD, XM_TX_EV_MSK, XM_TX_THR, xm_write16(), xm_write32(), XMR_DEF_MSK, and XMT_DEF_MSK.

Referenced by skge_up().

◆ genesis_link_up()

void genesis_link_up ( struct skge_port * skge)
static

Definition at line 1046 of file skge.c.

1047{
1048 struct skge_hw *hw = skge->hw;
1049 int port = skge->port;
1050 u16 cmd, msk;
1051 u32 mode;
1052
1054
1055 /*
1056 * enabling pause frame reception is required for 1000BT
1057 * because the XMAC is not reset if the link is going down
1058 */
1059 if (skge->flow_status == FLOW_STAT_NONE ||
1061 /* Disable Pause Frame Reception */
1062 cmd |= XM_MMU_IGN_PF;
1063 else
1064 /* Enable Pause Frame Reception */
1066
1068
1070 if (skge->flow_status== FLOW_STAT_SYMMETRIC ||
1072 /*
1073 * Configure Pause Frame Generation
1074 * Use internal and external Pause Frame Generation.
1075 * Sending pause frames is edge triggered.
1076 * Send a Pause frame with the maximum pause time if
1077 * internal oder external FIFO full condition occurs.
1078 * Send a zero pause time frame to re-start transmission.
1079 */
1080 /* XM_PAUSE_DA = '010000C28001' (default) */
1081 /* XM_MAC_PTIME = 0xffff (maximum) */
1082 /* remember this value is defined in big endian (!) */
1083 xm_write16(hw, port, XM_MAC_PTIME, 0xffff);
1084
1087 } else {
1088 /*
1089 * disable pause frame generation is required for 1000BT
1090 * because the XMAC is not reset if the link is going down
1091 */
1092 /* Disable Pause Mode in Mode Register */
1094
1096 }
1097
1099
1100 /* Turn on detection of Tx underrun */
1101 msk = xm_read16(hw, port, XM_IMSK);
1102 msk &= ~XM_IS_TXF_UR;
1103 xm_write16(hw, port, XM_IMSK, msk);
1104
1106
1107 /* get MMU Command Reg. */
1109 if (hw->phy_type != SK_PHY_XMAC && skge->duplex == DUPLEX_FULL)
1111
1112 /*
1113 * Workaround BCOM Errata (#10523) for all BCom Phys
1114 * Enable Power Management after link up
1115 */
1116 if (hw->phy_type == SK_PHY_BCOM) {
1119 & ~PHY_B_AC_DIS_PM);
1121 }
1122
1123 /* enable Rx/Tx */
1126 skge_link_up(skge);
1127}
struct golan_eqe_cmd cmd
Definition CIB_PRM.h:1
uint16_t mode
Acceleration mode.
Definition ena.h:15
static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg)
Definition skge.c:450
static void skge_link_up(struct skge_port *skge)
Definition skge.c:395
static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val)
Definition skge.c:459
@ FLOW_STAT_NONE
Definition skge.h:2488
@ FLOW_STAT_SYMMETRIC
Definition skge.h:2491
@ FLOW_STAT_LOC_SEND
Definition skge.h:2490
@ PHY_BCOM_AUX_CTRL
Definition skge.h:1024
@ PHY_BCOM_INT_MASK
Definition skge.h:1027
@ XM_MMU_ENA_RX
Definition skge.h:2178
@ XM_MMU_ENA_TX
Definition skge.h:2179
@ XM_MMU_GMII_FD
Definition skge.h:2175
@ XM_MMU_IGN_PF
Definition skge.h:2170
static u32 xm_read32(const struct skge_hw *hw, int port, int reg)
Definition skge.h:2552
@ XM_ISRC
Definition skge.h:2076
@ XM_MAC_PTIME
Definition skge.h:2085
@ XM_IMSK
Definition skge.h:2075
#define XM_PAUSE_MODE
Definition skge.h:2336
@ PHY_B_AC_DIS_PM
Definition skge.h:1285
#define PHY_B_DEF_MSK
Definition skge.h:1328
@ MFF_ENA_PAUSE
Definition skge.h:628
@ MFF_DIS_PAUSE
Definition skge.h:629
@ XM_IS_TXF_UR
Definition skge.h:2247
enum pause_status flow_status
Definition skge.h:2504

References cmd, skge_port::duplex, DUPLEX_FULL, FLOW_STAT_LOC_SEND, FLOW_STAT_NONE, FLOW_STAT_SYMMETRIC, skge_port::flow_status, skge_port::hw, MFF_DIS_PAUSE, MFF_ENA_PAUSE, mode, PHY_B_AC_DIS_PM, PHY_B_DEF_MSK, PHY_BCOM_AUX_CTRL, PHY_BCOM_INT_MASK, port, skge_port::port, RX_MFF_CTRL1, SK_PHY_BCOM, SK_PHY_XMAC, SK_REG, skge_link_up(), skge_write16(), u16, u32, XM_IMSK, XM_IS_TXF_UR, XM_ISRC, XM_MAC_PTIME, XM_MMU_CMD, XM_MMU_ENA_RX, XM_MMU_ENA_TX, XM_MMU_GMII_FD, XM_MMU_IGN_PF, XM_MODE, XM_PAUSE_MODE, xm_phy_read(), xm_phy_write(), xm_read16(), xm_read32(), xm_write16(), and xm_write32().

Referenced by bcom_check_link(), and xm_check_link().

◆ skge_phyirq()

void skge_phyirq ( struct skge_hw * hw)
static

Definition at line 2083 of file skge.c.

2084{
2085 int port;
2086
2087 for (port = 0; port < hw->ports; port++) {
2088 struct net_device *dev = hw->dev[port];
2089 struct skge_port *skge = dev->priv;
2090
2091 if (hw->chip_id != CHIP_ID_GENESIS)
2092 yukon_phy_intr(skge);
2093 else if (hw->phy_type == SK_PHY_BCOM)
2094 bcom_phy_intr(skge);
2095 }
2096
2097 hw->intr_mask |= IS_EXT_REG;
2098 skge_write32(hw, B0_IMSK, hw->intr_mask);
2100}
static void bcom_phy_intr(struct skge_port *skge)
Definition skge.c:1130
static void yukon_phy_intr(struct skge_port *skge)
Definition skge.c:1568
@ IS_EXT_REG
Definition skge.h:233

References B0_IMSK, bcom_phy_intr(), CHIP_ID_GENESIS, net_device::dev, IS_EXT_REG, port, net_device::priv, SK_PHY_BCOM, skge_read32(), skge_write32(), and yukon_phy_intr().

Referenced by skge_poll().

◆ skge_poll()

void skge_poll ( struct net_device * dev)
static

Definition at line 2052 of file skge.c.

2053{
2054 struct skge_port *skge = dev->priv;
2055 struct skge_hw *hw = skge->hw;
2056 u32 status;
2057
2058 /* reading this register ACKs interrupts */
2060
2061 /* Link event? */
2062 if (status & IS_EXT_REG) {
2063 skge_phyirq(hw);
2064 if (skge->use_xm_link_timer)
2065 xm_link_timer(skge);
2066 }
2067
2069
2071
2073
2074 /* restart receiver */
2075 wmb();
2077
2079
2080 return;
2081}
uint8_t status
Status.
Definition ena.h:5
static void xm_link_timer(struct skge_port *skge)
Definition skge.c:828
static void skge_phyirq(struct skge_hw *hw)
Definition skge.c:2083
static void skge_rx_done(struct net_device *dev)
Definition skge.c:2005
static void skge_tx_done(struct net_device *dev)
Definition skge.c:1941
@ B0_SP_ISRC
Definition skge.h:85

References B0_IMSK, B0_SP_ISRC, CSR_IRQ_CL_F, CSR_START, skge_hw::dev, skge_port::hw, IS_EXT_REG, skge_port::port, net_device::priv, Q_ADDR, Q_CSR, rxqaddr, skge_phyirq(), skge_read32(), skge_rx_done(), skge_tx_done(), skge_write8(), status, u32, skge_port::use_xm_link_timer, wmb, and xm_link_timer().

◆ skge_xmit_frame()

int skge_xmit_frame ( struct net_device * dev,
struct io_buffer * iob )
static

Definition at line 1864 of file skge.c.

1865{
1866 struct skge_port *skge = dev->priv;
1867 struct skge_hw *hw = skge->hw;
1868 struct skge_element *e;
1869 struct skge_tx_desc *td;
1870 u32 control, len;
1871 u64 map;
1872
1873 if (skge_tx_avail(&skge->tx_ring) < 1)
1874 return -EBUSY;
1875
1876 e = skge->tx_ring.to_use;
1877 td = e->desc;
1878 assert(!(td->control & BMU_OWN));
1879 e->iob = iob;
1880 len = iob_len(iob);
1881 map = virt_to_bus(iob->data);
1882
1883 td->dma_lo = map;
1884 td->dma_hi = map >> 32;
1885
1887
1889 /* Make sure all the descriptors written */
1890 wmb();
1891 td->control = BMU_OWN | BMU_SW | BMU_STF | control | len;
1892 wmb();
1893
1895
1896 DBGIO(PFX "%s: tx queued, slot %td, len %d\n",
1897 dev->name, e - skge->tx_ring.start, (unsigned int)len);
1898
1899 skge->tx_ring.to_use = e->next;
1900 wmb();
1901
1902 if (skge_tx_avail(&skge->tx_ring) <= 1) {
1903 DBG(PFX "%s: transmit queue full\n", dev->name);
1904 }
1905
1906 return 0;
1907}
ring len
Length.
Definition dwmac.h:226
#define DBGIO(...)
Definition compiler.h:549
#define EBUSY
Device or resource busy.
Definition errno.h:339
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
static __always_inline int struct dma_mapping * map
Definition dma.h:184
uint32_t control
Control.
Definition myson.h:3
static int skge_tx_avail(const struct skge_ring *ring)
Definition skge.c:1857
@ BMU_EOF
Definition skge.h:378
@ BMU_SW
Definition skge.h:384
@ BMU_OWN
Definition skge.h:376
@ BMU_CHECK
Definition skge.h:390
@ BMU_IRQ_EOF
Definition skge.h:380
@ BMU_STF
Definition skge.h:377
void * data
Start of data.
Definition iobuf.h:53
struct io_buffer * iob
Definition skge.h:2450
struct skge_element * start
Definition skge.h:2456
u32 dma_hi
Definition skge.h:2439
u32 dma_lo
Definition skge.h:2438

References assert, BMU_CHECK, BMU_EOF, BMU_IRQ_EOF, BMU_OWN, BMU_STF, BMU_SW, control, skge_tx_desc::control, CSR_START, io_buffer::data, DBG, DBGIO, skge_element::desc, skge_tx_desc::dma_hi, skge_tx_desc::dma_lo, EBUSY, skge_port::hw, skge_element::iob, iob_len(), len, map, net_device::name, skge_element::next, PFX, skge_port::port, net_device::priv, Q_ADDR, Q_CSR, skge_tx_avail(), skge_write8(), skge_ring::start, skge_ring::to_use, skge_port::tx_ring, txqaddr, u32, virt_to_bus(), and wmb.

◆ skge_net_irq()

void skge_net_irq ( struct net_device * dev,
int enable )
static

Definition at line 2449 of file skge.c.

2449 {
2450 struct skge_port *skge = dev->priv;
2451 struct skge_hw *hw = skge->hw;
2452
2453 if (enable)
2454 hw->intr_mask |= portmask[skge->port];
2455 else
2456 hw->intr_mask &= ~portmask[skge->port];
2457 skge_write32(hw, B0_IMSK, hw->intr_mask);
2458}

References B0_IMSK, skge_port::hw, skge_port::port, portmask, net_device::priv, and skge_write32().

◆ skge_rx_refill()

void skge_rx_refill ( struct net_device * dev)
static

Definition at line 1963 of file skge.c.

1964{
1965 struct skge_port *skge = dev->priv;
1966 struct skge_ring *ring = &skge->rx_ring;
1967 struct skge_element *e;
1968 struct io_buffer *iob;
1969 struct skge_rx_desc *rd;
1970 u32 control;
1971 int i;
1972
1973 for (i = 0; i < NUM_RX_DESC; i++) {
1974 e = ring->to_clean;
1975 rd = e->desc;
1976 iob = e->iob;
1977 control = rd->control;
1978
1979 /* nothing to do here */
1980 if (iob || (control & BMU_OWN))
1981 continue;
1982
1983 DBG2("refilling rx desc %zd: ", (ring->to_clean - ring->start));
1984
1985 iob = alloc_iob(RX_BUF_SIZE);
1986 if (iob) {
1987 skge_rx_setup(skge, e, iob, RX_BUF_SIZE);
1988 } else {
1989 DBG("descr %zd: alloc_iob() failed\n",
1990 (ring->to_clean - ring->start));
1991 /* We pass the descriptor to the NIC even if the
1992 * allocation failed. The card will stop as soon as it
1993 * encounters a descriptor with the OWN bit set to 0,
1994 * thus never getting to the next descriptor that might
1995 * contain a valid io_buffer. This would effectively
1996 * stall the receive.
1997 */
1998 skge_rx_setup(skge, e, NULL, 0);
1999 }
2000
2001 ring->to_clean = e->next;
2002 }
2003}
#define RX_BUF_SIZE
Definition 3c90x.h:269
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition iobuf.c:131
static void skge_rx_setup(struct skge_port *skge __unused, struct skge_element *e, struct io_buffer *iob, unsigned int bufsize)
Definition skge.c:339
A persistent I/O buffer.
Definition iobuf.h:38
u32 control
Definition skge.h:2423

References alloc_iob(), BMU_OWN, control, skge_rx_desc::control, DBG, DBG2, skge_element::desc, skge_element::iob, skge_element::next, NULL, NUM_RX_DESC, net_device::priv, RX_BUF_SIZE, skge_port::rx_ring, skge_rx_setup(), skge_ring::start, skge_ring::to_clean, and u32.

Referenced by skge_rx_done(), and skge_up().

◆ skge_supported_modes()

u32 skge_supported_modes ( const struct skge_hw * hw)
static

Definition at line 93 of file skge.c.

94{
96
97 if (hw->copper) {
105
106 if (hw->chip_id == CHIP_ID_GENESIS)
111
112 else if (hw->chip_id == CHIP_ID_YUKON)
114 } else
117
118 return supported;
119}
uint16_t supported
Bitmask of supported option values.
Definition ena.h:1
#define SUPPORTED_FIBRE
Definition skge.h:66
#define SUPPORTED_TP
Definition skge.h:65
#define SUPPORTED_Autoneg
Definition skge.h:64
#define SUPPORTED_100baseT_Half
Definition skge.h:60
#define SUPPORTED_1000baseT_Full
Definition skge.h:63
@ CHIP_ID_YUKON
Definition skge.h:319
#define SUPPORTED_10baseT_Full
Definition skge.h:59
#define SUPPORTED_100baseT_Full
Definition skge.h:61
#define SUPPORTED_1000baseT_Half
Definition skge.h:62
#define SUPPORTED_10baseT_Half
Definition skge.h:58

References CHIP_ID_GENESIS, CHIP_ID_YUKON, supported, SUPPORTED_1000baseT_Full, SUPPORTED_1000baseT_Half, SUPPORTED_100baseT_Full, SUPPORTED_100baseT_Half, SUPPORTED_10baseT_Full, SUPPORTED_10baseT_Half, SUPPORTED_Autoneg, SUPPORTED_FIBRE, SUPPORTED_TP, and u32.

Referenced by skge_devinit().

◆ hwkhz()

u32 hwkhz ( const struct skge_hw * hw)
inlinestatic

Definition at line 122 of file skge.c.

123{
124 return (hw->chip_id == CHIP_ID_GENESIS) ? 53125 : 78125;
125}

References CHIP_ID_GENESIS, and u32.

Referenced by skge_usecs2clk().

◆ skge_usecs2clk()

u32 skge_usecs2clk ( const struct skge_hw * hw,
u32 usec )
inlinestatic

Definition at line 128 of file skge.c.

129{
130 return hwkhz(hw) * usec / 1000;
131}
static u32 hwkhz(const struct skge_hw *hw)
Definition skge.c:122

References hwkhz(), and u32.

Referenced by skge_reset().

◆ skge_led()

void skge_led ( struct skge_port * skge,
enum led_mode mode )
static

Definition at line 134 of file skge.c.

135{
136 struct skge_hw *hw = skge->hw;
137 int port = skge->port;
138
139 if (hw->chip_id == CHIP_ID_GENESIS) {
140 switch (mode) {
141 case LED_MODE_OFF:
142 if (hw->phy_type == SK_PHY_BCOM)
144 else {
147 }
151 break;
152
153 case LED_MODE_ON:
156
159
160 break;
161
162 case LED_MODE_TST:
166
167 if (hw->phy_type == SK_PHY_BCOM)
169 else {
173 }
174
175 }
176 } else {
177 switch (mode) {
178 case LED_MODE_OFF:
186 break;
187 case LED_MODE_ON:
193
196 (skge->speed == SPEED_100 ?
198 break;
199 case LED_MODE_TST:
207 }
208 }
209}
@ PHY_BCOM_P_EXT_CTRL
Definition skge.h:1018
#define PHY_M_LED_MO_10(x)
Definition skge.h:1564
#define PHY_M_LED_MO_RX(x)
Definition skge.h:1567
@ PULS_170MS
Definition skge.h:1545
@ LED_T_OFF
Definition skge.h:708
@ LED_T_ON
Definition skge.h:707
#define PHY_M_LED_MO_1000(x)
Definition skge.h:1566
@ PHY_MARV_LED_CTRL
Definition skge.h:1055
@ PHY_MARV_LED_OVER
Definition skge.h:1056
@ PHY_B_PEC_LED_ON
Definition skge.h:1233
@ PHY_B_PEC_LED_OFF
Definition skge.h:1234
@ LED_START
Definition skge.h:698
#define PHY_M_LED_PULS_DUR(x)
Definition skge.h:1527
@ TX_LED_VAL
Definition skge.h:850
@ TX_LED_TST
Definition skge.h:852
@ TX_LED_CTRL
Definition skge.h:851
@ LINKLED_LINKSYNC_ON
Definition skge.h:901
@ LINKLED_OFF
Definition skge.h:898
@ LINKLED_ON
Definition skge.h:899
@ RX_LED_TST
Definition skge.h:610
@ RX_LED_CTRL
Definition skge.h:609
@ RX_LED_VAL
Definition skge.h:608
#define PHY_M_LED_BLINK_RT(x)
Definition skge.h:1528
#define PHY_M_LED_MO_100(x)
Definition skge.h:1565
@ PHY_M_LEDC_DP_CTRL
Definition skge.h:1533
@ PHY_M_LEDC_TX_CTRL
Definition skge.h:1536
@ BLINK_84MS
Definition skge.h:1554
@ MO_LED_ON
Definition skge.h:1574
@ MO_LED_OFF
Definition skge.h:1573
#define PHY_M_LED_MO_DUP(x)
Definition skge.h:1563

References BLINK_84MS, CHIP_ID_GENESIS, gm_phy_write(), skge_port::hw, LED_MODE_OFF, LED_MODE_ON, LED_MODE_TST, LED_START, LED_T_OFF, LED_T_ON, LINKLED_LINKSYNC_ON, LINKLED_OFF, LINKLED_ON, LNK_LED_REG, MO_LED_OFF, MO_LED_ON, mode, PHY_B_PEC_LED_OFF, PHY_B_PEC_LED_ON, PHY_BCOM_P_EXT_CTRL, PHY_M_LED_BLINK_RT, PHY_M_LED_MO_10, PHY_M_LED_MO_100, PHY_M_LED_MO_1000, PHY_M_LED_MO_DUP, PHY_M_LED_MO_RX, PHY_M_LED_PULS_DUR, PHY_M_LEDC_DP_CTRL, PHY_M_LEDC_TX_CTRL, PHY_MARV_LED_CTRL, PHY_MARV_LED_OVER, port, skge_port::port, PULS_170MS, RX_LED_CTRL, RX_LED_TST, RX_LED_VAL, SK_PHY_BCOM, SK_REG, skge_write32(), skge_write8(), skge_port::speed, SPEED_100, TX_LED_CTRL, TX_LED_TST, TX_LED_VAL, and xm_phy_write().

Referenced by skge_down(), and skge_up().

◆ skge_ring_alloc()

int skge_ring_alloc ( struct skge_ring * ring,
void * vaddr,
u32 base,
size_t num )
static

Definition at line 312 of file skge.c.

314{
315 struct skge_tx_desc *d;
316 struct skge_element *e;
317 unsigned int i;
318
319 ring->start = zalloc(num*sizeof(*e));
320 if (!ring->start)
321 return -ENOMEM;
322
323 for (i = 0, e = ring->start, d = vaddr; i < num; i++, e++, d++) {
324 e->desc = d;
325 if (i == num - 1) {
326 e->next = ring->start;
327 d->next_offset = base;
328 } else {
329 e->next = e + 1;
330 d->next_offset = base + (i+1) * sizeof(*d);
331 }
332 }
333 ring->to_use = ring->to_clean = ring->start;
334
335 return 0;
336}
uint32_t base
Base.
Definition librm.h:3
void * zalloc(size_t size)
Allocate cleared memory.
Definition malloc.c:662
uint32_t num
Definition multiboot.h:0
u32 next_offset
Definition skge.h:2437

References base, skge_element::desc, ENOMEM, skge_element::next, skge_tx_desc::next_offset, num, skge_ring::start, skge_ring::to_clean, skge_ring::to_use, u32, and zalloc().

Referenced by skge_up().

◆ skge_rx_setup()

void skge_rx_setup ( struct skge_port *skge __unused,
struct skge_element * e,
struct io_buffer * iob,
unsigned int bufsize )
static

Definition at line 339 of file skge.c.

342{
343 struct skge_rx_desc *rd = e->desc;
344 u64 map;
345
346 map = ( iob != NULL ) ? virt_to_bus(iob->data) : 0;
347
348 rd->dma_lo = map;
349 rd->dma_hi = map >> 32;
350 e->iob = iob;
351 rd->csum1_start = ETH_HLEN;
352 rd->csum2_start = ETH_HLEN;
353 rd->csum1 = 0;
354 rd->csum2 = 0;
355
356 wmb();
357
359}
uint8_t bufsize
Size of the packet, in bytes.
Definition int13.h:1
#define ETH_HLEN
Definition if_ether.h:10
@ BMU_TCP_CHECK
Definition skge.h:391
u16 csum2
Definition skge.h:2429
u16 csum1
Definition skge.h:2430
u16 csum2_start
Definition skge.h:2431
u16 csum1_start
Definition skge.h:2432
u32 dma_lo
Definition skge.h:2425
u32 dma_hi
Definition skge.h:2426

References __unused, BMU_IRQ_EOF, BMU_OWN, BMU_STF, BMU_TCP_CHECK, bufsize, skge_rx_desc::control, skge_rx_desc::csum1, skge_rx_desc::csum1_start, skge_rx_desc::csum2, skge_rx_desc::csum2_start, io_buffer::data, skge_element::desc, skge_rx_desc::dma_hi, skge_rx_desc::dma_lo, ETH_HLEN, skge_element::iob, map, NULL, virt_to_bus(), and wmb.

Referenced by skge_rx_refill().

◆ skge_rx_reuse()

void skge_rx_reuse ( struct skge_element * e,
unsigned int size )
inlinestatic

Definition at line 365 of file skge.c.

366{
367 struct skge_rx_desc *rd = e->desc;
368
369 rd->csum2 = 0;
370 rd->csum2_start = ETH_HLEN;
371
372 wmb();
373
375}
uint16_t size
Buffer size.
Definition dwmac.h:3

References BMU_IRQ_EOF, BMU_OWN, BMU_STF, BMU_TCP_CHECK, skge_rx_desc::control, skge_rx_desc::csum2, skge_rx_desc::csum2_start, skge_element::desc, ETH_HLEN, size, and wmb.

◆ skge_rx_clean()

void skge_rx_clean ( struct skge_port * skge)
static

Definition at line 379 of file skge.c.

380{
381 struct skge_ring *ring = &skge->rx_ring;
382 struct skge_element *e;
383
384 e = ring->start;
385 do {
386 struct skge_rx_desc *rd = e->desc;
387 rd->control = 0;
388 if (e->iob) {
389 free_iob(e->iob);
390 e->iob = NULL;
391 }
392 } while ((e = e->next) != ring->start);
393}
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition iobuf.c:153

References skge_rx_desc::control, skge_element::desc, free_iob(), skge_element::iob, skge_element::next, NULL, skge_port::rx_ring, and skge_ring::start.

Referenced by skge_down(), and skge_up().

◆ skge_link_up()

void skge_link_up ( struct skge_port * skge)
static

Definition at line 395 of file skge.c.

396{
397 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG),
399
400 netdev_link_up(skge->netdev);
401
402 DBG2(PFX "%s: Link is up at %d Mbps, %s duplex\n",
403 skge->netdev->name, skge->speed,
404 skge->duplex == DUPLEX_FULL ? "full" : "half");
405}
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition netdevice.h:789
@ LED_ON
Definition skge.h:718
@ LED_BLK_OFF
Definition skge.h:715
@ LED_SYNC_OFF
Definition skge.h:717
struct net_device * netdev
Definition skge.h:2497

References DBG2, skge_port::duplex, DUPLEX_FULL, skge_port::hw, LED_BLK_OFF, LED_ON, LED_SYNC_OFF, LNK_LED_REG, net_device::name, skge_port::netdev, netdev_link_up(), PFX, skge_port::port, SK_REG, skge_write8(), and skge_port::speed.

Referenced by genesis_link_up(), and yukon_link_up().

◆ skge_link_down()

void skge_link_down ( struct skge_port * skge)
static

Definition at line 407 of file skge.c.

408{
409 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
411
412 DBG2(PFX "%s: Link is down.\n", skge->netdev->name);
413}

References DBG2, skge_port::hw, LED_OFF, LNK_LED_REG, net_device::name, skge_port::netdev, netdev_link_down(), PFX, skge_port::port, SK_REG, and skge_write8().

Referenced by xm_link_down(), and yukon_link_down().

◆ xm_link_down()

void xm_link_down ( struct skge_hw * hw,
int port )
static

Definition at line 416 of file skge.c.

417{
418 struct net_device *dev = hw->dev[port];
419 struct skge_port *skge = dev->priv;
420
422
423 if (netdev_link_ok(dev))
424 skge_link_down(skge);
425}
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition netdevice.h:640
static void skge_link_down(struct skge_port *skge)
Definition skge.c:407
@ XM_IMSK_DISABLE
Definition skge.h:2251

References net_device::dev, netdev_link_ok(), port, net_device::priv, skge_link_down(), XM_IMSK, XM_IMSK_DISABLE, and xm_write16().

Referenced by bcom_check_link(), and xm_check_link().

◆ __xm_phy_read()

int __xm_phy_read ( struct skge_hw * hw,
int port,
u16 reg,
u16 * val )
static

Definition at line 427 of file skge.c.

428{
429 int i;
430
431 xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr);
433
434 if (hw->phy_type == SK_PHY_XMAC)
435 goto ready;
436
437 for (i = 0; i < PHY_RETRIES; i++) {
439 goto ready;
440 udelay(1);
441 }
442
443 return -ETIMEDOUT;
444 ready:
446
447 return 0;
448}
@ XM_MMU_PHY_RDY
Definition skge.h:2168

References ETIMEDOUT, PHY_RETRIES, port, reg, SK_PHY_XMAC, u16, udelay(), val, XM_MMU_CMD, XM_MMU_PHY_RDY, XM_PHY_ADDR, XM_PHY_DATA, xm_read16(), and xm_write16().

Referenced by xm_phy_read().

◆ xm_phy_read()

u16 xm_phy_read ( struct skge_hw * hw,
int port,
u16 reg )
static

Definition at line 450 of file skge.c.

451{
452 u16 v = 0;
453 if (__xm_phy_read(hw, port, reg, &v))
454 DBG(PFX "%s: phy read timed out\n",
455 hw->dev[port]->name);
456 return v;
457}
static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val)
Definition skge.c:427

References __xm_phy_read(), DBG, PFX, port, reg, and u16.

Referenced by bcom_check_link(), bcom_phy_init(), bcom_phy_intr(), genesis_link_up(), and xm_check_link().

◆ genesis_init()

void genesis_init ( struct skge_hw * hw)
static

Definition at line 481 of file skge.c.

482{
483 /* set blink source counter */
486
487 /* configure mac arbiter */
489
490 /* configure mac arbiter timeout values */
495
500
501 /* configure packet arbiter timeout */
507}
@ BSC_START
Definition skge.h:398
@ B3_PA_TOINI_TX2
Definition skge.h:180
@ B3_PA_TOINI_RX1
Definition skge.h:177
@ B2_BSC_CTRL
Definition skge.h:135
@ B2_BSC_INI
Definition skge.h:133
@ B3_PA_TOINI_TX1
Definition skge.h:179
@ B3_PA_TOINI_RX2
Definition skge.h:178
#define SK_PKT_TO_MAX
Definition skge.h:441
#define SK_MAC_TO_53
Definition skge.h:439
#define SK_BLK_DUR
Definition skge.h:857
#define SK_FACT_53
Definition skge.h:865
@ PA_RST_CLR
Definition skge.h:459

References B2_BSC_CTRL, B2_BSC_INI, B3_MA_RCINI_RX1, B3_MA_RCINI_RX2, B3_MA_RCINI_TX1, B3_MA_RCINI_TX2, B3_MA_TO_CTRL, B3_MA_TOINI_RX1, B3_MA_TOINI_RX2, B3_MA_TOINI_TX1, B3_MA_TOINI_TX2, B3_PA_CTRL, B3_PA_TOINI_RX1, B3_PA_TOINI_RX2, B3_PA_TOINI_TX1, B3_PA_TOINI_TX2, BSC_START, MA_RST_CLR, PA_RST_CLR, SK_BLK_DUR, SK_FACT_53, SK_MAC_TO_53, SK_PKT_TO_MAX, skge_write16(), skge_write32(), and skge_write8().

Referenced by skge_reset().

◆ genesis_reset()

void genesis_reset ( struct skge_hw * hw,
int port )
static

Definition at line 509 of file skge.c.

510{
511 const u8 zero[8] = { 0 };
512 u32 reg;
513
515
516 /* reset the statistics module */
519 xm_write32(hw, port, XM_MODE, 0); /* clear Mode Reg */
520 xm_write16(hw, port, XM_TX_CMD, 0); /* reset TX CMD Reg */
521 xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */
522
523 /* disable Broadcom PHY IRQ */
524 if (hw->phy_type == SK_PHY_BCOM)
526
527 xm_outhash(hw, port, XM_HSM, zero);
528
529 /* Flush TX and RX fifo */
533}
@ XM_GP_RES_STAT
Definition skge.h:2227
@ XM_MD_FRF
Definition skge.h:2333
@ XM_MD_FTF
Definition skge.h:2332
@ XM_GP_PORT
Definition skge.h:2074
@ GMAC_IRQ_MSK
Definition skge.h:911
static void xm_outhash(const struct skge_hw *hw, int port, int reg, const u8 *hash)
Definition skge.h:2576
@ XM_HSM
Definition skge.h:2095

References GMAC_IRQ_MSK, PHY_BCOM_INT_MASK, port, reg, SK_PHY_BCOM, SK_REG, skge_write8(), u32, u8, XM_GP_PORT, XM_GP_RES_STAT, XM_HSM, XM_IMSK, XM_IMSK_DISABLE, XM_MD_FRF, XM_MD_FTF, XM_MODE, xm_outhash(), xm_read32(), XM_RX_CMD, XM_TX_CMD, xm_write16(), and xm_write32().

Referenced by genesis_stop(), and skge_reset().

◆ bcom_check_link()

void bcom_check_link ( struct skge_hw * hw,
int port )
static

Definition at line 554 of file skge.c.

555{
556 struct net_device *dev = hw->dev[port];
557 struct skge_port *skge = dev->priv;
558 u16 status;
559
560 /* read twice because of latch */
563
564 if ((status & PHY_ST_LSYNC) == 0) {
566 return;
567 }
568
569 if (skge->autoneg == AUTONEG_ENABLE) {
570 u16 lpa, aux;
571
572 if (!(status & PHY_ST_AN_OVER))
573 return;
574
576 if (lpa & PHY_B_AN_RF) {
577 DBG(PFX "%s: remote fault\n",
578 dev->name);
579 return;
580 }
581
583
584 /* Check Duplex mismatch */
585 switch (aux & PHY_B_AS_AN_RES_MSK) {
586 case PHY_B_RES_1000FD:
587 skge->duplex = DUPLEX_FULL;
588 break;
589 case PHY_B_RES_1000HD:
590 skge->duplex = DUPLEX_HALF;
591 break;
592 default:
593 DBG(PFX "%s: duplex mismatch\n",
594 dev->name);
595 return;
596 }
597
598 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
599 switch (aux & PHY_B_AS_PAUSE_MSK) {
602 break;
603 case PHY_B_AS_PRR:
605 break;
606 case PHY_B_AS_PRT:
608 break;
609 default:
611 }
612 skge->speed = SPEED_1000;
613 }
614
615 if (!netdev_link_ok(dev))
616 genesis_link_up(skge);
617}
static void genesis_link_up(struct skge_port *skge)
Definition skge.c:1046
static void xm_link_down(struct skge_hw *hw, int port)
Definition skge.c:416
@ FLOW_STAT_REM_SEND
Definition skge.h:2489
@ PHY_BCOM_STAT
Definition skge.h:1006
@ PHY_BCOM_AUX_STAT
Definition skge.h:1025
@ PHY_B_AN_RF
Definition skge.h:1261
#define PHY_B_AS_PAUSE_MSK
Definition skge.h:1307
@ PHY_ST_AN_OVER
Definition skge.h:1094
@ PHY_ST_LSYNC
Definition skge.h:1097
@ PHY_B_RES_1000FD
Definition skge.h:1343
@ PHY_B_RES_1000HD
Definition skge.h:1344
@ PHY_XMAC_AUNE_LP
Definition skge.h:993
@ PHY_B_AS_PRT
Definition skge.h:1305
@ PHY_B_AS_PRR
Definition skge.h:1304
@ PHY_B_AS_AN_RES_MSK
Definition skge.h:1297

References skge_port::autoneg, AUTONEG_ENABLE, DBG, net_device::dev, skge_port::duplex, DUPLEX_FULL, DUPLEX_HALF, FLOW_STAT_LOC_SEND, FLOW_STAT_NONE, FLOW_STAT_REM_SEND, FLOW_STAT_SYMMETRIC, skge_port::flow_status, genesis_link_up(), net_device::name, netdev_link_ok(), PFX, PHY_B_AN_RF, PHY_B_AS_AN_RES_MSK, PHY_B_AS_PAUSE_MSK, PHY_B_AS_PRR, PHY_B_AS_PRT, PHY_B_RES_1000FD, PHY_B_RES_1000HD, PHY_BCOM_AUX_STAT, PHY_BCOM_STAT, PHY_ST_AN_OVER, PHY_ST_LSYNC, PHY_XMAC_AUNE_LP, port, net_device::priv, skge_port::speed, SPEED_1000, status, u16, xm_link_down(), and xm_phy_read().

Referenced by bcom_phy_intr(), and genesis_mac_init().

◆ bcom_phy_init()

void bcom_phy_init ( struct skge_port * skge)
static

Definition at line 622 of file skge.c.

623{
624 struct skge_hw *hw = skge->hw;
625 int port = skge->port;
626 unsigned int i;
627 u16 id1, r, ext, ctl;
628
629 /* magic workaround patterns for Broadcom */
630 static const struct {
631 u16 reg;
632 u16 val;
633 } A1hack[] = {
634 { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 },
635 { 0x17, 0x0013 }, { 0x15, 0x0404 }, { 0x17, 0x8006 },
636 { 0x15, 0x0132 }, { 0x17, 0x8006 }, { 0x15, 0x0232 },
637 { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 },
638 }, C0hack[] = {
639 { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1204 },
640 { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 },
641 };
642
643 /* read Id from external PHY (all have the same address) */
645
646 /* Optimize MDIO transfer by suppressing preamble. */
648 r |= XM_MMU_NO_PRE;
650
651 switch (id1) {
652 case PHY_BCOM_ID1_C0:
653 /*
654 * Workaround BCOM Errata for the C0 type.
655 * Write magic patterns to reserved registers.
656 */
657 for (i = 0; i < ARRAY_SIZE(C0hack); i++)
659 C0hack[i].reg, C0hack[i].val);
660
661 break;
662 case PHY_BCOM_ID1_A1:
663 /*
664 * Workaround BCOM Errata for the A1 type.
665 * Write magic patterns to reserved registers.
666 */
667 for (i = 0; i < ARRAY_SIZE(A1hack); i++)
669 A1hack[i].reg, A1hack[i].val);
670 break;
671 }
672
673 /*
674 * Workaround BCOM Errata (#10523) for all BCom PHYs.
675 * Disable Power Management after reset.
676 */
680
681 /* Dummy read */
683
684 ext = PHY_B_PEC_EN_LTR; /* enable tx led */
685 ctl = PHY_CT_SP1000; /* always 1000mbit */
686
687 if (skge->autoneg == AUTONEG_ENABLE) {
688 /*
689 * Workaround BCOM Errata #1 for the C5 type.
690 * 1000Base-T Link Acquisition Failure in Slave Mode
691 * Set Repeater/DTE bit 10 of the 1000Base-T Control Register
692 */
693 u16 adv = PHY_B_1000C_RD;
695 adv |= PHY_B_1000C_AHD;
697 adv |= PHY_B_1000C_AFD;
699
700 ctl |= PHY_CT_ANE | PHY_CT_RE_CFG;
701 } else {
702 if (skge->duplex == DUPLEX_FULL)
703 ctl |= PHY_CT_DUP_MD;
704 /* Force to slave */
706 }
707
708 /* Set autonegotiation pause parameters */
711
714
715 /* Use link status change interrupt */
717}
#define ARRAY_SIZE(x)
Definition efx_common.h:43
uint16_t ext
Extended status.
Definition ena.h:9
@ PHY_BCOM_ID1_C0
Definition skge.h:1112
@ PHY_BCOM_ID1_A1
Definition skge.h:1110
@ PHY_BCOM_CTRL
Definition skge.h:1005
@ PHY_BCOM_AUNE_ADV
Definition skge.h:1009
@ PHY_BCOM_1000T_CTRL
Definition skge.h:1015
@ XM_MMU_NO_PRE
Definition skge.h:2174
@ PHY_B_PEC_EN_LTR
Definition skge.h:1232
@ PHY_B_1000C_RD
Definition skge.h:1194
@ PHY_B_1000C_AFD
Definition skge.h:1195
@ PHY_B_1000C_AHD
Definition skge.h:1196
@ PHY_B_1000C_MSE
Definition skge.h:1192
@ PHY_XMAC_ID1
Definition skge.h:991

References ADVERTISED_1000baseT_Full, ADVERTISED_1000baseT_Half, skge_port::advertising, ARRAY_SIZE, skge_port::autoneg, AUTONEG_ENABLE, skge_port::duplex, DUPLEX_FULL, ext, skge_port::flow_control, skge_port::hw, PHY_AN_CSMA, PHY_B_1000C_AFD, PHY_B_1000C_AHD, PHY_B_1000C_MSE, PHY_B_1000C_RD, PHY_B_AC_DIS_PM, PHY_B_DEF_MSK, PHY_B_PEC_EN_LTR, PHY_BCOM_1000T_CTRL, PHY_BCOM_AUNE_ADV, PHY_BCOM_AUX_CTRL, PHY_BCOM_CTRL, PHY_BCOM_ID1_A1, PHY_BCOM_ID1_C0, PHY_BCOM_INT_MASK, PHY_BCOM_P_EXT_CTRL, PHY_CT_ANE, PHY_CT_DUP_MD, PHY_CT_RE_CFG, PHY_CT_SP1000, phy_pause_map, PHY_XMAC_ID1, port, skge_port::port, r, reg, u16, val, XM_ISRC, XM_MMU_CMD, XM_MMU_NO_PRE, xm_phy_read(), xm_phy_write(), xm_read16(), and xm_write16().

Referenced by genesis_mac_init().

◆ xm_phy_init()

void xm_phy_init ( struct skge_port * skge)
static

Definition at line 719 of file skge.c.

720{
721 struct skge_hw *hw = skge->hw;
722 int port = skge->port;
723 u16 ctrl = 0;
724
725 if (skge->autoneg == AUTONEG_ENABLE) {
727 ctrl |= PHY_X_AN_HD;
729 ctrl |= PHY_X_AN_FD;
730
732
734
735 /* Restart Auto-negotiation */
737 } else {
738 /* Set DuplexMode in Config register */
739 if (skge->duplex == DUPLEX_FULL)
741 /*
742 * Do NOT enable Auto-negotiation here. This would hold
743 * the link down because no IDLEs are transmitted
744 */
745 }
746
748
749 /* Poll PHY for status changes */
750 skge->use_xm_link_timer = 1;
751}
@ PHY_X_AN_FD
Definition skge.h:1153
@ PHY_X_AN_HD
Definition skge.h:1152
@ PHY_XMAC_CTRL
Definition skge.h:988
@ PHY_XMAC_AUNE_ADV
Definition skge.h:992

References ADVERTISED_1000baseT_Full, ADVERTISED_1000baseT_Half, skge_port::advertising, skge_port::autoneg, AUTONEG_ENABLE, ctrl, skge_port::duplex, DUPLEX_FULL, fiber_pause_map, skge_port::flow_control, skge_port::hw, PHY_CT_ANE, PHY_CT_DUP_MD, PHY_CT_RE_CFG, PHY_X_AN_FD, PHY_X_AN_HD, PHY_XMAC_AUNE_ADV, PHY_XMAC_CTRL, port, skge_port::port, u16, skge_port::use_xm_link_timer, and xm_phy_write().

Referenced by genesis_mac_init().

◆ xm_check_link()

int xm_check_link ( struct net_device * dev)
static

Definition at line 753 of file skge.c.

754{
755 struct skge_port *skge = dev->priv;
756 struct skge_hw *hw = skge->hw;
757 int port = skge->port;
758 u16 status;
759
760 /* read twice because of latch */
763
764 if ((status & PHY_ST_LSYNC) == 0) {
766 return 0;
767 }
768
769 if (skge->autoneg == AUTONEG_ENABLE) {
770 u16 lpa, res;
771
772 if (!(status & PHY_ST_AN_OVER))
773 return 0;
774
776 if (lpa & PHY_B_AN_RF) {
777 DBG(PFX "%s: remote fault\n",
778 dev->name);
779 return 0;
780 }
781
783
784 /* Check Duplex mismatch */
785 switch (res & (PHY_X_RS_HD | PHY_X_RS_FD)) {
786 case PHY_X_RS_FD:
787 skge->duplex = DUPLEX_FULL;
788 break;
789 case PHY_X_RS_HD:
790 skge->duplex = DUPLEX_HALF;
791 break;
792 default:
793 DBG(PFX "%s: duplex mismatch\n",
794 dev->name);
795 return 0;
796 }
797
798 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
799 if ((skge->flow_control == FLOW_MODE_SYMMETRIC ||
801 (lpa & PHY_X_P_SYM_MD))
803 else if (skge->flow_control == FLOW_MODE_SYM_OR_REM &&
805 /* Enable PAUSE receive, disable PAUSE transmit */
807 else if (skge->flow_control == FLOW_MODE_LOC_SEND &&
809 /* Disable PAUSE receive, enable PAUSE transmit */
811 else
813
814 skge->speed = SPEED_1000;
815 }
816
817 if (!netdev_link_ok(dev))
818 genesis_link_up(skge);
819 return 1;
820}
@ PHY_X_RS_HD
Definition skge.h:1174
@ PHY_X_RS_PAUSE
Definition skge.h:1173
@ PHY_X_RS_FD
Definition skge.h:1175
@ FLOW_MODE_SYMMETRIC
Definition skge.h:2480
@ FLOW_MODE_LOC_SEND
Definition skge.h:2479
@ FLOW_MODE_SYM_OR_REM
Definition skge.h:2481
@ PHY_X_P_BOTH_MD
Definition skge.h:1161
@ PHY_X_P_SYM_MD
Definition skge.h:1159
@ PHY_X_P_ASYM_MD
Definition skge.h:1160
@ PHY_XMAC_STAT
Definition skge.h:989
@ PHY_XMAC_RES_ABI
Definition skge.h:999

References skge_port::autoneg, AUTONEG_ENABLE, DBG, skge_hw::dev, skge_port::duplex, DUPLEX_FULL, DUPLEX_HALF, skge_port::flow_control, FLOW_MODE_LOC_SEND, FLOW_MODE_SYM_OR_REM, FLOW_MODE_SYMMETRIC, FLOW_STAT_LOC_SEND, FLOW_STAT_NONE, FLOW_STAT_REM_SEND, FLOW_STAT_SYMMETRIC, skge_port::flow_status, genesis_link_up(), skge_port::hw, net_device::name, netdev_link_ok(), PFX, PHY_B_AN_RF, PHY_ST_AN_OVER, PHY_ST_LSYNC, PHY_X_P_ASYM_MD, PHY_X_P_BOTH_MD, PHY_X_P_SYM_MD, PHY_X_RS_FD, PHY_X_RS_HD, PHY_X_RS_PAUSE, PHY_XMAC_AUNE_LP, PHY_XMAC_RES_ABI, PHY_XMAC_STAT, port, skge_port::port, net_device::priv, skge_port::speed, SPEED_1000, status, u16, xm_link_down(), and xm_phy_read().

Referenced by xm_link_timer().

◆ xm_link_timer()

void xm_link_timer ( struct skge_port * skge)
static

Definition at line 828 of file skge.c.

829{
830 struct net_device *dev = skge->netdev;
831 struct skge_hw *hw = skge->hw;
832 int port = skge->port;
833 int i;
834
835 /*
836 * Verify that the link by checking GPIO register three times.
837 * This pin has the signal from the link_sync pin connected to it.
838 */
839 for (i = 0; i < 3; i++) {
841 return;
842 }
843
844 /* Re-enable interrupt to detect link down */
845 if (xm_check_link(dev)) {
846 u16 msk = xm_read16(hw, port, XM_IMSK);
847 msk &= ~XM_IS_INP_ASS;
848 xm_write16(hw, port, XM_IMSK, msk);
850 }
851}
static int xm_check_link(struct net_device *dev)
Definition skge.c:753
@ XM_GP_INP_ASS
Definition skge.h:2228
@ XM_IS_INP_ASS
Definition skge.h:2238

References net_device::dev, skge_hw::dev, skge_port::hw, skge_port::netdev, port, skge_port::port, u16, xm_check_link(), XM_GP_INP_ASS, XM_GP_PORT, XM_IMSK, XM_IS_INP_ASS, XM_ISRC, xm_read16(), and xm_write16().

Referenced by skge_poll().

◆ genesis_stop()

void genesis_stop ( struct skge_port * skge)
static

Definition at line 999 of file skge.c.

1000{
1001 struct skge_hw *hw = skge->hw;
1002 int port = skge->port;
1003 unsigned retries = 1000;
1004 u16 cmd;
1005
1006 /* Disable Tx and Rx */
1010
1012
1013 /* Clear Tx packet arbiter timeout IRQ */
1016
1017 /* Reset the MAC */
1019 do {
1022 break;
1023 } while (--retries > 0);
1024
1025 /* For external PHYs there must be special handling */
1026 if (hw->phy_type != SK_PHY_XMAC) {
1028 if (port == 0) {
1029 reg |= GP_DIR_0;
1030 reg &= ~GP_IO_0;
1031 } else {
1032 reg |= GP_DIR_2;
1033 reg &= ~GP_IO_2;
1034 }
1037 }
1038
1042
1044}
static void genesis_reset(struct skge_hw *hw, int port)
Definition skge.c:509
@ PA_CLR_TO_TX2
Definition skge.h:447
@ PA_CLR_TO_TX1
Definition skge.h:448

References B2_GP_IO, B3_PA_CTRL, cmd, genesis_reset(), GP_DIR_0, GP_DIR_2, GP_IO_0, GP_IO_2, skge_port::hw, MFF_CLR_MAC_RST, MFF_SET_MAC_RST, PA_CLR_TO_TX1, PA_CLR_TO_TX2, port, skge_port::port, reg, SK_PHY_XMAC, SK_REG, skge_read16(), skge_read32(), skge_write16(), skge_write32(), TX_MFF_CTRL1, u16, u32, XM_MMU_CMD, XM_MMU_ENA_RX, XM_MMU_ENA_TX, xm_read16(), and xm_write16().

Referenced by skge_down().

◆ bcom_phy_intr()

void bcom_phy_intr ( struct skge_port * skge)
inlinestatic

Definition at line 1130 of file skge.c.

1131{
1132 struct skge_hw *hw = skge->hw;
1133 int port = skge->port;
1134 u16 isrc;
1135
1137 DBGIO(PFX "%s: phy interrupt status 0x%x\n",
1138 skge->netdev->name, isrc);
1139
1140 if (isrc & PHY_B_IS_PSE)
1141 DBG(PFX "%s: uncorrectable pair swap error\n",
1142 hw->dev[port]->name);
1143
1144 /* Workaround BCom Errata:
1145 * enable and disable loopback mode if "NO HCD" occurs.
1146 */
1147 if (isrc & PHY_B_IS_NO_HDCL) {
1150 ctrl | PHY_CT_LOOP);
1152 ctrl & ~PHY_CT_LOOP);
1153 }
1154
1155 if (isrc & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE))
1157
1158}
@ PHY_BCOM_INT_STAT
Definition skge.h:1026
@ PHY_CT_LOOP
Definition skge.h:1073
@ PHY_B_IS_LST_CHANGE
Definition skge.h:1325
@ PHY_B_IS_PSE
Definition skge.h:1312
@ PHY_B_IS_NO_HDCL
Definition skge.h:1317
@ PHY_B_IS_AN_PR
Definition skge.h:1316

References bcom_check_link(), ctrl, DBG, DBGIO, skge_port::hw, net_device::name, skge_port::netdev, PFX, PHY_B_IS_AN_PR, PHY_B_IS_LST_CHANGE, PHY_B_IS_NO_HDCL, PHY_B_IS_PSE, PHY_BCOM_CTRL, PHY_BCOM_INT_STAT, PHY_CT_LOOP, port, skge_port::port, u16, xm_phy_read(), and xm_phy_write().

Referenced by skge_phyirq().

◆ __gm_phy_read()

int __gm_phy_read ( struct skge_hw * hw,
int port,
u16 reg,
u16 * val )
static

Definition at line 1180 of file skge.c.

1181{
1182 int i;
1183
1185 GM_SMI_CT_PHY_AD(hw->phy_addr)
1187
1188 for (i = 0; i < PHY_RETRIES; i++) {
1189 udelay(1);
1191 goto ready;
1192 }
1193
1194 return -ETIMEDOUT;
1195 ready:
1197 return 0;
1198}
@ GM_SMI_CT_OP_RD
Definition skge.h:1864
@ GM_SMI_CT_RD_VAL
Definition skge.h:1865

References ETIMEDOUT, GM_SMI_CT_OP_RD, GM_SMI_CT_PHY_AD, GM_SMI_CT_RD_VAL, GM_SMI_CT_REG_AD, GM_SMI_CTRL, GM_SMI_DATA, gma_read16(), gma_write16(), PHY_RETRIES, port, reg, u16, udelay(), and val.

Referenced by gm_phy_read().

◆ gm_phy_read()

u16 gm_phy_read ( struct skge_hw * hw,
int port,
u16 reg )
static

Definition at line 1200 of file skge.c.

1201{
1202 u16 v = 0;
1203 if (__gm_phy_read(hw, port, reg, &v))
1204 DBG(PFX "%s: phy read timeout port %x reg %x val %x\n",
1205 hw->dev[port]->name,
1206 port, reg, v);
1207 return v;
1208}
static int __gm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val)
Definition skge.c:1180

References __gm_phy_read(), DBG, PFX, port, reg, and u16.

Referenced by yukon_init(), yukon_link_down(), yukon_phy_intr(), and yukon_suspend().

◆ yukon_reset()

void yukon_reset ( struct skge_hw * hw,
int port )
static

Definition at line 1298 of file skge.c.

1299{
1300 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);/* disable PHY IRQs */
1301 gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */
1305
1309}
@ GM_RX_CTRL
Definition skge.h:1680
@ GM_MC_ADDR_H1
Definition skge.h:1693
@ GM_MC_ADDR_H4
Definition skge.h:1696
@ GM_MC_ADDR_H3
Definition skge.h:1695
@ GM_MC_ADDR_H2
Definition skge.h:1694
@ GM_RXCR_MCF_ENA
Definition skge.h:1824
@ GM_RXCR_UCF_ENA
Definition skge.h:1823

References GM_MC_ADDR_H1, GM_MC_ADDR_H2, GM_MC_ADDR_H3, GM_MC_ADDR_H4, gm_phy_write(), GM_RX_CTRL, GM_RXCR_MCF_ENA, GM_RXCR_UCF_ENA, gma_read16(), gma_write16(), PHY_MARV_INT_MASK, and port.

Referenced by skge_reset(), and yukon_stop().

◆ is_yukon_lite_a0()

int is_yukon_lite_a0 ( struct skge_hw * hw)
static

Definition at line 1312 of file skge.c.

1313{
1314 u32 reg;
1315 int ret;
1316
1317 if (hw->chip_id != CHIP_ID_YUKON)
1318 return 0;
1319
1321 skge_write8(hw, B2_FAR + 3, 0xff);
1322 ret = (skge_read8(hw, B2_FAR + 3) != 0);
1324 return ret;
1325}
@ B2_FAR
Definition skge.h:112
static u8 skge_read8(const struct skge_hw *hw, int reg)
Definition skge.h:2527

References B2_FAR, CHIP_ID_YUKON, reg, skge_read32(), skge_read8(), skge_write32(), skge_write8(), and u32.

Referenced by yukon_mac_init().

◆ yukon_mac_init()

void yukon_mac_init ( struct skge_hw * hw,
int port )
static

Definition at line 1327 of file skge.c.

1328{
1329 struct skge_port *skge = hw->dev[port]->priv;
1330 int i;
1331 u32 reg;
1332 const u8 *addr = hw->dev[port]->ll_addr;
1333
1334 /* WA code for COMA mode -- set PHY reset */
1335 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1336 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1338 reg |= GP_DIR_9 | GP_IO_9;
1340 }
1341
1342 /* hard reset */
1345
1346 /* WA code for COMA mode -- clear PHY reset */
1347 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1348 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1350 reg |= GP_DIR_9;
1351 reg &= ~GP_IO_9;
1353 }
1354
1355 /* Set hardware config mode */
1359
1360 /* Clear GMC reset */
1364
1365 if (skge->autoneg == AUTONEG_DISABLE) {
1369
1370 switch (skge->speed) {
1371 case SPEED_1000:
1374 break;
1375 case SPEED_100:
1378 break;
1379 case SPEED_10:
1381 break;
1382 }
1383
1384 if (skge->duplex == DUPLEX_FULL)
1386 } else
1388
1389 switch (skge->flow_control) {
1390 case FLOW_MODE_NONE:
1393 break;
1394 case FLOW_MODE_LOC_SEND:
1395 /* disable Rx flow-control */
1397 break;
1400 /* enable Tx & Rx flow-control */
1401 break;
1402 }
1403
1406
1407 yukon_init(hw, port);
1408
1409 /* MIB clear */
1412
1413 for (i = 0; i < GM_MIB_CNT_SIZE; i++)
1416
1417 /* transmit control */
1419
1420 /* receive control reg: unicast + multicast + no FCS */
1423
1424 /* transmit flow control */
1426
1427 /* transmit parameter */
1432
1433 /* configure the Serial Mode Register */
1437
1439
1440 /* physical address: used for pause frames */
1442 /* virtual address for data */
1444
1445 /* enable interrupt mask for counter overflows */
1449
1450 /* Initialize Mac Fifo */
1451
1452 /* Configure Rx MAC FIFO */
1455
1456 /* disable Rx GMAC FIFO Flush for YUKON-Lite Rev. A0 only */
1457 if (is_yukon_lite_a0(hw))
1459
1462 /*
1463 * because Pause Packet Truncation in GMAC is not working
1464 * we have to increase the Flush Threshold to 64 bytes
1465 * in order to flush pause packets in Rx FIFO on Yukon-1
1466 */
1468
1469 /* Configure Tx MAC FIFO */
1472}
#define SPEED_10
Definition atl1e.h:50
uint32_t addr
Buffer address.
Definition dwmac.h:9
static int is_yukon_lite_a0(struct skge_hw *hw)
Definition skge.c:1312
static void yukon_init(struct skge_hw *hw, int port)
Definition skge.c:1211
#define IPG_DATA_DEF
Definition skge.h:1858
#define TX_COL_DEF
Definition skge.h:1819
@ GM_TX_CTRL
Definition skge.h:1679
@ GM_RX_IRQ_MSK
Definition skge.h:1705
@ GM_SRC_ADDR_2L
Definition skge.h:1688
@ GM_SRC_ADDR_1L
Definition skge.h:1685
@ GM_TR_IRQ_MSK
Definition skge.h:1706
@ GM_TX_IRQ_MSK
Definition skge.h:1704
@ GM_TX_FLOW_CTRL
Definition skge.h:1681
@ GM_PHY_ADDR
Definition skge.h:1711
@ GM_TX_PARAM
Definition skge.h:1682
@ GM_SERIAL_MODE
Definition skge.h:1683
@ GM_GP_CTRL
Definition skge.h:1678
#define GM_MIB_CNT_SIZE
Definition skge.h:1716
#define GM_GPCR_SPEED_1000
Definition skge.h:1807
#define TX_IPG_JAM_DATA(x)
Definition skge.h:1842
#define TX_JAM_IPG_VAL(x)
Definition skge.h:1841
@ RX_GMF_FL_THR_DEF
Definition skge.h:1926
@ GMF_RST_CLR
Definition skge.h:1923
@ GMF_OPER_ON
Definition skge.h:1921
@ GMF_RX_F_FL_ON
Definition skge.h:1917
@ GMC_PAUSE_ON
Definition skge.h:1954
@ GMC_RST_SET
Definition skge.h:1957
@ GMC_RST_CLR
Definition skge.h:1956
@ GMC_PAUSE_OFF
Definition skge.h:1955
#define TX_JAM_LEN_VAL(x)
Definition skge.h:1840
#define TX_COL_THR(x)
Definition skge.h:1818
#define GPC_HWCFG_GMII_FIB
Definition skge.h:1989
@ FLOW_MODE_NONE
Definition skge.h:2478
@ RX_GMF_FL_MSK
Definition skge.h:727
@ RX_GMF_FL_THR
Definition skge.h:728
#define GM_GPCR_AU_ALL_DIS
Definition skge.h:1808
static void gma_set_addr(struct skge_hw *hw, int port, int reg, const u8 *addr)
Definition skge.h:2612
@ GP_IO_9
Definition skge.h:360
@ GP_DIR_9
Definition skge.h:349
#define IPG_DATA_VAL(x)
Definition skge.h:1857
@ GM_RXCR_CRC_DIS
Definition skge.h:1825
@ GM_SMOD_VLAN_ENA
Definition skge.h:1849
@ CHIP_ID_YUKON_LITE
Definition skge.h:320
@ CHIP_REV_YU_LITE_A3
Definition skge.h:327
#define GPC_ANEG_ADV_ALL_M
Definition skge.h:1990
@ GPHY_CTRL
Definition skge.h:909
@ GMAC_IRQ_SRC
Definition skge.h:910
@ GMAC_CTRL
Definition skge.h:908
@ GM_GPCR_DUP_FULL
Definition skge.h:1799
@ GM_GPCR_SPEED_100
Definition skge.h:1801
@ GM_GPCR_AU_FCT_DIS
Definition skge.h:1803
@ GM_GPCR_FC_RX_DIS
Definition skge.h:1800
@ GM_GPCR_FC_TX_DIS
Definition skge.h:1791
@ TX_JAM_LEN_DEF
Definition skge.h:1835
@ TX_JAM_IPG_DEF
Definition skge.h:1836
@ TX_IPG_JAM_DEF
Definition skge.h:1837
@ GPC_ENA_XC
Definition skge.h:1972
@ GPC_INT_POL_HI
Definition skge.h:1963
@ GPC_DIS_SLEEP
Definition skge.h:1966
@ GPC_RST_SET
Definition skge.h:1985
@ GPC_ENA_PAUSE
Definition skge.h:1977
@ GPC_DIS_FC
Definition skge.h:1965
@ GPC_RST_CLR
Definition skge.h:1984
#define GPC_HWCFG_GMII_COP
Definition skge.h:1988
#define DATA_BLIND_VAL(x)
Definition skge.h:1854
@ GM_PAR_MIB_CLR
Definition skge.h:1874
@ RX_FF_FL_DEF_MSK
Definition skge.h:1904
#define GM_MIB_CNT_BASE
Definition skge.h:1715
#define DATA_BLIND_DEF
Definition skge.h:1855

References addr, skge_port::autoneg, AUTONEG_DISABLE, B2_GP_IO, CHIP_ID_YUKON_LITE, CHIP_REV_YU_LITE_A3, DATA_BLIND_DEF, DATA_BLIND_VAL, skge_port::duplex, DUPLEX_FULL, skge_port::flow_control, FLOW_MODE_LOC_SEND, FLOW_MODE_NONE, FLOW_MODE_SYM_OR_REM, FLOW_MODE_SYMMETRIC, GM_GP_CTRL, GM_GPCR_AU_ALL_DIS, GM_GPCR_AU_FCT_DIS, GM_GPCR_DUP_FULL, GM_GPCR_FC_RX_DIS, GM_GPCR_FC_TX_DIS, GM_GPCR_SPEED_100, GM_GPCR_SPEED_1000, GM_MIB_CNT_BASE, GM_MIB_CNT_SIZE, GM_PAR_MIB_CLR, GM_PHY_ADDR, GM_RX_CTRL, GM_RX_IRQ_MSK, GM_RXCR_CRC_DIS, GM_RXCR_MCF_ENA, GM_RXCR_UCF_ENA, GM_SERIAL_MODE, GM_SMOD_VLAN_ENA, GM_SRC_ADDR_1L, GM_SRC_ADDR_2L, GM_TR_IRQ_MSK, GM_TX_CTRL, GM_TX_FLOW_CTRL, GM_TX_IRQ_MSK, GM_TX_PARAM, gma_read16(), gma_set_addr(), gma_write16(), GMAC_CTRL, GMAC_IRQ_SRC, GMC_PAUSE_OFF, GMC_PAUSE_ON, GMC_RST_CLR, GMC_RST_SET, GMF_OPER_ON, GMF_RST_CLR, GMF_RX_F_FL_ON, GP_DIR_9, GP_IO_9, GPC_ANEG_ADV_ALL_M, GPC_DIS_FC, GPC_DIS_SLEEP, GPC_ENA_PAUSE, GPC_ENA_XC, GPC_HWCFG_GMII_COP, GPC_HWCFG_GMII_FIB, GPC_INT_POL_HI, GPC_RST_CLR, GPC_RST_SET, GPHY_CTRL, IPG_DATA_DEF, IPG_DATA_VAL, is_yukon_lite_a0(), port, reg, RX_FF_FL_DEF_MSK, RX_GMF_CTRL_T, RX_GMF_FL_MSK, RX_GMF_FL_THR, RX_GMF_FL_THR_DEF, SK_REG, skge_read16(), skge_read32(), skge_write16(), skge_write32(), skge_write8(), skge_port::speed, SPEED_10, SPEED_100, SPEED_1000, TX_COL_DEF, TX_COL_THR, TX_GMF_CTRL_T, TX_IPG_JAM_DATA, TX_IPG_JAM_DEF, TX_JAM_IPG_DEF, TX_JAM_IPG_VAL, TX_JAM_LEN_DEF, TX_JAM_LEN_VAL, u32, u8, and yukon_init().

Referenced by skge_up().

◆ yukon_suspend()

void yukon_suspend ( struct skge_hw * hw,
int port )
static

Definition at line 1475 of file skge.c.

1476{
1477 u16 ctrl;
1478
1482
1484 ctrl |= PHY_CT_RESET;
1486
1487 /* switch IEEE compatible power down mode on */
1489 ctrl |= PHY_CT_PDOWN;
1491}
@ PHY_CT_PDOWN
Definition skge.h:1076
@ PHY_MARV_PHY_CTRL
Definition skge.h:1047
@ PHY_M_PC_POL_R_DIS
Definition skge.h:1401

References ctrl, gm_phy_read(), gm_phy_write(), PHY_CT_PDOWN, PHY_CT_RESET, PHY_M_PC_POL_R_DIS, PHY_MARV_CTRL, PHY_MARV_PHY_CTRL, port, and u16.

Referenced by yukon_stop().

◆ yukon_stop()

void yukon_stop ( struct skge_port * skge)
static

Definition at line 1493 of file skge.c.

1494{
1495 struct skge_hw *hw = skge->hw;
1496 int port = skge->port;
1497
1500
1505
1507
1508 /* set GPHY Control reset */
1511}
static void yukon_suspend(struct skge_hw *hw, int port)
Definition skge.c:1475
static void yukon_reset(struct skge_hw *hw, int port)
Definition skge.c:1298
@ GM_GPCR_TX_ENA
Definition skge.h:1792
@ GM_GPCR_RX_ENA
Definition skge.h:1793

References GM_GP_CTRL, GM_GPCR_RX_ENA, GM_GPCR_TX_ENA, gma_read16(), gma_write16(), GMAC_CTRL, GMAC_IRQ_MSK, GMC_RST_SET, GPC_RST_SET, GPHY_CTRL, skge_port::hw, port, skge_port::port, SK_REG, skge_write8(), yukon_reset(), and yukon_suspend().

Referenced by skge_down().

◆ yukon_speed()

u16 yukon_speed ( const struct skge_hw *hw __unused,
u16 aux )
static

Definition at line 1513 of file skge.c.

1514{
1515 switch (aux & PHY_M_PS_SPEED_MSK) {
1517 return SPEED_1000;
1518 case PHY_M_PS_SPEED_100:
1519 return SPEED_100;
1520 default:
1521 return SPEED_10;
1522 }
1523}
@ PHY_M_PS_SPEED_1000
Definition skge.h:1434
@ PHY_M_PS_SPEED_MSK
Definition skge.h:1433
@ PHY_M_PS_SPEED_100
Definition skge.h:1435

References __unused, PHY_M_PS_SPEED_100, PHY_M_PS_SPEED_1000, PHY_M_PS_SPEED_MSK, SPEED_10, SPEED_100, SPEED_1000, and u16.

Referenced by yukon_phy_intr().

◆ yukon_link_up()

void yukon_link_up ( struct skge_port * skge)
static

Definition at line 1525 of file skge.c.

1526{
1527 struct skge_hw *hw = skge->hw;
1528 int port = skge->port;
1529 u16 reg;
1530
1531 /* Enable Transmit FIFO Underrun */
1533
1535 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE)
1537
1538 /* enable Rx/Tx */
1541
1543 skge_link_up(skge);
1544}
#define GMAC_DEF_MSK
Definition skge.h:2021

References skge_port::autoneg, AUTONEG_ENABLE, skge_port::duplex, DUPLEX_FULL, GM_GP_CTRL, GM_GPCR_DUP_FULL, GM_GPCR_RX_ENA, GM_GPCR_TX_ENA, gm_phy_write(), gma_read16(), gma_write16(), GMAC_DEF_MSK, GMAC_IRQ_MSK, skge_port::hw, PHY_M_IS_DEF_MSK, PHY_MARV_INT_MASK, port, skge_port::port, reg, SK_REG, skge_link_up(), skge_write8(), and u16.

Referenced by yukon_phy_intr().

◆ yukon_link_down()

void yukon_link_down ( struct skge_port * skge)
static

Definition at line 1546 of file skge.c.

1547{
1548 struct skge_hw *hw = skge->hw;
1549 int port = skge->port;
1550 u16 ctrl;
1551
1555
1556 if (skge->flow_status == FLOW_STAT_REM_SEND) {
1558 ctrl |= PHY_M_AN_ASP;
1559 /* restore Asymmetric Pause bit */
1561 }
1562
1563 skge_link_down(skge);
1564
1565 yukon_init(hw, port);
1566}
@ PHY_M_AN_ASP
Definition skge.h:1353

References ctrl, FLOW_STAT_REM_SEND, skge_port::flow_status, GM_GP_CTRL, GM_GPCR_RX_ENA, GM_GPCR_TX_ENA, gm_phy_read(), gm_phy_write(), gma_read16(), gma_write16(), skge_port::hw, PHY_M_AN_ASP, PHY_MARV_AUNE_ADV, port, skge_port::port, skge_link_down(), u16, and yukon_init().

Referenced by yukon_phy_intr().

◆ yukon_phy_intr()

void yukon_phy_intr ( struct skge_port * skge)
static

Definition at line 1568 of file skge.c.

1569{
1570 struct skge_hw *hw = skge->hw;
1571 int port = skge->port;
1572 const char *reason = NULL;
1573 u16 istatus, phystat;
1574
1575 istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT);
1576 phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT);
1577
1578 DBGIO(PFX "%s: phy interrupt status 0x%x 0x%x\n",
1579 skge->netdev->name, istatus, phystat);
1580
1581 if (istatus & PHY_M_IS_AN_COMPL) {
1583 & PHY_M_AN_RF) {
1584 reason = "remote fault";
1585 goto failed;
1586 }
1587
1589 reason = "master/slave fault";
1590 goto failed;
1591 }
1592
1593 if (!(phystat & PHY_M_PS_SPDUP_RES)) {
1594 reason = "speed/duplex";
1595 goto failed;
1596 }
1597
1598 skge->duplex = (phystat & PHY_M_PS_FULL_DUP)
1600 skge->speed = yukon_speed(hw, phystat);
1601
1602 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
1603 switch (phystat & PHY_M_PS_PAUSE_MSK) {
1604 case PHY_M_PS_PAUSE_MSK:
1606 break;
1607 case PHY_M_PS_RX_P_EN:
1609 break;
1610 case PHY_M_PS_TX_P_EN:
1612 break;
1613 default:
1615 }
1616
1617 if (skge->flow_status == FLOW_STAT_NONE ||
1618 (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF))
1620 else
1622 yukon_link_up(skge);
1623 return;
1624 }
1625
1626 if (istatus & PHY_M_IS_LSP_CHANGE)
1627 skge->speed = yukon_speed(hw, phystat);
1628
1629 if (istatus & PHY_M_IS_DUP_CHANGE)
1630 skge->duplex = (phystat & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
1631 if (istatus & PHY_M_IS_LST_CHANGE) {
1632 if (phystat & PHY_M_PS_LINK_UP)
1633 yukon_link_up(skge);
1634 else
1635 yukon_link_down(skge);
1636 }
1637 return;
1638 failed:
1639 DBG(PFX "%s: autonegotiation failed (%s)\n",
1640 skge->netdev->name, reason);
1641
1642 /* XXX restart autonegotiation? */
1643}
uint16_t reason
Rejection reason.
Definition ib_mad.h:9
static void yukon_link_up(struct skge_port *skge)
Definition skge.c:1525
static u16 yukon_speed(const struct skge_hw *hw __unused, u16 aux)
Definition skge.c:1513
static void yukon_link_down(struct skge_port *skge)
Definition skge.c:1546
#define PHY_M_PS_PAUSE_MSK
Definition skge.h:1451
@ PHY_MARV_PHY_STAT
Definition skge.h:1048
@ PHY_MARV_INT_STAT
Definition skge.h:1050
@ PHY_MARV_AUNE_LP
Definition skge.h:1039
@ PHY_MARV_1000T_STAT
Definition skge.h:1045
@ PHY_B_1000S_MSF
Definition skge.h:1202
@ PHY_M_IS_AN_COMPL
Definition skge.h:1464
@ PHY_M_IS_LST_CHANGE
Definition skge.h:1465
@ PHY_M_IS_DUP_CHANGE
Definition skge.h:1462
@ PHY_M_IS_LSP_CHANGE
Definition skge.h:1461
@ PHY_M_PS_FULL_DUP
Definition skge.h:1437
@ PHY_M_PS_LINK_UP
Definition skge.h:1440
@ PHY_M_PS_TX_P_EN
Definition skge.h:1445
@ PHY_M_PS_RX_P_EN
Definition skge.h:1446
@ PHY_M_PS_SPDUP_RES
Definition skge.h:1439
@ PHY_M_AN_RF
Definition skge.h:1351

References DBG, DBGIO, skge_port::duplex, DUPLEX_FULL, DUPLEX_HALF, FLOW_STAT_LOC_SEND, FLOW_STAT_NONE, FLOW_STAT_REM_SEND, FLOW_STAT_SYMMETRIC, skge_port::flow_status, gm_phy_read(), GMAC_CTRL, GMC_PAUSE_OFF, GMC_PAUSE_ON, skge_port::hw, net_device::name, skge_port::netdev, NULL, PFX, PHY_B_1000S_MSF, PHY_M_AN_RF, PHY_M_IS_AN_COMPL, PHY_M_IS_DUP_CHANGE, PHY_M_IS_LSP_CHANGE, PHY_M_IS_LST_CHANGE, PHY_M_PS_FULL_DUP, PHY_M_PS_LINK_UP, PHY_M_PS_PAUSE_MSK, PHY_M_PS_RX_P_EN, PHY_M_PS_SPDUP_RES, PHY_M_PS_TX_P_EN, PHY_MARV_1000T_STAT, PHY_MARV_AUNE_LP, PHY_MARV_INT_STAT, PHY_MARV_PHY_STAT, port, skge_port::port, reason, SK_REG, skge_write8(), skge_port::speed, SPEED_1000, u16, yukon_link_down(), yukon_link_up(), and yukon_speed().

Referenced by skge_phyirq().

◆ skge_ramset()

void skge_ramset ( struct skge_hw * hw,
u16 q,
u32 start,
size_t len )
static

Definition at line 1645 of file skge.c.

1646{
1647 u32 end;
1648
1649 start /= 8;
1650 len /= 8;
1651 end = start + len - 1;
1652
1658
1659 if (q == Q_R1 || q == Q_R2) {
1660 /* Set thresholds on receive queue's */
1662 start + (2*len)/3);
1664 start + (len/3));
1665 } else {
1666 /* Enable store & forward on Tx queue's because
1667 * Tx FIFO is only 4K on Genesis and 1K on Yukon
1668 */
1670 }
1671
1673}
uint32_t start
Starting offset.
Definition netvsc.h:1
uint32_t end
Ending offset.
Definition netvsc.h:7
@ RB_ENA_OP_MD
Definition skge.h:828
@ RB_ENA_STFWD
Definition skge.h:826
@ RB_RST_CLR
Definition skge.h:830
@ RB_END
Definition skge.h:540
@ RB_RX_LTPP
Definition skge.h:544
@ RB_RP
Definition skge.h:542
@ RB_RX_UTPP
Definition skge.h:543
@ RB_WP
Definition skge.h:541
@ RB_START
Definition skge.h:539
@ Q_R1
Definition skge.h:557
@ Q_R2
Definition skge.h:558

References end, len, Q_R1, Q_R2, RB_ADDR, RB_CTRL, RB_ENA_OP_MD, RB_ENA_STFWD, RB_END, RB_RP, RB_RST_CLR, RB_RX_LTPP, RB_RX_UTPP, RB_START, RB_WP, skge_write32(), skge_write8(), start, u16, and u32.

Referenced by skge_up().

◆ skge_qset()

void skge_qset ( struct skge_port * skge,
u16 q,
const struct skge_element * e )
static

Definition at line 1676 of file skge.c.

1678{
1679 struct skge_hw *hw = skge->hw;
1680 u32 watermark = 0x600;
1681 u64 base = skge->dma + (e->desc - skge->mem);
1682
1683 /* optimization to reduce window on 32bit/33mhz */
1685 watermark /= 2;
1686
1688 skge_write32(hw, Q_ADDR(q, Q_F), watermark);
1689 skge_write32(hw, Q_ADDR(q, Q_DA_H), (u32)(base >> 32));
1691}
#define CSR_CLR_RESET
Definition skge.h:793
@ B0_CTST
Definition skge.h:78
@ CS_BUS_SLOT_SZ
Definition skge.h:196
@ CS_BUS_CLOCK
Definition skge.h:195
@ Q_DA_H
Definition skge.h:519
@ Q_DA_L
Definition skge.h:518
@ Q_F
Definition skge.h:524

References B0_CTST, base, CS_BUS_CLOCK, CS_BUS_SLOT_SZ, CSR_CLR_RESET, skge_element::desc, skge_port::dma, skge_port::hw, skge_port::mem, Q_ADDR, Q_CSR, Q_DA_H, Q_DA_L, Q_F, skge_read16(), skge_write32(), u16, and u32.

Referenced by skge_up().

◆ skge_free()

void skge_free ( struct net_device * dev)

Definition at line 1693 of file skge.c.

1694{
1695 struct skge_port *skge = dev->priv;
1696
1697 free(skge->rx_ring.start);
1698 skge->rx_ring.start = NULL;
1699
1700 free(skge->tx_ring.start);
1701 skge->tx_ring.start = NULL;
1702
1703 free_phys(skge->mem, RING_SIZE);
1704 skge->mem = NULL;
1705 skge->dma = 0;
1706}
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition malloc.c:723
static void(* free)(struct refcnt *refcnt))
Definition refcnt.h:55

References skge_port::dma, free, free_phys(), skge_port::mem, NULL, net_device::priv, RING_SIZE, skge_port::rx_ring, skge_ring::start, and skge_port::tx_ring.

Referenced by skge_down(), and skge_up().

◆ skge_rx_stop()

void skge_rx_stop ( struct skge_hw * hw,
int port )
static

◆ skge_tx_avail()

int skge_tx_avail ( const struct skge_ring * ring)
inlinestatic

Definition at line 1857 of file skge.c.

1858{
1859 mb();
1860 return ((ring->to_clean > ring->to_use) ? 0 : NUM_TX_DESC)
1861 + (ring->to_clean - ring->to_use) - 1;
1862}
void mb(void)
Memory barrier.

References mb(), NUM_TX_DESC, skge_ring::to_clean, and skge_ring::to_use.

Referenced by skge_xmit_frame().

◆ phy_length()

u16 phy_length ( const struct skge_hw * hw,
u32 status )
inlinestatic

Definition at line 1923 of file skge.c.

1924{
1925 if (hw->chip_id == CHIP_ID_GENESIS)
1926 return status >> XMR_FS_LEN_SHIFT;
1927 else
1928 return status >> GMR_FS_LEN_SHIFT;
1929}
@ XMR_FS_LEN_SHIFT
Definition skge.h:954
@ GMR_FS_LEN_SHIFT
Definition skge.h:1881

References CHIP_ID_GENESIS, GMR_FS_LEN_SHIFT, status, u16, u32, and XMR_FS_LEN_SHIFT.

Referenced by skge_rx_done().

◆ bad_phy_status()

int bad_phy_status ( const struct skge_hw * hw,
u32 status )
inlinestatic

Definition at line 1931 of file skge.c.

1932{
1933 if (hw->chip_id == CHIP_ID_GENESIS)
1934 return (status & (XMR_FS_ERR | XMR_FS_2L_VLAN)) != 0;
1935 else
1936 return (status & GMR_FS_ANY_ERR) ||
1937 (status & GMR_FS_RX_OK) == 0;
1938}
@ XMR_FS_2L_VLAN
Definition skge.h:955
@ XMR_FS_ERR
Definition skge.h:971
@ GMR_FS_RX_OK
Definition skge.h:1887
@ GMR_FS_ANY_ERR
Definition skge.h:1900

References CHIP_ID_GENESIS, GMR_FS_ANY_ERR, GMR_FS_RX_OK, status, u32, XMR_FS_2L_VLAN, and XMR_FS_ERR.

Referenced by skge_rx_done().

◆ skge_tx_done()

void skge_tx_done ( struct net_device * dev)
static

Definition at line 1941 of file skge.c.

1942{
1943 struct skge_port *skge = dev->priv;
1944 struct skge_ring *ring = &skge->tx_ring;
1945 struct skge_element *e;
1946
1948
1949 for (e = ring->to_clean; e != ring->to_use; e = e->next) {
1950 u32 control = ((const struct skge_tx_desc *) e->desc)->control;
1951
1952 if (control & BMU_OWN)
1953 break;
1954
1955 netdev_tx_complete(dev, e->iob);
1956 }
1957 skge->tx_ring.to_clean = e;
1958
1959 /* Can run lockless until we need to synchronize to restart queue. */
1960 mb();
1961}
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition netdevice.h:767

References BMU_OWN, control, CSR_IRQ_CL_F, skge_element::desc, skge_port::hw, skge_element::iob, mb(), netdev_tx_complete(), skge_element::next, skge_port::port, net_device::priv, Q_ADDR, Q_CSR, skge_write8(), skge_ring::to_clean, skge_ring::to_use, skge_port::tx_ring, txqaddr, and u32.

Referenced by skge_poll().

◆ skge_rx_done()

void skge_rx_done ( struct net_device * dev)
static

Definition at line 2005 of file skge.c.

2006{
2007 struct skge_port *skge = dev->priv;
2008 struct skge_ring *ring = &skge->rx_ring;
2009 struct skge_rx_desc *rd;
2010 struct skge_element *e;
2011 struct io_buffer *iob;
2012 u32 control;
2013 u16 len;
2014 int i;
2015
2016 e = ring->to_clean;
2017 for (i = 0; i < NUM_RX_DESC; i++) {
2018 iob = e->iob;
2019 rd = e->desc;
2020
2021 rmb();
2022 control = rd->control;
2023
2024 if ((control & BMU_OWN))
2025 break;
2026
2027 if (!iob)
2028 continue;
2029
2030 len = control & BMU_BBC;
2031
2032 /* catch RX errors */
2033 if ((bad_phy_status(skge->hw, rd->status)) ||
2034 (phy_length(skge->hw, rd->status) != len)) {
2035 /* report receive errors */
2036 DBG("rx error\n");
2037 netdev_rx_err(dev, iob, -EIO);
2038 } else {
2039 DBG2("received packet, len %d\n", len);
2040 iob_put(iob, len);
2041 netdev_rx(dev, iob);
2042 }
2043
2044 /* io_buffer passed to core, make sure we don't reuse it */
2045 e->iob = NULL;
2046
2047 e = e->next;
2048 }
2049 skge_rx_refill(dev);
2050}
#define rmb()
Definition io.h:545
#define iob_put(iobuf, len)
Definition iobuf.h:125
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition netdevice.c:549
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition netdevice.c:587
static u16 phy_length(const struct skge_hw *hw, u32 status)
Definition skge.c:1923
static int bad_phy_status(const struct skge_hw *hw, u32 status)
Definition skge.c:1931
@ BMU_BBC
Definition skge.h:393
u32 status
Definition skge.h:2427

References bad_phy_status(), BMU_BBC, BMU_OWN, control, skge_rx_desc::control, DBG, DBG2, skge_element::desc, EIO, skge_port::hw, skge_element::iob, iob_put, len, netdev_rx(), netdev_rx_err(), skge_element::next, NULL, NUM_RX_DESC, phy_length(), net_device::priv, rmb, skge_port::rx_ring, skge_rx_refill(), skge_rx_desc::status, skge_ring::to_clean, u16, and u32.

Referenced by skge_poll().

◆ skge_board_name()

const char * skge_board_name ( const struct skge_hw * hw)
static

Definition at line 2112 of file skge.c.

2113{
2114 unsigned int i;
2115 static char buf[16];
2116
2117 for (i = 0; i < ARRAY_SIZE(skge_chips); i++)
2118 if (skge_chips[i].id == hw->chip_id)
2119 return skge_chips[i].name;
2120
2121 snprintf(buf, sizeof buf, "chipid 0x%x", hw->chip_id);
2122 return buf;
2123}
static const struct @174162317324121026331032275065303104204317055357 skge_chips[]
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition vsprintf.c:383

References ARRAY_SIZE, skge_chips, and snprintf().

Referenced by skge_probe().

◆ skge_reset()

int skge_reset ( struct skge_hw * hw)
static

Definition at line 2130 of file skge.c.

2131{
2132 u32 reg;
2133 u16 ctst, pci_status;
2134 u8 t8, mac_cfg, pmd_type;
2135 int i;
2136
2137 ctst = skge_read16(hw, B0_CTST);
2138
2139 /* do a SW reset */
2142
2143 /* clear PCI errors, if any */
2146
2147 pci_read_config_word(hw->pdev, PCI_STATUS, &pci_status);
2149 pci_status | PCI_STATUS_ERROR_BITS);
2152
2153 /* restore CLK_RUN bits (for Yukon-Lite) */
2156
2157 hw->chip_id = skge_read8(hw, B2_CHIP_ID);
2158 hw->phy_type = skge_read8(hw, B2_E_1) & 0xf;
2159 pmd_type = skge_read8(hw, B2_PMD_TYP);
2160 hw->copper = (pmd_type == 'T' || pmd_type == '1');
2161
2162 switch (hw->chip_id) {
2163 case CHIP_ID_GENESIS:
2164 switch (hw->phy_type) {
2165 case SK_PHY_XMAC:
2166 hw->phy_addr = PHY_ADDR_XMAC;
2167 break;
2168 case SK_PHY_BCOM:
2169 hw->phy_addr = PHY_ADDR_BCOM;
2170 break;
2171 default:
2172 DBG(PFX "unsupported phy type 0x%x\n",
2173 hw->phy_type);
2174 return -EOPNOTSUPP;
2175 }
2176 break;
2177
2178 case CHIP_ID_YUKON:
2179 case CHIP_ID_YUKON_LITE:
2180 case CHIP_ID_YUKON_LP:
2181 if (hw->phy_type < SK_PHY_MARV_COPPER && pmd_type != 'S')
2182 hw->copper = 1;
2183
2184 hw->phy_addr = PHY_ADDR_MARV;
2185 break;
2186
2187 default:
2188 DBG(PFX "unsupported chip type 0x%x\n",
2189 hw->chip_id);
2190 return -EOPNOTSUPP;
2191 }
2192
2193 mac_cfg = skge_read8(hw, B2_MAC_CFG);
2194 hw->ports = (mac_cfg & CFG_SNG_MAC) ? 1 : 2;
2195 hw->chip_rev = (mac_cfg & CFG_CHIP_R_MSK) >> 4;
2196
2197 /* read the adapters RAM size */
2198 t8 = skge_read8(hw, B2_E_0);
2199 if (hw->chip_id == CHIP_ID_GENESIS) {
2200 if (t8 == 3) {
2201 /* special case: 4 x 64k x 36, offset = 0x80000 */
2202 hw->ram_size = 0x100000;
2203 hw->ram_offset = 0x80000;
2204 } else
2205 hw->ram_size = t8 * 512;
2206 }
2207 else if (t8 == 0)
2208 hw->ram_size = 0x20000;
2209 else
2210 hw->ram_size = t8 * 4096;
2211
2212 hw->intr_mask = IS_HW_ERR;
2213
2214 /* Use PHY IRQ for all but fiber based Genesis board */
2215 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC))
2216 hw->intr_mask |= IS_EXT_REG;
2217
2218 if (hw->chip_id == CHIP_ID_GENESIS)
2220 else {
2221 /* switch power to VCC (WA for VAUX problem) */
2224
2225 /* avoid boards with stuck Hardware error bits */
2226 if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) &&
2228 DBG(PFX "stuck hardware sensor bit\n");
2229 hw->intr_mask &= ~IS_HW_ERR;
2230 }
2231
2232 /* Clear PHY COMA */
2235 reg &= ~PCI_PHY_COMA;
2238
2239
2240 for (i = 0; i < hw->ports; i++) {
2243 }
2244 }
2245
2246 /* turn off hardware timer (unused) */
2250
2251 /* enable the Tx Arbiters */
2252 for (i = 0; i < hw->ports; i++)
2254
2255 /* Initialize ram interface */
2257
2270
2272
2273 /* Set interrupt moderation for Transmit only
2274 * Receive interrupts avoided by NAPI
2275 */
2279
2280 skge_write32(hw, B0_IMSK, hw->intr_mask);
2281
2282 for (i = 0; i < hw->ports; i++) {
2283 if (hw->chip_id == CHIP_ID_GENESIS)
2284 genesis_reset(hw, i);
2285 else
2286 yukon_reset(hw, i);
2287 }
2288
2289 return 0;
2290}
#define EOPNOTSUPP
Operation not supported on socket.
Definition errno.h:605
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
#define PCI_STATUS
PCI status.
Definition pci.h:36
static void genesis_init(struct skge_hw *hw)
Definition skge.c:481
static u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec)
Definition skge.c:128
#define PCI_DEV_REG1
Definition skge.h:10
@ TXA_ENA_ARB
Definition skge.h:483
@ CFG_CHIP_R_MSK
Definition skge.h:310
@ CFG_SNG_MAC
Definition skge.h:313
@ SK_PHY_MARV_COPPER
Definition skge.h:577
@ PHY_ADDR_XMAC
Definition skge.h:583
@ PHY_ADDR_BCOM
Definition skge.h:584
@ PHY_ADDR_MARV
Definition skge.h:587
@ IS_ERR_MSK
Definition skge.h:290
@ IS_IRQ_SENSOR
Definition skge.h:276
@ B3_RI_WTO_XA1
Definition skge.h:143
@ B2_E_1
Definition skge.h:109
@ B3_RI_RTO_XA2
Definition skge.h:152
@ B3_RI_WTO_XS1
Definition skge.h:144
@ B3_RI_WTO_R2
Definition skge.h:148
@ B3_RI_RTO_XA1
Definition skge.h:146
@ B0_LED
Definition skge.h:79
@ B3_RI_RTO_R1
Definition skge.h:145
@ B2_IRQM_INI
Definition skge.h:120
@ B3_RI_RTO_XS1
Definition skge.h:147
@ B3_RI_CTRL
Definition skge.h:155
@ B2_TST_CTRL1
Definition skge.h:126
@ B2_MAC_CFG
Definition skge.h:106
@ B0_ISRC
Definition skge.h:81
@ B3_RI_WTO_R1
Definition skge.h:142
@ B3_RI_RTO_XS2
Definition skge.h:153
@ B3_RI_RTO_R2
Definition skge.h:151
@ B2_IRQM_MSK
Definition skge.h:124
@ B3_RI_WTO_XS2
Definition skge.h:150
@ B2_CHIP_ID
Definition skge.h:107
@ B2_E_0
Definition skge.h:108
@ B0_POWER_CTRL
Definition skge.h:80
@ B3_RI_WTO_XA2
Definition skge.h:149
@ B2_TST_CTRL2
Definition skge.h:127
@ B2_IRQM_CTRL
Definition skge.h:122
@ B2_PMD_TYP
Definition skge.h:105
@ B0_HWE_IMSK
Definition skge.h:84
@ B0_HWE_ISRC
Definition skge.h:83
@ B2_TI_CTRL
Definition skge.h:118
@ GMLC_RST_SET
Definition skge.h:2026
@ GMLC_RST_CLR
Definition skge.h:2025
#define PCI_STATUS_ERROR_BITS
Definition skge.h:70
@ RI_RST_CLR
Definition skge.h:424
@ CHIP_ID_YUKON_LP
Definition skge.h:321
#define SK_RI_TO_53
Definition skge.h:442
@ GMAC_LINK_CTRL
Definition skge.h:912
@ CS_MRST_CLR
Definition skge.h:201
@ LED_STAT_ON
Definition skge.h:208
@ PC_VCC_ENA
Definition skge.h:214
@ CS_RST_SET
Definition skge.h:204
@ CS_RST_CLR
Definition skge.h:203
@ PC_VAUX_OFF
Definition skge.h:217
@ PC_VAUX_ENA
Definition skge.h:212
@ PC_VCC_ON
Definition skge.h:218
@ CS_CLK_RUN_RST
Definition skge.h:192
@ CS_CLK_RUN_ENA
Definition skge.h:193
@ CS_CLK_RUN_HOT
Definition skge.h:191
@ TIM_CLR_IRQ
Definition skge.h:335
@ TIM_START
Definition skge.h:333
@ TIM_STOP
Definition skge.h:334
@ TST_CFG_WRITE_ON
Definition skge.h:304
@ TST_CFG_WRITE_OFF
Definition skge.h:305
@ IS_XA2_F
Definition skge.h:262
@ IS_HW_ERR
Definition skge.h:225
@ IS_XA1_F
Definition skge.h:254
#define PCI_PHY_COMA
Definition skge.h:11

References B0_CTST, B0_HWE_IMSK, B0_HWE_ISRC, B0_IMSK, B0_ISRC, B0_LED, B0_POWER_CTRL, B2_CHIP_ID, B2_E_0, B2_E_1, B2_IRQM_CTRL, B2_IRQM_INI, B2_IRQM_MSK, B2_MAC_CFG, B2_PMD_TYP, B2_TI_CTRL, B2_TST_CTRL1, B2_TST_CTRL2, B3_RI_CTRL, B3_RI_RTO_R1, B3_RI_RTO_R2, B3_RI_RTO_XA1, B3_RI_RTO_XA2, B3_RI_RTO_XS1, B3_RI_RTO_XS2, B3_RI_WTO_R1, B3_RI_WTO_R2, B3_RI_WTO_XA1, B3_RI_WTO_XA2, B3_RI_WTO_XS1, B3_RI_WTO_XS2, CFG_CHIP_R_MSK, CFG_SNG_MAC, CHIP_ID_GENESIS, CHIP_ID_YUKON, CHIP_ID_YUKON_LITE, CHIP_ID_YUKON_LP, CS_CLK_RUN_ENA, CS_CLK_RUN_HOT, CS_CLK_RUN_RST, CS_MRST_CLR, CS_RST_CLR, CS_RST_SET, DBG, EOPNOTSUPP, genesis_init(), genesis_reset(), GMAC_LINK_CTRL, GMLC_RST_CLR, GMLC_RST_SET, IS_ERR_MSK, IS_EXT_REG, IS_HW_ERR, IS_IRQ_SENSOR, IS_XA1_F, IS_XA2_F, LED_STAT_ON, PC_VAUX_ENA, PC_VAUX_OFF, PC_VCC_ENA, PC_VCC_ON, PCI_DEV_REG1, PCI_PHY_COMA, pci_read_config_dword(), pci_read_config_word(), PCI_STATUS, PCI_STATUS_ERROR_BITS, pci_write_config_dword(), pci_write_config_word(), PFX, PHY_ADDR_BCOM, PHY_ADDR_MARV, PHY_ADDR_XMAC, reg, RI_RST_CLR, SK_PHY_BCOM, SK_PHY_MARV_COPPER, SK_PHY_XMAC, SK_REG, SK_RI_TO_53, skge_read16(), skge_read32(), skge_read8(), skge_usecs2clk(), skge_write16(), skge_write32(), skge_write8(), TIM_CLR_IRQ, TIM_START, TIM_STOP, TST_CFG_WRITE_OFF, TST_CFG_WRITE_ON, TXA_CTRL, TXA_ENA_ARB, u16, u32, u8, and yukon_reset().

Referenced by skge_probe().

◆ skge_devinit()

struct net_device * skge_devinit ( struct skge_hw * hw,
int port,
int highmem __unused )
static

Definition at line 2293 of file skge.c.

2295{
2296 struct skge_port *skge;
2297 struct net_device *dev = alloc_etherdev(sizeof(*skge));
2298
2299 if (!dev) {
2300 DBG(PFX "etherdev alloc failed\n");
2301 return NULL;
2302 }
2303
2304 dev->dev = &hw->pdev->dev;
2305
2306 skge = dev->priv;
2307 skge->netdev = dev;
2308 skge->hw = hw;
2309
2310 /* Auto speed and flow control */
2311 skge->autoneg = AUTONEG_ENABLE;
2313 skge->duplex = -1;
2314 skge->speed = -1;
2316
2317 hw->dev[port] = dev;
2318
2319 skge->port = port;
2320
2321 /* read the mac address */
2322 memcpy(dev->hw_addr, (void *) (hw->regs + B2_MAC_1 + port*8), ETH_ALEN);
2323
2324 return dev;
2325}
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition ethernet.c:265
#define ETH_ALEN
Definition if_ether.h:9
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static u32 skge_supported_modes(const struct skge_hw *hw)
Definition skge.c:93
@ B2_MAC_1
Definition skge.h:101

References __unused, skge_port::advertising, alloc_etherdev(), skge_port::autoneg, AUTONEG_ENABLE, B2_MAC_1, DBG, net_device::dev, skge_port::duplex, ETH_ALEN, skge_port::flow_control, FLOW_MODE_SYM_OR_REM, skge_port::hw, memcpy(), skge_port::netdev, NULL, PFX, port, skge_port::port, skge_supported_modes(), and skge_port::speed.

Referenced by skge_probe().

◆ skge_show_addr()

void skge_show_addr ( struct net_device * dev)
static

Definition at line 2327 of file skge.c.

2328{
2329 DBG2(PFX "%s: addr %s\n",
2330 dev->name, netdev_addr(dev));
2331}
static const char * netdev_addr(struct net_device *netdev)
Get printable network device link-layer address.
Definition netdevice.h:542

References DBG2, net_device::dev, device::name, netdev_addr(), and PFX.

Referenced by skge_probe().

◆ skge_probe()

int skge_probe ( struct pci_device * pdev)
static

Definition at line 2333 of file skge.c.

2334{
2335 struct net_device *dev, *dev1;
2336 struct skge_hw *hw;
2337 int err, using_dac = 0;
2338
2340
2341 err = -ENOMEM;
2342 hw = zalloc(sizeof(*hw));
2343 if (!hw) {
2344 DBG(PFX "cannot allocate hardware struct\n");
2345 goto err_out_free_regions;
2346 }
2347
2348 hw->pdev = pdev;
2349
2350 hw->regs = (unsigned long)pci_ioremap(pdev,
2353 if (!hw->regs) {
2354 DBG(PFX "cannot map device registers\n");
2355 goto err_out_free_hw;
2356 }
2357
2358 err = skge_reset(hw);
2359 if (err)
2360 goto err_out_iounmap;
2361
2362 DBG(PFX " addr 0x%llx irq %d chip %s rev %d\n",
2363 (unsigned long long)pdev->ioaddr, pdev->irq,
2364 skge_board_name(hw), hw->chip_rev);
2365
2366 dev = skge_devinit(hw, 0, using_dac);
2367 if (!dev)
2368 goto err_out_led_off;
2369
2371
2372 err = register_netdev(dev);
2373 if (err) {
2374 DBG(PFX "cannot register net device\n");
2375 goto err_out_free_netdev;
2376 }
2377
2379
2380 if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) {
2381 if (register_netdev(dev1) == 0)
2382 skge_show_addr(dev1);
2383 else {
2384 /* Failure to register second port need not be fatal */
2385 DBG(PFX "register of second port failed\n");
2386 hw->dev[1] = NULL;
2387 netdev_nullify(dev1);
2388 netdev_put(dev1);
2389 }
2390 }
2392
2393 return 0;
2394
2395err_out_free_netdev:
2397 netdev_put(dev);
2398err_out_led_off:
2400err_out_iounmap:
2401 iounmap((void*)hw->regs);
2402err_out_free_hw:
2403 free(hw);
2404err_out_free_regions:
2406 return err;
2407}
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
int register_netdev(struct net_device *netdev)
Register network device.
Definition netdevice.c:760
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition netdevice.h:519
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition netdevice.h:532
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition netdevice.h:576
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition pci.c:97
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:366
#define PCI_BASE_ADDRESS_0
Definition pci.h:63
static const char * skge_board_name(const struct skge_hw *hw)
Definition skge.c:2112
static void skge_show_addr(struct net_device *dev)
Definition skge.c:2327
static int skge_reset(struct skge_hw *hw)
Definition skge.c:2130
static struct net_device * skge_devinit(struct skge_hw *hw, int port, int highmem __unused)
Definition skge.c:2293
static struct net_device_operations skge_operations
Definition skge.c:77
#define SKGE_REG_SIZE
Definition skge.h:34
@ LED_STAT_OFF
Definition skge.h:209
unsigned long ioaddr
I/O address.
Definition pci.h:226
uint8_t irq
Interrupt number.
Definition pci.h:234
struct pci_device * pdev
Definition skge.h:2462

References adjust_pci_device(), B0_LED, DBG, net_device::dev, skge_hw::dev, ENOMEM, free, pci_device::ioaddr, iounmap(), pci_device::irq, LED_STAT_OFF, netdev_init(), netdev_nullify(), netdev_put(), NULL, pci_bar_start(), PCI_BASE_ADDRESS_0, pci_ioremap(), pci_set_drvdata(), skge_hw::pdev, PFX, register_netdev(), skge_board_name(), skge_devinit(), skge_operations, SKGE_REG_SIZE, skge_reset(), skge_show_addr(), skge_write16(), and zalloc().

◆ skge_remove()

void skge_remove ( struct pci_device * pdev)
static

Definition at line 2409 of file skge.c.

2410{
2411 struct skge_hw *hw = pci_get_drvdata(pdev);
2412 struct net_device *dev0, *dev1;
2413
2414 if (!hw)
2415 return;
2416
2417 if ((dev1 = hw->dev[1]))
2418 unregister_netdev(dev1);
2419 dev0 = hw->dev[0];
2420 unregister_netdev(dev0);
2421
2422 hw->intr_mask = 0;
2423 skge_write32(hw, B0_IMSK, 0);
2425
2428
2429 if (dev1) {
2430 netdev_nullify(dev1);
2431 netdev_put(dev1);
2432 }
2433 netdev_nullify(dev0);
2434 netdev_put(dev0);
2435
2436 iounmap((void*)hw->regs);
2437 free(hw);
2438 pci_set_drvdata(pdev, NULL);
2439}
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition netdevice.c:942
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:376

References B0_CTST, B0_IMSK, B0_LED, CS_RST_SET, free, iounmap(), LED_STAT_OFF, netdev_nullify(), netdev_put(), NULL, pci_get_drvdata(), pci_set_drvdata(), skge_hw::pdev, skge_read32(), skge_write16(), skge_write32(), skge_write8(), and unregister_netdev().

Variable Documentation

◆ skge_id_table

struct pci_device_id skge_id_table[]
static
Initial value:
= {
PCI_ROM(0x10b7, 0x1700, "3C940", "3COM 3C940", 0),
PCI_ROM(0x10b7, 0x80eb, "3C940B", "3COM 3C940", 0),
PCI_ROM(0x1148, 0x4300, "GE", "Syskonnect GE", 0),
PCI_ROM(0x1148, 0x4320, "YU", "Syskonnect YU", 0),
PCI_ROM(0x1186, 0x4C00, "DGE510T", "DLink DGE-510T", 0),
PCI_ROM(0x1186, 0x4b01, "DGE530T", "DLink DGE-530T", 0),
PCI_ROM(0x11ab, 0x4320, "id4320", "Marvell id4320", 0),
PCI_ROM(0x11ab, 0x5005, "id5005", "Marvell id5005", 0),
PCI_ROM(0x1371, 0x434e, "Gigacard", "CNET Gigacard", 0),
PCI_ROM(0x1737, 0x1064, "EG1064", "Linksys EG1064", 0),
}
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308

Definition at line 47 of file skge.c.

47 {
48 PCI_ROM(0x10b7, 0x1700, "3C940", "3COM 3C940", 0),
49 PCI_ROM(0x10b7, 0x80eb, "3C940B", "3COM 3C940", 0),
50 PCI_ROM(0x1148, 0x4300, "GE", "Syskonnect GE", 0),
51 PCI_ROM(0x1148, 0x4320, "YU", "Syskonnect YU", 0),
52 PCI_ROM(0x1186, 0x4C00, "DGE510T", "DLink DGE-510T", 0),
53 PCI_ROM(0x1186, 0x4b01, "DGE530T", "DLink DGE-530T", 0),
54 PCI_ROM(0x11ab, 0x4320, "id4320", "Marvell id4320", 0),
55 PCI_ROM(0x11ab, 0x5005, "id5005", "Marvell id5005", 0), /* Belkin */
56 PCI_ROM(0x1371, 0x434e, "Gigacard", "CNET Gigacard", 0),
57 PCI_ROM(0x1737, 0x1064, "EG1064", "Linksys EG1064", 0),
58 PCI_ROM(0x1737, 0xffff, "id_any", "Linksys [any]", 0)
59};

◆ skge_operations

struct net_device_operations skge_operations
static
Initial value:
= {
.open = skge_up,
.close = skge_down,
.transmit = skge_xmit_frame,
.poll = skge_poll,
.irq = skge_net_irq
}
static void skge_poll(struct net_device *dev)
Definition skge.c:2052
static void skge_down(struct net_device *dev)
Definition skge.c:1791
static void skge_net_irq(struct net_device *dev, int enable)
Definition skge.c:2449
static int skge_xmit_frame(struct net_device *dev, struct io_buffer *iob)
Definition skge.c:1864
static int skge_up(struct net_device *dev)
Definition skge.c:1708

Definition at line 77 of file skge.c.

77 {
78 .open = skge_up,
79 .close = skge_down,
80 .transmit = skge_xmit_frame,
81 .poll = skge_poll,
82 .irq = skge_net_irq
83};

Referenced by skge_probe().

◆ txqaddr

const int txqaddr[] = { Q_XA1, Q_XA2 }
static

◆ rxqaddr

const int rxqaddr[] = { Q_R1, Q_R2 }
static

◆ portmask

const u32 portmask[] = { IS_PORT_1, IS_PORT_2 }
static

Definition at line 88 of file skge.c.

@ IS_PORT_1
Definition skge.h:268
@ IS_PORT_2
Definition skge.h:269

Referenced by skge_down(), skge_net_irq(), and skge_up().

◆ phy_pause_map

const u16 phy_pause_map[]
static

◆ fiber_pause_map

const u16 fiber_pause_map[]
static

◆ id

u8 id

Definition at line 2103 of file skge.c.

◆ name

const char* name

Definition at line 2104 of file skge.c.

◆ [struct]

const struct { ... } skge_chips[]
Initial value:
= {
{ CHIP_ID_GENESIS, "Genesis" },
{ CHIP_ID_YUKON, "Yukon" },
{ CHIP_ID_YUKON_LITE, "Yukon-Lite"},
{ CHIP_ID_YUKON_LP, "Yukon-LP"},
}

Referenced by skge_board_name().

◆ __pci_driver

struct pci_driver skge_driver __pci_driver
Initial value:
= {
.ids = skge_id_table,
.id_count = ( sizeof (skge_id_table) / sizeof (skge_id_table[0]) ),
.probe = skge_probe,
}
static void skge_remove(struct pci_device *pdev)
Definition skge.c:2409
static struct pci_device_id skge_id_table[]
Definition skge.c:47
static int skge_probe(struct pci_device *pdev)
Definition skge.c:2333
static struct xen_remove_from_physmap * remove
Definition xenmem.h:39

Definition at line 2460 of file skge.c.

2460 {
2461 .ids = skge_id_table,
2462 .id_count = ( sizeof (skge_id_table) / sizeof (skge_id_table[0]) ),
2463 .probe = skge_probe,
2465};