]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/tg3.h
[TG3]: Add 5761 APE support
[net-next-2.6.git] / drivers / net / tg3.h
index d84e75e7365d5c6bb7809f3c8557cac57b5d15e1..632c2f084c52f76a3bb77595fd4e5d35c94e848f 100644 (file)
 #define TG3PCI_IRQ_PIN                 0x0000003d
 #define TG3PCI_MIN_GNT                 0x0000003e
 #define TG3PCI_MAX_LAT                 0x0000003f
-#define TG3PCI_X_CAPS                  0x00000040
-#define  PCIX_CAPS_RELAXED_ORDERING     0x00020000
-#define  PCIX_CAPS_SPLIT_MASK           0x00700000
-#define  PCIX_CAPS_SPLIT_SHIFT          20
-#define  PCIX_CAPS_BURST_MASK           0x000c0000
-#define  PCIX_CAPS_BURST_SHIFT          18
-#define  PCIX_CAPS_MAX_BURST_CPIOB      2
-#define TG3PCI_PM_CAP_PTR              0x00000041
-#define TG3PCI_X_COMMAND               0x00000042
-#define TG3PCI_X_STATUS                        0x00000044
-#define TG3PCI_PM_CAP_ID               0x00000048
-#define TG3PCI_VPD_CAP_PTR             0x00000049
-#define TG3PCI_PM_CAPS                 0x0000004a
-#define TG3PCI_PM_CTRL_STAT            0x0000004c
-#define TG3PCI_BR_SUPP_EXT             0x0000004e
-#define TG3PCI_PM_DATA                 0x0000004f
-#define TG3PCI_VPD_CAP_ID              0x00000050
-#define TG3PCI_MSI_CAP_PTR             0x00000051
-#define TG3PCI_VPD_ADDR_FLAG           0x00000052
-#define  VPD_ADDR_FLAG_WRITE           0x00008000
-#define TG3PCI_VPD_DATA                        0x00000054
-#define TG3PCI_MSI_CAP_ID              0x00000058
-#define TG3PCI_NXT_CAP_PTR             0x00000059
-#define TG3PCI_MSI_CTRL                        0x0000005a
-#define TG3PCI_MSI_ADDR_LOW            0x0000005c
-#define TG3PCI_MSI_ADDR_HIGH           0x00000060
+/* 0x40 --> 0x64 unused */
 #define TG3PCI_MSI_DATA                        0x00000064
 /* 0x66 --> 0x68 unused */
 #define TG3PCI_MISC_HOST_CTRL          0x00000068
 #define  CHIPREV_ID_5752_A1             0x6001
 #define  CHIPREV_ID_5714_A2             0x9002
 #define  CHIPREV_ID_5906_A1             0xc001
+#define  CHIPREV_ID_5784_A0             0x5784000
 #define  GET_ASIC_REV(CHIP_REV_ID)     ((CHIP_REV_ID) >> 12)
 #define   ASIC_REV_5700                         0x07
 #define   ASIC_REV_5701                         0x00
 #define   ASIC_REV_5755                         0x0a
 #define   ASIC_REV_5787                         0x0b
 #define   ASIC_REV_5906                         0x0c
+#define   ASIC_REV_USE_PROD_ID_REG      0x0f
+#define   ASIC_REV_5784                         0x5784
+#define   ASIC_REV_5761                         0x5761
 #define  GET_CHIP_REV(CHIP_REV_ID)     ((CHIP_REV_ID) >> 8)
 #define   CHIPREV_5700_AX               0x70
 #define   CHIPREV_5700_BX               0x71
 #define  PCISTATE_ROM_RETRY_ENABLE      0x00000040
 #define  PCISTATE_FLAT_VIEW             0x00000100
 #define  PCISTATE_RETRY_SAME_DMA        0x00002000
+#define  PCISTATE_ALLOW_APE_CTLSPC_WR   0x00010000
+#define  PCISTATE_ALLOW_APE_SHMEM_WR    0x00020000
 #define TG3PCI_CLOCK_CTRL              0x00000074
 #define  CLOCK_CTRL_CORECLK_DISABLE     0x00000200
 #define  CLOCK_CTRL_RXCLK_DISABLE       0x00000400
 #define TG3PCI_DUAL_MAC_CTRL           0x000000b8
 #define  DUAL_MAC_CTRL_CH_MASK          0x00000003
 #define  DUAL_MAC_CTRL_ID               0x00000004
-/* 0xbc --> 0x100 unused */
+#define TG3PCI_PRODID_ASICREV          0x000000bc
+#define  PROD_ID_ASIC_REV_MASK          0x0fffffff
+/* 0xc0 --> 0x100 unused */
 
 /* 0x100 --> 0x200 unused */
 
 #define  RCVLSC_MODE_ATTN_ENABLE        0x00000004
 #define RCVLSC_STATUS                  0x00003404
 #define  RCVLSC_STATUS_ERROR_ATTN       0x00000004
