net: macb: add capability to not set the clock rate
[linux-2.6-microblaze.git] / drivers / net / ethernet / cadence / macb.h
index 5de47f6..769694c 100644 (file)
 #define MACB_RBQPH             0x04D4
 
 /* GEM register offsets. */
+#define GEM_NCR                        0x0000 /* Network Control */
 #define GEM_NCFGR              0x0004 /* Network Config */
 #define GEM_USRIO              0x000c /* User IO */
 #define GEM_DMACFG             0x0010 /* DMA Configuration */
 #define GEM_JML                        0x0048 /* Jumbo Max Length */
+#define GEM_HS_MAC_CONFIG      0x0050 /* GEM high speed config */
 #define GEM_HRB                        0x0080 /* Hash Bottom */
 #define GEM_HRT                        0x0084 /* Hash Top */
 #define GEM_SA1B               0x0088 /* Specific1 Bottom */
 #define GEM_DCFG7              0x0298 /* Design Config 7 */
 #define GEM_DCFG8              0x029C /* Design Config 8 */
 #define GEM_DCFG10             0x02A4 /* Design Config 10 */
+#define GEM_DCFG12             0x02AC /* Design Config 12 */
+#define GEM_USX_CONTROL                0x0A80 /* High speed PCS control register */
+#define GEM_USX_STATUS         0x0A88 /* High speed PCS status register */
 
 #define GEM_TXBDCTRL   0x04cc /* TX Buffer Descriptor control register */
 #define GEM_RXBDCTRL   0x04d0 /* RX Buffer Descriptor control register */
 #define MACB_IRXFCS_OFFSET     19
 #define MACB_IRXFCS_SIZE       1
 
+/* GEM specific NCR bitfields. */
+#define GEM_ENABLE_HS_MAC_OFFSET       31
+#define GEM_ENABLE_HS_MAC_SIZE         1
+
 /* GEM specific NCFGR bitfields. */
+#define GEM_FD_OFFSET          1 /* Full duplex */
+#define GEM_FD_SIZE            1
 #define GEM_GBE_OFFSET         10 /* Gigabit mode enable */
 #define GEM_GBE_SIZE           1
 #define GEM_PCSSEL_OFFSET      11
 #define GEM_PCSSEL_SIZE                1
+#define GEM_PAE_OFFSET         13 /* Pause enable */
+#define GEM_PAE_SIZE           1
 #define GEM_CLK_OFFSET         18 /* MDC clock division */
 #define GEM_CLK_SIZE           3
 #define GEM_DBW_OFFSET         21 /* Data bus width */
 #define MACB_REV_OFFSET                                0
 #define MACB_REV_SIZE                          16
 
+/* Bitfield in HS_MAC_CONFIG */
+#define GEM_HS_MAC_SPEED_OFFSET                        0
+#define GEM_HS_MAC_SPEED_SIZE                  3
+
 /* Bitfields in DCFG1. */
 #define GEM_IRQCOR_OFFSET                      23
 #define GEM_IRQCOR_SIZE                                1
 #define GEM_DBWDEF_OFFSET                      25
 #define GEM_DBWDEF_SIZE                                3
+#define GEM_NO_PCS_OFFSET                      0
+#define GEM_NO_PCS_SIZE                                1
 
 /* Bitfields in DCFG2. */
 #define GEM_RX_PKT_BUFF_OFFSET                 20
 #define GEM_RXBD_RDBUFF_OFFSET                 8
 #define GEM_RXBD_RDBUFF_SIZE                   4
 
+/* Bitfields in DCFG12. */
+#define GEM_HIGH_SPEED_OFFSET                  26
+#define GEM_HIGH_SPEED_SIZE                    1
+
+/* Bitfields in USX_CONTROL. */
+#define GEM_USX_CTRL_SPEED_OFFSET              14
+#define GEM_USX_CTRL_SPEED_SIZE                        3
+#define GEM_SERDES_RATE_OFFSET                 12
+#define GEM_SERDES_RATE_SIZE                   2
+#define GEM_RX_SCR_BYPASS_OFFSET               9
+#define GEM_RX_SCR_BYPASS_SIZE                 1
+#define GEM_TX_SCR_BYPASS_OFFSET               8
+#define GEM_TX_SCR_BYPASS_SIZE                 1
+#define GEM_TX_EN_OFFSET                       1
+#define GEM_TX_EN_SIZE                         1
+#define GEM_SIGNAL_OK_OFFSET                   0
+#define GEM_SIGNAL_OK_SIZE                     1
+
+/* Bitfields in USX_STATUS. */
+#define GEM_USX_BLOCK_LOCK_OFFSET              0
+#define GEM_USX_BLOCK_LOCK_SIZE                        1
+
 /* Bitfields in TISUBN */
 #define GEM_SUBNSINCR_OFFSET                   0
 #define GEM_SUBNSINCRL_OFFSET                  24
 #define MACB_CAPS_GEM_HAS_PTP                  0x00000040
 #define MACB_CAPS_BD_RD_PREFETCH               0x00000080
 #define MACB_CAPS_NEEDS_RSTONUBR               0x00000100
+#define MACB_CAPS_CLK_HW_CHG                   0x04000000
 #define MACB_CAPS_MACB_IS_EMAC                 0x08000000
 #define MACB_CAPS_FIFO_MODE                    0x10000000
 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE       0x20000000
 #define MACB_CAPS_SG_DISABLED                  0x40000000
 #define MACB_CAPS_MACB_IS_GEM                  0x80000000
+#define MACB_CAPS_PCS                          0x01000000
+#define MACB_CAPS_HIGH_SPEED                   0x02000000
 
 /* LSO settings */
 #define MACB_LSO_UFO_ENABLE                    0x01
@@ -1104,6 +1148,14 @@ struct macb_pm_data {
        u32 usrio;
 };
 
+struct macb_usrio_config {
+       u32 mii;
+       u32 rmii;
+       u32 rgmii;
+       u32 refclk;
+       u32 hdfctlen;
+};
+
 struct macb_config {
        u32                     caps;
        unsigned int            dma_burst_length;
@@ -1112,6 +1164,7 @@ struct macb_config {
                            struct clk **rx_clk, struct clk **tsu_clk);
        int     (*init)(struct platform_device *pdev);
        int     jumbo_max_len;
+       const struct macb_usrio_config *usrio;
 };
 
 struct tsu_incr {
@@ -1201,6 +1254,7 @@ struct macb {
        struct mii_bus          *mii_bus;
        struct phylink          *phylink;
        struct phylink_config   phylink_config;
+       struct phylink_pcs      phylink_pcs;
 
        u32                     caps;
        unsigned int            dma_burst_length;
@@ -1244,6 +1298,7 @@ struct macb {
        u32     rx_intr_mask;
 
        struct macb_pm_data pm_data;
+       const struct macb_usrio_config *usrio;
 };
 
 #ifdef CONFIG_MACB_USE_HWSTAMP