ar8216: enable cpu port to receive arp and broadcast frames for ar8236
[openwrt/staging/chunkeey.git] / target / linux / generic / files / drivers / net / phy / ar8216.h
index c83bf44e18fe2f3e363a64c6fa3674127ac67e50..d43739834e22a443aad65deb6b36c4fc64bd779d 100644 (file)
@@ -40,6 +40,8 @@
 #define AR8216_REG_FLOOD_MASK          0x002C
 #define   AR8216_FM_UNI_DEST_PORTS     BITS(0, 6)
 #define   AR8216_FM_MULTI_DEST_PORTS   BITS(16, 6)
+#define   AR8236_FM_CPU_BROADCAST_EN   BIT(26)
+#define   AR8236_FM_CPU_BCAST_FWD_EN   BIT(25)
 
 #define AR8216_REG_GLOBAL_CTRL         0x0030
 #define   AR8216_GCTRL_MTU             BITS(0, 11)
@@ -93,6 +95,7 @@
 #define   AR8216_ATU_CTRL_AGE_EN       BIT(17)
 #define   AR8216_ATU_CTRL_AGE_TIME     BITS(0, 16)
 #define   AR8216_ATU_CTRL_AGE_TIME_S   0
+#define   AR8236_ATU_CTRL_RES          BIT(20)
 
 #define AR8216_REG_MIB_FUNC            0x0080
 #define   AR8216_MIB_TIMER             BITS(0, 16)
 #define   AR8216_MIB_FUNC_CAPTURE      0x3
 #define   AR8236_MIB_EN                        BIT(30)
 
+#define AR8216_REG_GLOBAL_CPUPORT              0x0078
+#define   AR8216_GLOBAL_CPUPORT_MIRROR_PORT    BITS(4, 4)
+#define   AR8216_GLOBAL_CPUPORT_MIRROR_PORT_S  4
+
 #define AR8216_PORT_OFFSET(_i)         (0x0100 * (_i + 1))
 #define AR8216_REG_PORT_STATUS(_i)     (AR8216_PORT_OFFSET(_i) + 0x0000)
 #define   AR8216_PORT_STATUS_SPEED     BITS(0,2)
 #define AR8216_REG_PORT_RATE(_i)       (AR8216_PORT_OFFSET(_i) + 0x000c)
 #define AR8216_REG_PORT_PRIO(_i)       (AR8216_PORT_OFFSET(_i) + 0x0010)
 
-#define AR8216_REG_PORT_STATS_BASE(_i) (0x19000 + (_i) * 0xa0)
-
 #define AR8216_STATS_RXBROAD           0x00
 #define AR8216_STATS_RXPAUSE           0x04
 #define AR8216_STATS_RXMULTI           0x08
 #define   AR8236_PORT_VLAN2_VLAN_MODE  BITS(30, 2)
 #define   AR8236_PORT_VLAN2_VLAN_MODE_S        30
 
-#define AR8236_REG_PORT_STATS_BASE(_i) (0x20000 + (_i) * 0x100)
-
 #define AR8236_STATS_RXBROAD           0x00
 #define AR8236_STATS_RXPAUSE           0x04
 #define AR8236_STATS_RXMULTI           0x08
 #define AR8236_STATS_TXDEFER           0xa0
 #define AR8236_STATS_TXLATECOL         0xa4
 
