aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bcm63xx_enet.h
diff options
context:
space:
mode:
authorMaxime Bizon <mbizon@freebox.fr>2013-06-04 17:53:35 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-10 17:28:28 -0400
commit6f00a0229627ca189529cad3f9154ac2f9e5c7db (patch)
tree20b010b5faa5fca26951f3f3575da92a9cf317fc /drivers/net/ethernet/broadcom/bcm63xx_enet.h
parent0ae99b5fede6f3a8d252d50bb4aba29544295219 (diff)
bcm63xx_enet: add support for Broadcom BCM63xx integrated gigabit switch
Newer Broadcom BCM63xx SoCs: 6328, 6362 and 6368 have an integrated switch which needs to be driven slightly differently from the traditional external switches. This patch introduces changes in arch/mips/bcm63xx in order to: - register a bcm63xx_enetsw driver instead of bcm63xx_enet driver - update DMA channels configuration & state RAM base addresses - add a new platform data configuration knob to define the number of ports per switch/device and force link on some ports - define the required switch registers On the driver side, the following changes are required: - the switch ports need to be polled to ensure the link is up and running and RX/TX can properly work - basic switch configuration needs to be performed for the switch to forward packets to the CPU - update the MIB counters since the integrated Signed-off-by: Maxime Bizon <mbizon@freebox.fr> Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bcm63xx_enet.h')
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.h b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
index 133d5857b9e2..721ffbaef8d2 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -18,6 +18,7 @@
18 18
19/* maximum burst len for dma (4 bytes unit) */ 19/* maximum burst len for dma (4 bytes unit) */
20#define BCMENET_DMA_MAXBURST 16 20#define BCMENET_DMA_MAXBURST 16
21#define BCMENETSW_DMA_MAXBURST 8
21 22
22/* tx transmit threshold (4 bytes unit), fifo is 256 bytes, the value 23/* tx transmit threshold (4 bytes unit), fifo is 256 bytes, the value
23 * must be low enough so that a DMA transfer of above burst length can 24 * must be low enough so that a DMA transfer of above burst length can
@@ -84,11 +85,60 @@
84#define ETH_MIB_RX_CNTRL 54 85#define ETH_MIB_RX_CNTRL 54
85 86
86 87
88/*
89 * SW MIB Counters register definitions
90*/
91#define ETHSW_MIB_TX_ALL_OCT 0
92#define ETHSW_MIB_TX_DROP_PKTS 2
93#define ETHSW_MIB_TX_QOS_PKTS 3
94#define ETHSW_MIB_TX_BRDCAST 4
95#define ETHSW_MIB_TX_MULT 5
96#define ETHSW_MIB_TX_UNI 6
97#define ETHSW_MIB_TX_COL 7
98#define ETHSW_MIB_TX_1_COL 8
99#define ETHSW_MIB_TX_M_COL 9
100#define ETHSW_MIB_TX_DEF 10
101#define ETHSW_MIB_TX_LATE 11
102#define ETHSW_MIB_TX_EX_COL 12
103#define ETHSW_MIB_TX_PAUSE 14
104#define ETHSW_MIB_TX_QOS_OCT 15
105
106#define ETHSW_MIB_RX_ALL_OCT 17
107#define ETHSW_MIB_RX_UND 19
108#define ETHSW_MIB_RX_PAUSE 20
109#define ETHSW_MIB_RX_64 21
110#define ETHSW_MIB_RX_65_127 22
111#define ETHSW_MIB_RX_128_255 23
112#define ETHSW_MIB_RX_256_511 24
113#define ETHSW_MIB_RX_512_1023 25
114#define ETHSW_MIB_RX_1024_1522 26
115#define ETHSW_MIB_RX_OVR 27
116#define ETHSW_MIB_RX_JAB 28
117#define ETHSW_MIB_RX_ALIGN 29
118#define ETHSW_MIB_RX_CRC 30
119#define ETHSW_MIB_RX_GD_OCT 31
120#define ETHSW_MIB_RX_DROP 33
121#define ETHSW_MIB_RX_UNI 34
122#define ETHSW_MIB_RX_MULT 35
123#define ETHSW_MIB_RX_BRDCAST 36
124#define ETHSW_MIB_RX_SA_CHANGE 37
125#define ETHSW_MIB_RX_FRAG 38
126#define ETHSW_MIB_RX_OVR_DISC 39
127#define ETHSW_MIB_RX_SYM 40
128#define ETHSW_MIB_RX_QOS_PKTS 41
129#define ETHSW_MIB_RX_QOS_OCT 42
130#define ETHSW_MIB_RX_1523_2047 44
131#define ETHSW_MIB_RX_2048_4095 45
132#define ETHSW_MIB_RX_4096_8191 46
133#define ETHSW_MIB_RX_8192_9728 47
134
135
87struct bcm_enet_mib_counters { 136struct bcm_enet_mib_counters {
88 u64 tx_gd_octets; 137 u64 tx_gd_octets;
89 u32 tx_gd_pkts; 138 u32 tx_gd_pkts;
90 u32 tx_all_octets; 139 u32 tx_all_octets;
91 u32 tx_all_pkts; 140 u32 tx_all_pkts;
141 u32 tx_unicast;
92 u32 tx_brdcast; 142 u32 tx_brdcast;
93 u32 tx_mult; 143 u32 tx_mult;
94 u32 tx_64; 144 u32 tx_64;
@@ -97,7 +147,12 @@ struct bcm_enet_mib_counters {
97 u32 tx_256_511; 147 u32 tx_256_511;
98 u32 tx_512_1023; 148 u32 tx_512_1023;
99 u32 tx_1024_max; 149 u32 tx_1024_max;
150 u32 tx_1523_2047;
151 u32 tx_2048_4095;
152 u32 tx_4096_8191;
153 u32 tx_8192_9728;
100 u32 tx_jab; 154 u32 tx_jab;
155 u32 tx_drop;
101 u32 tx_ovr; 156 u32 tx_ovr;
102 u32 tx_frag; 157 u32 tx_frag;
103 u32 tx_underrun; 158 u32 tx_underrun;
@@ -114,6 +169,7 @@ struct bcm_enet_mib_counters {
114 u32 rx_all_octets; 169 u32 rx_all_octets;
115 u32 rx_all_pkts; 170 u32 rx_all_pkts;
116 u32 rx_brdcast; 171 u32 rx_brdcast;
172 u32 rx_unicast;
117 u32 rx_mult; 173 u32 rx_mult;
118 u32 rx_64; 174 u32 rx_64;
119 u32 rx_65_127; 175 u32 rx_65_127;
@@ -197,6 +253,9 @@ struct bcm_enet_priv {
197 /* number of dma desc in tx ring */ 253 /* number of dma desc in tx ring */
198 int tx_ring_size; 254 int tx_ring_size;
199 255
256 /* maximum dma burst size */
257 int dma_maxburst;
258
200 /* cpu view of rx dma ring */ 259 /* cpu view of rx dma ring */
201 struct bcm_enet_desc *tx_desc_cpu; 260 struct bcm_enet_desc *tx_desc_cpu;
202 261
@@ -269,6 +328,18 @@ struct bcm_enet_priv {
269 328
270 /* maximum hardware transmit/receive size */ 329 /* maximum hardware transmit/receive size */
271 unsigned int hw_mtu; 330 unsigned int hw_mtu;
331
332 bool enet_is_sw;
333
334 /* port mapping for switch devices */
335 int num_ports;
336 struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
337 int sw_port_link[ENETSW_MAX_PORT];
338
339 /* used to poll switch port state */
340 struct timer_list swphy_poll;
341 spinlock_t enetsw_mdio_lock;
272}; 342};
273 343
344
274#endif /* ! BCM63XX_ENET_H_ */ 345#endif /* ! BCM63XX_ENET_H_ */