Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / stmicro / stmmac / dwmac1000.h
index 7ad56afd63247a9e3c73c27c923109e48e5f638d..c12aabb8cf93c9f72627b939cf7ed64b8a0819dd 100644 (file)
@@ -89,13 +89,46 @@ enum power_event {
                                (reg * 8))
 #define GMAC_MAX_PERFECT_ADDRESSES     32
 
+/* PCS registers (AN/TBI/SGMII/RGMII) offset */
 #define GMAC_AN_CTRL   0x000000c0      /* AN control */
 #define GMAC_AN_STATUS 0x000000c4      /* AN status */
 #define GMAC_ANE_ADV   0x000000c8      /* Auto-Neg. Advertisement */
-#define GMAC_ANE_LINK  0x000000cc      /* Auto-Neg. link partener ability */
+#define GMAC_ANE_LPA   0x000000cc      /* Auto-Neg. link partener ability */
 #define GMAC_ANE_EXP   0x000000d0      /* ANE expansion */
 #define GMAC_TBI       0x000000d4      /* TBI extend status */
-#define GMAC_GMII_STATUS 0x000000d8    /* S/R-GMII status */
+#define GMAC_S_R_GMII  0x000000d8      /* SGMII RGMII status */
+
+/* AN Configuration defines */
+#define GMAC_AN_CTRL_RAN       0x00000200      /* Restart Auto-Negotiation */
+#define GMAC_AN_CTRL_ANE       0x00001000      /* Auto-Negotiation Enable */
+#define GMAC_AN_CTRL_ELE       0x00004000      /* External Loopback Enable */
+#define GMAC_AN_CTRL_ECD       0x00010000      /* Enable Comma Detect */
+#define GMAC_AN_CTRL_LR                0x00020000      /* Lock to Reference */
+#define GMAC_AN_CTRL_SGMRAL    0x00040000      /* SGMII RAL Control */
+
+/* AN Status defines */
+#define GMAC_AN_STATUS_LS      0x00000004      /* Link Status 0:down 1:up */
+#define GMAC_AN_STATUS_ANA     0x00000008      /* Auto-Negotiation Ability */
+#define GMAC_AN_STATUS_ANC     0x00000020      /* Auto-Negotiation Complete */
+#define GMAC_AN_STATUS_ES      0x00000100      /* Extended Status */
+
+/* Register 54 (SGMII/RGMII status register) */
+#define GMAC_S_R_GMII_LINK             0x8
+#define GMAC_S_R_GMII_SPEED            0x5
+#define GMAC_S_R_GMII_SPEED_SHIFT      0x1
+#define GMAC_S_R_GMII_MODE             0x1
+#define GMAC_S_R_GMII_SPEED_125                2
+#define GMAC_S_R_GMII_SPEED_25         1
+
+/* Common ADV and LPA defines */
+#define GMAC_ANE_FD            (1 << 5)
+#define GMAC_ANE_HD            (1 << 6)
+#define GMAC_ANE_PSE           (3 << 7)
+#define GMAC_ANE_PSE_SHIFT     7
+
+ /* GMAC Configuration defines */
+#define GMAC_CONTROL_TC        0x01000000      /* Transmit Conf. in RGMII/SGMII */
+#define GMAC_CONTROL_WD        0x00800000      /* Disable Watchdog on receive */
 
 /* GMAC Configuration defines */
 #define GMAC_CONTROL_TC        0x01000000      /* Transmit Conf. in RGMII/SGMII */
@@ -108,19 +141,19 @@ enum inter_frame_gap {
        GMAC_CONTROL_IFG_80 = 0x00020000,
        GMAC_CONTROL_IFG_40 = 0x000e0000,
 };