+#define AR8316_REG_POSTRIP                     0x0008
+#define   AR8316_POSTRIP_MAC0_GMII_EN          BIT(0)
+#define   AR8316_POSTRIP_MAC0_RGMII_EN         BIT(1)
+#define   AR8316_POSTRIP_PHY4_GMII_EN          BIT(2)
+#define   AR8316_POSTRIP_PHY4_RGMII_EN         BIT(3)
+#define   AR8316_POSTRIP_MAC0_MAC_MODE         BIT(4)
+#define   AR8316_POSTRIP_RTL_MODE              BIT(5)
+#define   AR8316_POSTRIP_RGMII_RXCLK_DELAY_EN  BIT(6)
+#define   AR8316_POSTRIP_RGMII_TXCLK_DELAY_EN  BIT(7)
+#define   AR8316_POSTRIP_SERDES_EN             BIT(8)
+#define   AR8316_POSTRIP_SEL_ANA_RST           BIT(9)
+#define   AR8316_POSTRIP_GATE_25M_EN           BIT(10)
+#define   AR8316_POSTRIP_SEL_CLK25M            BIT(11)
+#define   AR8316_POSTRIP_HIB_PULSE_HW          BIT(12)
+#define   AR8316_POSTRIP_DBG_MODE_I            BIT(13)
+#define   AR8316_POSTRIP_MAC5_MAC_MODE         BIT(14)
+#define   AR8316_POSTRIP_MAC5_PHY_MODE         BIT(15)
+#define   AR8316_POSTRIP_POWER_DOWN_HW         BIT(16)
+#define   AR8316_POSTRIP_LPW_STATE_EN          BIT(17)
+#define   AR8316_POSTRIP_MAN_EN                        BIT(18)
+#define   AR8316_POSTRIP_PHY_PLL_ON            BIT(19)
+#define   AR8316_POSTRIP_LPW_EXIT              BIT(20)
+#define   AR8316_POSTRIP_TXDELAY_S0            BIT(21)
+#define   AR8316_POSTRIP_TXDELAY_S1            BIT(22)
+#define   AR8316_POSTRIP_RXDELAY_S0            BIT(23)
+#define   AR8316_POSTRIP_LED_OPEN_EN           BIT(24)
+#define   AR8316_POSTRIP_SPI_EN                        BIT(25)
+#define   AR8316_POSTRIP_RXDELAY_S1            BIT(26)
+#define   AR8316_POSTRIP_POWER_ON_SEL          BIT(31)
+
 #define AR8327_NUM_PORTS       7
-#define AR8327_NUM_PHYS                5
+#define AR8327_NUM_LEDS                15
 #define AR8327_PORTS_ALL       0x7f
+#define AR8327_NUM_LED_CTRL_REGS       4
 
 #define AR8327_REG_MASK                                0x000
 
 #define AR8327_REG_POWER_ON_STRIP              0x010
 #define   AR8327_POWER_ON_STRIP_POWER_ON_SEL   BIT(31)
 #define   AR8327_POWER_ON_STRIP_LED_OPEN_EN    BIT(24)
+#define   AR8327_POWER_ON_STRIP_SERDES_AEN     BIT(7)
 
 #define AR8327_REG_INT_STATUS0                 0x020
 #define   AR8327_INT0_VT_DONE                  BIT(20)
 #define   AR8327_MIB_CPU_KEEP                  BIT(20)
 
 #define AR8327_REG_SERVICE_TAG                 0x048
+#define AR8327_REG_LED_CTRL(_i)                        (0x050 + (_i) * 4)
 #define AR8327_REG_LED_CTRL0                   0x050
 #define AR8327_REG_LED_CTRL1                   0x054
 #define AR8327_REG_LED_CTRL2                   0x058
 #define AR8327_REG_HEADER_CTRL                 0x098
 #define AR8327_REG_PORT_HEADER(_i)             (0x09c + (_i) * 4)
 
+#define AR8327_REG_SGMII_CTRL                  0x0e0
+#define   AR8327_SGMII_CTRL_EN_PLL             BIT(1)
+#define   AR8327_SGMII_CTRL_EN_RX              BIT(2)
+#define   AR8327_SGMII_CTRL_EN_TX              BIT(3)
+
+#define AR8327_REG_EEE_CTRL                    0x100
+#define   AR8327_EEE_CTRL_DISABLE_PHY(_i)      BIT(4 + (_i) * 2)
+
 #define AR8327_REG_PORT_VLAN0(_i)              (0x420 + (_i) * 0x8)
 #define   AR8327_PORT_VLAN0_DEF_SVID           BITS(0, 12)
 #define   AR8327_PORT_VLAN0_DEF_SVID_S         0
 #define   AR8327_PORT_LOOKUP_STATE             BITS(16, 3)
 #define   AR8327_PORT_LOOKUP_STATE_S           16
 #define   AR8327_PORT_LOOKUP_LEARN             BIT(20)
+#define   AR8327_PORT_LOOKUP_ING_MIRROR_EN     BIT(25)
 
 #define AR8327_REG_PORT_PRIO(_i)               (0x664 + (_i) * 0xc)
 
-#define AR8327_REG_PORT_STATS_BASE(_i)         (0x1000 + (_i) * 0x100)
+#define AR8327_REG_PORT_HOL_CTRL1(_i)          (0x974 + (_i) * 0x8)
+#define   AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN   BIT(16)
+
+#define AR8337_PAD_MAC06_EXCHANGE_EN           BIT(31)
 
 /* port speed */
 enum {