-/* 0x3408 --> 0x3800 unused */
+/* 0x3408 --> 0x3600 unused */
+
+/* CPMU registers */
+#define TG3_CPMU_CTRL                  0x00003600
+#define  CPMU_CTRL_LINK_IDLE_MODE       0x00000200
+#define  CPMU_CTRL_LINK_AWARE_MODE      0x00000400
+/* 0x3604 --> 0x3800 unused */
 
 /* Mbuf cluster free registers */
 #define MBFREE_MODE                    0x00003800
 #define  RDMAC_MODE_FIFOOREAD_ENAB      0x00000100
 #define  RDMAC_MODE_LNGREAD_ENAB        0x00000200
 #define  RDMAC_MODE_SPLIT_ENABLE        0x00000800
+#define  RDMAC_MODE_BD_SBD_CRPT_ENAB    0x00000800
 #define  RDMAC_MODE_SPLIT_RESET                 0x00001000
+#define  RDMAC_MODE_MBUF_RBD_CRPT_ENAB  0x00001000
+#define  RDMAC_MODE_MBUF_SBD_CRPT_ENAB  0x00002000
 #define  RDMAC_MODE_FIFO_SIZE_128       0x00020000
 #define  RDMAC_MODE_FIFO_LONG_BURST     0x00030000
 #define RDMAC_STATUS                   0x00004804
 #define  FLASH_5787VENDOR_ATMEL_EEPROM_376KHZ   0x03000002
 #define  FLASH_5787VENDOR_MICRO_EEPROM_64KHZ    0x03000000
 #define  FLASH_5787VENDOR_MICRO_EEPROM_376KHZ   0x02000000
+#define  FLASH_5761VENDOR_ATMEL_MDB021D         0x00800003
+#define  FLASH_5761VENDOR_ATMEL_MDB041D         0x00800000
+#define  FLASH_5761VENDOR_ATMEL_MDB081D         0x00800002
+#define  FLASH_5761VENDOR_ATMEL_MDB161D         0x00800001
+#define  FLASH_5761VENDOR_ATMEL_ADB021D         0x00000003
+#define  FLASH_5761VENDOR_ATMEL_ADB041D         0x00000000
+#define  FLASH_5761VENDOR_ATMEL_ADB081D         0x00000002
+#define  FLASH_5761VENDOR_ATMEL_ADB161D         0x00000001
+#define  FLASH_5761VENDOR_ST_M_M45PE20  0x02800001
+#define  FLASH_5761VENDOR_ST_M_M45PE40  0x02800000
+#define  FLASH_5761VENDOR_ST_M_M45PE80  0x02800002
+#define  FLASH_5761VENDOR_ST_M_M45PE16  0x02800003
+#define  FLASH_5761VENDOR_ST_A_M45PE20  0x02000001
+#define  FLASH_5761VENDOR_ST_A_M45PE40  0x02000000
+#define  FLASH_5761VENDOR_ST_A_M45PE80  0x02000002
+#define  FLASH_5761VENDOR_ST_A_M45PE16  0x02000003
 #define  NVRAM_CFG1_5752PAGE_SIZE_MASK  0x70000000
 #define  FLASH_5752PAGE_SIZE_256        0x00000000
 #define  FLASH_5752PAGE_SIZE_512        0x10000000
 #define  ACCESS_ENABLE                  0x00000001
 #define  ACCESS_WR_ENABLE               0x00000002
 #define NVRAM_WRITE1                   0x00007028
-/* 0x702c --> 0x7400 unused */
+/* 0x702c unused */
+
+#define NVRAM_ADDR_LOCKOUT             0x00007030
+/* 0x7034 --> 0x7c00 unused */
 
-/* 0x7400 --> 0x7c00 unused */
 #define PCIE_TRANSACTION_CFG           0x00007c04
 #define PCIE_TRANS_CFG_1SHOT_MSI        0x20000000
 #define PCIE_TRANS_CFG_LOM              0x00000020
 #define  NIC_SRAM_DATA_CFG_MINI_PCI             0x00001000
 #define  NIC_SRAM_DATA_CFG_FIBER_WOL            0x00004000
 #define  NIC_SRAM_DATA_CFG_NO_GPIO2             0x00100000
+#define  NIC_SRAM_DATA_CFG_APE_ENABLE           0x00200000
 
 #define NIC_SRAM_DATA_VER                      0x00000b5c
 #define  NIC_SRAM_DATA_VER_SHIFT                16
 #define MII_TG3_TEST1_TRIM_EN          0x0010
 #define MII_TG3_TEST1_CRC_EN           0x8000
 
