aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.h')
-rw-r--r--drivers/net/sky2.h112
1 files changed, 54 insertions, 58 deletions
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index d2a0ac2c53e7..9256303acf76 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -209,13 +209,9 @@ enum csr_regs {
209 Y2_CFG_SPC = 0x1c00, 209 Y2_CFG_SPC = 0x1c00,
210}; 210};
211 211
212/* Access pci config through board I/O */
213#define PCI_C(x) (Y2_CFG_SPC + (x))
214
215
216/* B0_CTST 16 bit Control/Status register */ 212/* B0_CTST 16 bit Control/Status register */
217enum { 213enum {
218 Y2_VMAIN_AVAIL = 1<<17, /* VMAIN available (YUKON-2 only) */ 214 Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */
219 Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */ 215 Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */
220 Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */ 216 Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */
221 Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */ 217 Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */
@@ -234,13 +230,17 @@ enum {
234 CS_MRST_SET = 1<<2, /* Set Master reset */ 230 CS_MRST_SET = 1<<2, /* Set Master reset */
235 CS_RST_CLR = 1<<1, /* Clear Software reset */ 231 CS_RST_CLR = 1<<1, /* Clear Software reset */
236 CS_RST_SET = 1, /* Set Software reset */ 232 CS_RST_SET = 1, /* Set Software reset */
233};
237 234
238/* B0_LED 8 Bit LED register */ 235/* B0_LED 8 Bit LED register */
236enum {
239/* Bit 7.. 2: reserved */ 237/* Bit 7.. 2: reserved */
240 LED_STAT_ON = 1<<1, /* Status LED on */ 238 LED_STAT_ON = 1<<1, /* Status LED on */
241 LED_STAT_OFF = 1, /* Status LED off */ 239 LED_STAT_OFF = 1, /* Status LED off */
240};
242 241
243/* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */ 242/* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */
243enum {
244 PC_VAUX_ENA = 1<<7, /* Switch VAUX Enable */ 244 PC_VAUX_ENA = 1<<7, /* Switch VAUX Enable */
245 PC_VAUX_DIS = 1<<6, /* Switch VAUX Disable */ 245 PC_VAUX_DIS = 1<<6, /* Switch VAUX Disable */
246 PC_VCC_ENA = 1<<5, /* Switch VCC Enable */ 246 PC_VCC_ENA = 1<<5, /* Switch VCC Enable */
@@ -336,7 +336,7 @@ enum {
336 Y2_HWE_L2_MASK = Y2_IS_PAR_RD2 | Y2_IS_PAR_WR2 | Y2_IS_PAR_MAC2 | 336 Y2_HWE_L2_MASK = Y2_IS_PAR_RD2 | Y2_IS_PAR_WR2 | Y2_IS_PAR_MAC2 |
337 Y2_IS_PAR_RX2 | Y2_IS_TCP_TXS2| Y2_IS_TCP_TXA2, 337 Y2_IS_PAR_RX2 | Y2_IS_TCP_TXS2| Y2_IS_TCP_TXA2,
338 338
339 Y2_HWE_ALL_MASK = Y2_IS_SENSOR | Y2_IS_MST_ERR | Y2_IS_IRQ_STAT | 339 Y2_HWE_ALL_MASK = Y2_IS_TIST_OV | Y2_IS_MST_ERR | Y2_IS_IRQ_STAT |
340 Y2_IS_PCI_EXP | Y2_IS_PCI_NEXP | 340 Y2_IS_PCI_EXP | Y2_IS_PCI_NEXP |
341 Y2_HWE_L1_MASK | Y2_HWE_L2_MASK, 341 Y2_HWE_L1_MASK | Y2_HWE_L2_MASK,
342}; 342};
@@ -793,11 +793,6 @@ enum {
793 STAT_ISR_TIMER_CNT = 0x0ed4,/* 32 bit ISR Timer Counter Reg */ 793 STAT_ISR_TIMER_CNT = 0x0ed4,/* 32 bit ISR Timer Counter Reg */
794 STAT_ISR_TIMER_CTRL= 0x0ed8,/* 8 bit ISR Timer Control Reg */ 794 STAT_ISR_TIMER_CTRL= 0x0ed8,/* 8 bit ISR Timer Control Reg */
795 STAT_ISR_TIMER_TEST= 0x0ed9,/* 8 bit ISR Timer Test Reg */ 795 STAT_ISR_TIMER_TEST= 0x0ed9,/* 8 bit ISR Timer Test Reg */
796
797 ST_LAST_IDX_MASK = 0x007f,/* Last Index Mask */
798 ST_TXRP_IDX_MASK = 0x0fff,/* Tx Report Index Mask */
799 ST_TXTH_IDX_MASK = 0x0fff,/* Tx Threshold Index Mask */
800 ST_WM_IDX_MASK = 0x3f,/* FIFO Watermark Index Mask */
801}; 796};
802 797
803enum { 798enum {
@@ -836,6 +831,7 @@ enum {
836 831
837/* WOL Pattern Counter Registers (YUKON only) */ 832/* WOL Pattern Counter Registers (YUKON only) */
838 833
834
839 WOL_PATT_CNT_0 = 0x0f38,/* 32 bit WOL Pattern Counter 3..0 */ 835 WOL_PATT_CNT_0 = 0x0f38,/* 32 bit WOL Pattern Counter 3..0 */
840 WOL_PATT_CNT_4 = 0x0f3c,/* 24 bit WOL Pattern Counter 6..4 */ 836 WOL_PATT_CNT_4 = 0x0f3c,/* 24 bit WOL Pattern Counter 6..4 */
841}; 837};
@@ -1536,34 +1532,34 @@ enum {
1536/* Receive Frame Status Encoding */ 1532/* Receive Frame Status Encoding */
1537enum { 1533enum {
1538 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ 1534 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */
1539 GMR_FS_VLAN = 1<<13, /* Bit 13: VLAN Packet */ 1535 GMR_FS_VLAN = 1<<13, /* VLAN Packet */
1540 GMR_FS_JABBER = 1<<12, /* Bit 12: Jabber Packet */ 1536 GMR_FS_JABBER = 1<<12, /* Jabber Packet */
1541 GMR_FS_UN_SIZE = 1<<11, /* Bit 11: Undersize Packet */ 1537 GMR_FS_UN_SIZE = 1<<11, /* Undersize Packet */
1542 GMR_FS_MC = 1<<10, /* Bit 10: Multicast Packet */ 1538 GMR_FS_MC = 1<<10, /* Multicast Packet */
1543 GMR_FS_BC = 1<<9, /* Bit 9: Broadcast Packet */ 1539 GMR_FS_BC = 1<<9, /* Broadcast Packet */
1544 GMR_FS_RX_OK = 1<<8, /* Bit 8: Receive OK (Good Packet) */ 1540 GMR_FS_RX_OK = 1<<8, /* Receive OK (Good Packet) */
1545 GMR_FS_GOOD_FC = 1<<7, /* Bit 7: Good Flow-Control Packet */ 1541 GMR_FS_GOOD_FC = 1<<7, /* Good Flow-Control Packet */
1546 GMR_FS_BAD_FC = 1<<6, /* Bit 6: Bad Flow-Control Packet */ 1542 GMR_FS_BAD_FC = 1<<6, /* Bad Flow-Control Packet */
1547 GMR_FS_MII_ERR = 1<<5, /* Bit 5: MII Error */ 1543 GMR_FS_MII_ERR = 1<<5, /* MII Error */
1548 GMR_FS_LONG_ERR = 1<<4, /* Bit 4: Too Long Packet */ 1544 GMR_FS_LONG_ERR = 1<<4, /* Too Long Packet */
1549 GMR_FS_FRAGMENT = 1<<3, /* Bit 3: Fragment */ 1545 GMR_FS_FRAGMENT = 1<<3, /* Fragment */
1550 1546
1551 GMR_FS_CRC_ERR = 1<<1, /* Bit 1: CRC Error */ 1547 GMR_FS_CRC_ERR = 1<<1, /* CRC Error */
1552 GMR_FS_RX_FF_OV = 1<<0, /* Bit 0: Rx FIFO Overflow */ 1548 GMR_FS_RX_FF_OV = 1<<0, /* Rx FIFO Overflow */
1553 1549
1554/*
1555 * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR)
1556 */
1557 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR | 1550 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR |
1558 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR | 1551 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR |
1559 GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC | 1552 GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC |
1560 GMR_FS_UN_SIZE | GMR_FS_JABBER, 1553 GMR_FS_UN_SIZE | GMR_FS_JABBER,
1561/* Rx GMAC FIFO Flush Mask (default) */
1562 RX_FF_FL_DEF_MSK = GMR_FS_ANY_ERR,
1563}; 1554};
1564 1555
1565/* RX_GMF_CTRL_T 32 bit Rx GMAC FIFO Control/Test */ 1556/* RX_GMF_CTRL_T 32 bit Rx GMAC FIFO Control/Test */
1566enum { 1557enum {
1558 RX_TRUNC_ON = 1<<27, /* enable packet truncation */
1559 RX_TRUNC_OFF = 1<<26, /* disable packet truncation */
1560 RX_VLAN_STRIP_ON = 1<<25, /* enable VLAN stripping */
1561 RX_VLAN_STRIP_OFF = 1<<24, /* disable VLAN stripping */
1562
1567 GMF_WP_TST_ON = 1<<14, /* Write Pointer Test On */ 1563 GMF_WP_TST_ON = 1<<14, /* Write Pointer Test On */
1568 GMF_WP_TST_OFF = 1<<13, /* Write Pointer Test Off */ 1564 GMF_WP_TST_OFF = 1<<13, /* Write Pointer Test Off */
1569 GMF_WP_STEP = 1<<12, /* Write Pointer Step/Increment */ 1565 GMF_WP_STEP = 1<<12, /* Write Pointer Step/Increment */
@@ -1574,7 +1570,8 @@ enum {
1574 GMF_RX_F_FL_ON = 1<<7, /* Rx FIFO Flush Mode On */ 1570 GMF_RX_F_FL_ON = 1<<7, /* Rx FIFO Flush Mode On */
1575 GMF_RX_F_FL_OFF = 1<<6, /* Rx FIFO Flush Mode Off */ 1571 GMF_RX_F_FL_OFF = 1<<6, /* Rx FIFO Flush Mode Off */
1576 GMF_CLI_RX_FO = 1<<5, /* Clear IRQ Rx FIFO Overrun */ 1572 GMF_CLI_RX_FO = 1<<5, /* Clear IRQ Rx FIFO Overrun */
1577 GMF_CLI_RX_FC = 1<<4, /* Clear IRQ Rx Frame Complete */ 1573 GMF_CLI_RX_C = 1<<4, /* Clear IRQ Rx Frame Complete */
1574
1578 GMF_OPER_ON = 1<<3, /* Operational Mode On */ 1575 GMF_OPER_ON = 1<<3, /* Operational Mode On */
1579 GMF_OPER_OFF = 1<<2, /* Operational Mode Off */ 1576 GMF_OPER_OFF = 1<<2, /* Operational Mode Off */
1580 GMF_RST_CLR = 1<<1, /* Clear GMAC FIFO Reset */ 1577 GMF_RST_CLR = 1<<1, /* Clear GMAC FIFO Reset */
@@ -1586,6 +1583,9 @@ enum {
1586 1583
1587/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */ 1584/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */
1588enum { 1585enum {
1586 TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */
1587 TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */
1588
1589 GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ 1589 GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */
1590 GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ 1590 GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */
1591 GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ 1591 GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */
@@ -1679,8 +1679,7 @@ enum {
1679 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ 1679 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */
1680 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ 1680 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */
1681 1681
1682#define GMAC_DEF_MSK (GM_IS_TX_CO_OV | GM_IS_RX_CO_OV |\ 1682#define GMAC_DEF_MSK (GM_IS_TX_FF_UR|GM_IS_RX_FF_OR)
1683 GM_IS_TX_FF_UR | GM_IS_RX_FF_OR)
1684 1683
1685/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ 1684/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
1686 /* Bits 15.. 2: reserved */ 1685 /* Bits 15.. 2: reserved */
@@ -1761,9 +1760,6 @@ enum {
1761 OP_RXTIMEVLAN = OP_RXTIMESTAMP | OP_RXVLAN, 1760 OP_RXTIMEVLAN = OP_RXTIMESTAMP | OP_RXVLAN,
1762 OP_RSS_HASH = 0x65, 1761 OP_RSS_HASH = 0x65,
1763 OP_TXINDEXLE = 0x68, 1762 OP_TXINDEXLE = 0x68,
1764
1765/* YUKON-2 SPECIAL opcodes defines */
1766 OP_PUTIDX = 0x70,
1767}; 1763};
1768 1764
1769/* Yukon 2 hardware interface 1765/* Yukon 2 hardware interface
@@ -1775,62 +1771,60 @@ struct sky2_tx_le {
1775 struct { 1771 struct {
1776 u16 offset; 1772 u16 offset;
1777 u16 start; 1773 u16 start;
1778 } csum; 1774 } csum __attribute((packed));
1779 struct { 1775 struct {
1780 u16 size; 1776 u16 size;
1781 u16 rsvd; 1777 u16 rsvd;
1782 } tso; 1778 } tso __attribute((packed));
1783 } tx; 1779 } tx;
1784 u16 length; /* also vlan tag or checksum start */ 1780 u16 length; /* also vlan tag or checksum start */
1785 u8 ctrl; 1781 u8 ctrl;
1786 u8 opcode; 1782 u8 opcode;
1787}; 1783} __attribute((packed));
1788 1784
1789struct sky2_rx_le { 1785struct sky2_rx_le {
1790 union { 1786 u32 addr;
1791 u32 addr;
1792 struct {
1793 u16 start1;
1794 u16 start2;
1795 } csum;
1796 } rx;
1797 u16 length; 1787 u16 length;
1798 u8 ctrl; 1788 u8 ctrl;
1799 u8 opcode; 1789 u8 opcode;
1800}; 1790} __attribute((packed));;
1801 1791
1802struct sky2_status_le { 1792struct sky2_status_le {
1803 u32 status; /* also checksum */ 1793 u32 status; /* also checksum */
1804 u16 length; /* also vlan tag */ 1794 u16 length; /* also vlan tag */
1805 u8 link; 1795 u8 link;
1806 u8 opcode; 1796 u8 opcode;
1807}; 1797} __attribute((packed));
1808
1809 1798
1810struct ring_info { 1799struct ring_info {
1811 struct sk_buff *skb; 1800 struct sk_buff *skb;
1812 DECLARE_PCI_UNMAP_ADDR(mapaddr); 1801 dma_addr_t mapaddr;
1813 DECLARE_PCI_UNMAP_LEN(maplen); 1802 u16 maplen;
1803 u16 idx;
1814}; 1804};
1815 1805
1816struct sky2_port { 1806struct sky2_port {
1817 struct sky2_hw *hw ____cacheline_aligned; 1807 struct sky2_hw *hw;
1818 struct net_device *netdev; 1808 struct net_device *netdev;
1819 unsigned port; 1809 unsigned port;
1820 u32 msg_enable; 1810 u32 msg_enable;
1821 1811
1822 struct ring_info *tx_ring ____cacheline_aligned; 1812 struct ring_info *tx_ring;
1823 struct sky2_tx_le *tx_le; 1813 struct sky2_tx_le *tx_le;
1824 spinlock_t tx_lock; 1814 spinlock_t tx_lock;
1815 u32 tx_addr64;
1825 u16 tx_cons; /* next le to check */ 1816 u16 tx_cons; /* next le to check */
1826 u16 tx_prod; /* next le to use */ 1817 u16 tx_prod; /* next le to use */
1818 u16 tx_pending;
1827 u16 tx_last_put; 1819 u16 tx_last_put;
1820 u16 tx_last_mss;
1828 1821
1829 struct ring_info *rx_ring ____cacheline_aligned; 1822 struct ring_info *rx_ring;
1830 struct sky2_rx_le *rx_le; 1823 struct sky2_rx_le *rx_le;
1831 u16 rx_ring_size; 1824 u32 rx_addr64;
1832 u16 rx_next; /* next re to check */ 1825 u16 rx_next; /* next re to check */
1833 u16 rx_put; /* next le index to use */ 1826 u16 rx_put; /* next le index to use */
1827 u16 rx_pending;
1834 u16 rx_last_put; 1828 u16 rx_last_put;
1835 1829
1836 dma_addr_t rx_le_map; 1830 dma_addr_t rx_le_map;
@@ -1882,12 +1876,14 @@ static inline u8 sky2_read8(const struct sky2_hw *hw, unsigned reg)
1882 return readb(hw->regs + reg); 1876 return readb(hw->regs + reg);
1883} 1877}
1884 1878
1879/* This should probably go away, bus based tweeks suck */
1885static inline int is_pciex(const struct sky2_hw *hw) 1880static inline int is_pciex(const struct sky2_hw *hw)
1886{ 1881{
1887 return (sky2_read32(hw, PCI_C(PCI_DEV_STATUS)) & PCI_OS_PCI_X) == 0; 1882 u32 status;
1883 pci_read_config_dword(hw->pdev, PCI_DEV_STATUS, &status);
1884 return (status & PCI_OS_PCI_X) == 0;
1888} 1885}
1889 1886
1890
1891static inline void sky2_write32(const struct sky2_hw *hw, unsigned reg, u32 val) 1887static inline void sky2_write32(const struct sky2_hw *hw, unsigned reg, u32 val)
1892{ 1888{
1893 writel(val, hw->regs + reg); 1889 writel(val, hw->regs + reg);