-#define GMAC_CONTROL_DCRS      0x00010000 /* Disable carrier sense during tx */
-#define GMAC_CONTROL_PS                0x00008000 /* Port Select 0:GMI 1:MII */
-#define GMAC_CONTROL_FES       0x00004000 /* Speed 0:10 1:100 */
-#define GMAC_CONTROL_DO                0x00002000 /* Disable Rx Own */
-#define GMAC_CONTROL_LM                0x00001000 /* Loop-back mode */
-#define GMAC_CONTROL_DM                0x00000800 /* Duplex Mode */
-#define GMAC_CONTROL_IPC       0x00000400 /* Checksum Offload */
-#define GMAC_CONTROL_DR                0x00000200 /* Disable Retry */
-#define GMAC_CONTROL_LUD       0x00000100 /* Link up/down */
-#define GMAC_CONTROL_ACS       0x00000080 /* Automatic Pad/FCS Stripping */
-#define GMAC_CONTROL_DC                0x00000010 /* Deferral Check */
-#define GMAC_CONTROL_TE                0x00000008 /* Transmitter Enable */
-#define GMAC_CONTROL_RE                0x00000004 /* Receiver Enable */
+#define GMAC_CONTROL_DCRS      0x00010000      /* Disable carrier sense */
+#define GMAC_CONTROL_PS                0x00008000      /* Port Select 0:GMI 1:MII */
+#define GMAC_CONTROL_FES       0x00004000      /* Speed 0:10 1:100 */
+#define GMAC_CONTROL_DO                0x00002000      /* Disable Rx Own */
+#define GMAC_CONTROL_LM                0x00001000      /* Loop-back mode */
+#define GMAC_CONTROL_DM                0x00000800      /* Duplex Mode */
+#define GMAC_CONTROL_IPC       0x00000400      /* Checksum Offload */
+#define GMAC_CONTROL_DR                0x00000200      /* Disable Retry */
+#define GMAC_CONTROL_LUD       0x00000100      /* Link up/down */
+#define GMAC_CONTROL_ACS       0x00000080      /* Auto Pad/FCS Stripping */
+#define GMAC_CONTROL_DC                0x00000010      /* Deferral Check */
+#define GMAC_CONTROL_TE                0x00000008      /* Transmitter Enable */
+#define GMAC_CONTROL_RE                0x00000004      /* Receiver Enable */
 
 #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \
                        GMAC_CONTROL_JE | GMAC_CONTROL_BE)
@@ -151,15 +184,16 @@ enum inter_frame_gap {
 #define DMA_BUS_MODE_SFT_RESET 0x00000001      /* Software Reset */
 #define DMA_BUS_MODE_DA                0x00000002      /* Arbitration scheme */
 #define DMA_BUS_MODE_DSL_MASK  0x0000007c      /* Descriptor Skip Length */
-#define DMA_BUS_MODE_DSL_SHIFT 2       /*   (in DWORDS)      */
+#define DMA_BUS_MODE_DSL_SHIFT 2               /*   (in DWORDS)      */
 /* Programmable burst length (passed thorugh platform)*/
 #define DMA_BUS_MODE_PBL_MASK  0x00003f00      /* Programmable Burst Len */
 #define DMA_BUS_MODE_PBL_SHIFT 8
+#define DMA_BUS_MODE_ATDS      0x00000080      /* Alternate Descriptor Size */
 
 enum rx_tx_priority_ratio {
-       double_ratio = 0x00004000,      /*2:1 */
-       triple_ratio = 0x00008000,      /*3:1 */
-       quadruple_ratio = 0x0000c000,   /*4:1 */
+       double_ratio = 0x00004000,      /* 2:1 */
+       triple_ratio = 0x00008000,      /* 3:1 */
+       quadruple_ratio = 0x0000c000,   /* 4:1 */
 };
 
 #define DMA_BUS_MODE_FB                0x00010000      /* Fixed burst */
@@ -179,9 +213,10 @@ enum rx_tx_priority_ratio {
 #define DMA_BUS_FB               0x00010000    /* Fixed Burst */
 
 /* DMA operation mode defines (start/stop tx/rx are placed in common header)*/
-#define DMA_CONTROL_DT         0x04000000 /* Disable Drop TCP/IP csum error */
-#define DMA_CONTROL_RSF                0x02000000 /* Receive Store and Forward */
-#define DMA_CONTROL_DFF                0x01000000 /* Disaable flushing */
+/* Disable Drop TCP/IP csum error */
+#define DMA_CONTROL_DT         0x04000000
+#define DMA_CONTROL_RSF                0x02000000      /* Receive Store and Forward */
+#define DMA_CONTROL_DFF                0x01000000      /* Disaable flushing */
 /* Threshold for Activating the FC */
 enum rfa {
        act_full_minus_1 = 0x00800000,
@@ -196,7 +231,7 @@ enum rfd {
        deac_full_minus_3 = 0x00401000,
        deac_full_minus_4 = 0x00401800,
 };
-#define DMA_CONTROL_TSF                0x00200000 /* Transmit  Store and Forward */
+#define DMA_CONTROL_TSF        0x00200000      /* Transmit  Store and Forward */
 
 enum ttc_control {
        DMA_CONTROL_TTC_64 = 0x00000000,