+/* APE registers.  Accessible through BAR1 */
+#define TG3_APE_EVENT                  0x000c
+#define  APE_EVENT_1                    0x00000001
+#define TG3_APE_LOCK_REQ               0x002c
+#define  APE_LOCK_REQ_DRIVER            0x00001000
+#define TG3_APE_LOCK_GRANT             0x004c
+#define  APE_LOCK_GRANT_DRIVER          0x00001000
+#define TG3_APE_SEG_SIG                        0x4000
+#define  APE_SEG_SIG_MAGIC              0x41504521
+
+/* APE shared memory.  Accessible through BAR1 */
+#define TG3_APE_FW_STATUS              0x400c
+#define  APE_FW_STATUS_READY            0x00000100
+#define TG3_APE_HOST_SEG_SIG           0x4200
+#define  APE_HOST_SEG_SIG_MAGIC                 0x484f5354
+#define TG3_APE_HOST_SEG_LEN           0x4204
+#define  APE_HOST_SEG_LEN_MAGIC                 0x0000001c
+#define TG3_APE_HOST_INIT_COUNT                0x4208
+#define TG3_APE_HOST_DRIVER_ID         0x420c
+#define  APE_HOST_DRIVER_ID_MAGIC       0xf0035100
+#define TG3_APE_HOST_BEHAVIOR          0x4210
+#define  APE_HOST_BEHAV_NO_PHYLOCK      0x00000001
+#define TG3_APE_HOST_HEARTBEAT_INT_MS  0x4214
+#define  APE_HOST_HEARTBEAT_INT_DISABLE         0
+#define  APE_HOST_HEARTBEAT_INT_5SEC    5000
+#define TG3_APE_HOST_HEARTBEAT_COUNT   0x4218
+
+#define TG3_APE_EVENT_STATUS           0x4300
+
+#define  APE_EVENT_STATUS_DRIVER_EVNT   0x00000010
+#define  APE_EVENT_STATUS_STATE_CHNGE   0x00000500
+#define  APE_EVENT_STATUS_STATE_START   0x00010000
+#define  APE_EVENT_STATUS_STATE_UNLOAD  0x00020000
+#define  APE_EVENT_STATUS_STATE_WOL     0x00030000
+#define  APE_EVENT_STATUS_STATE_SUSPEND         0x00040000
+#define  APE_EVENT_STATUS_EVENT_PENDING         0x80000000
+
+/* APE convenience enumerations. */
+#define TG3_APE_LOCK_MEM                4
+
+
 /* There are two ways to manage the TX descriptors on the tigon3.
  * Either the descriptors are in host DMA'able memory, or they
  * exist only in the cards on-chip SRAM.  All 16 send bds are under
@@ -2155,6 +2207,7 @@ struct tg3 {
        void                            (*write32_mbox) (struct tg3 *, u32,
                                                         u32);
        void __iomem                    *regs;
+       void __iomem                    *aperegs;
        struct net_device               *dev;
        struct pci_dev                  *pdev;
 
@@ -2176,6 +2229,7 @@ struct tg3 {
        dma_addr_t                      tx_desc_mapping;
 
        /* begin "rx thread" cacheline section */
+       struct napi_struct              napi;
        void                            (*write32_rx_mbox) (struct tg3 *, u32,
                                                            u32);
        u32                             rx_rcb_ptr;
@@ -2237,7 +2291,7 @@ struct tg3 {
 #define TG3_FLAG_JUMBO_RING_ENABLE     0x00800000
 #define TG3_FLAG_10_100_ONLY           0x01000000
 #define TG3_FLAG_PAUSE_AUTONEG         0x02000000
-
+#define TG3_FLAG_CPMU_PRESENT          0x04000000
 #define TG3_FLAG_40BIT_DMA_BUG         0x08000000
 #define TG3_FLAG_BROKEN_CHECKSUMS      0x10000000
 #define TG3_FLAG_SUPPORT_MSI           0x20000000
@@ -2279,6 +2333,9 @@ struct tg3 {
 #define TG3_FLG2_PHY_JITTER_BUG                0x20000000
 #define TG3_FLG2_NO_FWARE_REPORTED     0x40000000
 #define TG3_FLG2_PHY_ADJUST_TRIM       0x80000000
+       u32                             tg3_flags3;
+#define TG3_FLG3_NO_NVRAM_ADDR_TRANS   0x00000001
+#define TG3_FLG3_ENABLE_APE            0x00000002
 
        struct timer_list               timer;
        u16                             timer_counter;
@@ -2309,7 +2366,7 @@ struct tg3 {
        u32                             pwrmgmt_thresh;
 
        /* PCI block */
-       u16                             pci_chip_rev_id;
+       u32                             pci_chip_rev_id;
        u8                              pci_cacheline_sz;
        u8                              pci_lat_timer;
        u8                              pci_hdr_type;
@@ -2317,6 +2374,7 @@ struct tg3 {
 
        int                             pm_cap;
        int                             msi_cap;
+       int                             pcix_cap;
 
        /* PHY info */
        u32                             phy_id;
@@ -2335,6 +2393,7 @@ struct tg3 {
 #define PHY_ID_BCM5755                 0xbc050cc0
 #define PHY_ID_BCM5787                 0xbc050ce0
 #define PHY_ID_BCM5756                 0xbc050ed0
+#define PHY_ID_BCM5784                 0xbc050fa0
 #define PHY_ID_BCM5906                 0xdc00ac40
 #define PHY_ID_BCM8002                 0x60010140
 #define PHY_ID_INVALID                 0xffffffff
@@ -2345,6 +2404,7 @@ struct tg3 {
 #define PHY_REV_BCM5411_X0             0x1 /* Found on Netgear GA302T */
 
        u32                             led_ctrl;
+       u32                             pci_cmd;
 
        char                            board_part_number[24];
        char                            fw_ver[16];