sky2: flow control setting fixes
[powerpc.git] / drivers / net / sky2.h
index fa8af9f..3f05492 100644 (file)
@@ -4,6 +4,8 @@
 #ifndef _SKY2_H
 #define _SKY2_H
 
+#define ETH_JUMBO_MTU          9000    /* Maximum MTU supported */
+
 /* PCI config registers */
 enum {
        PCI_DEV_REG1    = 0x40,
@@ -1317,6 +1319,14 @@ enum {
        PHY_M_FESC_SEL_CL_A     = 1<<0, /* Select Class A driver (100B-TX) */
 };
 
+/* for Yukon-2 Gigabit Ethernet PHY (88E1112 only) */
+/*****  PHY_MARV_PHY_CTRL (page 1)             16 bit r/w      Fiber Specific Ctrl *****/
+enum {
+       PHY_M_FIB_FORCE_LNK     = 1<<10,/* Force Link Good */
+       PHY_M_FIB_SIGD_POL      = 1<<9, /* SIGDET Polarity */
+       PHY_M_FIB_TX_DIS        = 1<<3, /* Transmitter Disable */
+};
+
 /* for Yukon-2 Gigabit Ethernet PHY (88E1112 only) */
 /*****  PHY_MARV_PHY_CTRL (page 2)             16 bit r/w      MAC Specific Ctrl *****/
 enum {
@@ -1566,7 +1576,7 @@ enum {
 
        GMR_FS_ANY_ERR  = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR |
                          GMR_FS_FRAGMENT | GMR_FS_LONG_ERR |
-                         GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC |
+                         GMR_FS_MII_ERR | GMR_FS_BAD_FC |
                          GMR_FS_UN_SIZE | GMR_FS_JABBER,
 };
 
@@ -1783,21 +1793,9 @@ enum {
        OP_TXINDEXLE    = 0x68,
 };
 
-/* Yukon 2 hardware interface
- * Not tested on big endian
- */
+/* Yukon 2 hardware interface */
 struct sky2_tx_le {
-       union {
-               __le32  addr;
-               struct {
-                       __le16  offset;
-                       __le16  start;
-               } csum  __attribute((packed));
-               struct {
-                       __le16  size;
-                       __le16  rsvd;
-               } tso  __attribute((packed));
-       } tx;
+       __le32  addr;
        __le16  length; /* also vlan tag or checksum start */
        u8      ctrl;
        u8      opcode;
@@ -1820,12 +1818,21 @@ struct sky2_status_le {
 struct tx_ring_info {
        struct sk_buff  *skb;
        DECLARE_PCI_UNMAP_ADDR(mapaddr);
-       u16             idx;
+       DECLARE_PCI_UNMAP_ADDR(maplen);
 };
 
-struct ring_info {
+struct rx_ring_info {
        struct sk_buff  *skb;
-       dma_addr_t      mapaddr;
+       dma_addr_t      data_addr;
+       DECLARE_PCI_UNMAP_ADDR(data_size);
+       dma_addr_t      frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
+};
+
+enum flow_control {
+       FC_NONE = 0,
+       FC_TX   = 1,
+       FC_RX   = 2,
+       FC_BOTH = 3,
 };
 
 struct sky2_port {
@@ -1835,7 +1842,6 @@ struct sky2_port {
        u32                  msg_enable;
        spinlock_t           phy_lock;
 
-       spinlock_t           tx_lock  ____cacheline_aligned_in_smp;
        struct tx_ring_info  *tx_ring;
        struct sky2_tx_le    *tx_le;
        u16                  tx_cons;           /* next le to check */
@@ -1843,16 +1849,17 @@ struct sky2_port {
        u32                  tx_addr64;
        u16                  tx_pending;
        u16                  tx_last_mss;
-       u16                  tx_csum_start;
-       u16                  tx_csum_offset;
+       u32                  tx_tcpsum;
 
-       struct ring_info     *rx_ring ____cacheline_aligned_in_smp;
+       struct rx_ring_info  *rx_ring ____cacheline_aligned_in_smp;
        struct sky2_rx_le    *rx_le;
        u32                  rx_addr64;
        u16                  rx_next;           /* next re to check */
        u16                  rx_put;            /* next le index to use */
        u16                  rx_pending;
-       u16                  rx_bufsize;
+       u16                  rx_data_size;
+       u16                  rx_nfrags;
+
 #ifdef SKY2_VLAN_TAG_USED
        u16                  rx_tag;
        struct vlan_group    *vlgrp;
@@ -1860,13 +1867,13 @@ struct sky2_port {
 
        dma_addr_t           rx_le_map;
        dma_addr_t           tx_le_map;
-       u32                  advertising;       /* ADVERTISED_ bits */
+       u16                  advertising;       /* ADVERTISED_ bits */
        u16                  speed;     /* SPEED_1000, SPEED_100, ... */
        u8                   autoneg;   /* AUTONEG_ENABLE, AUTONEG_DISABLE */
        u8                   duplex;    /* DUPLEX_HALF, DUPLEX_FULL */
-       u8                   rx_pause;
-       u8                   tx_pause;
        u8                   rx_csum;
+       enum flow_control    flow_mode;
+       enum flow_control    flow_status;
 
        struct net_device_stats net_stats;
 
@@ -1880,7 +1887,7 @@ struct sky2_hw {
        int                  pm_cap;
        u8                   chip_id;
        u8                   chip_rev;
-       u8                   copper;
+       u8                   pmd_type;
        u8                   ports;
 
        struct sky2_status_le *st_le;
@@ -1892,6 +1899,11 @@ struct sky2_hw {
        wait_queue_head_t    msi_wait;
 };
 
+static inline int sky2_is_copper(const struct sky2_hw *hw)
+{
+       return !(hw->pmd_type == 'L' || hw->pmd_type == 'S' || hw->pmd_type == 'P');
+}
+
 /* Register accessor for memory mapped device */
 static inline u32 sky2_read32(const struct sky2_hw *hw, unsigned reg)
 {