aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2007-12-05 13:15:01 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-07 15:00:36 -0500
commit75758e8aa4b7d5c651261ce653dd8d0b716e1eda (patch)
tree1ed8a9555003dd106bb352351542010f7062e31e /drivers
parentfdaea7a93d097b066e76c7db6091228a84f87ec2 (diff)
cxgb3 - T3C support update
Update GPIO mapping for T3C. Update xgmac for T3C support. Fix typo in mtu table. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/cxgb3/regs.h27
-rw-r--r--drivers/net/cxgb3/t3_hw.c6
-rw-r--r--drivers/net/cxgb3/xgmac.c44
3 files changed, 58 insertions, 19 deletions
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 5e1bc0dec5f1..6e12bf4bc6cf 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1937,6 +1937,10 @@
1937 1937
1938#define A_XGM_RXFIFO_CFG 0x884 1938#define A_XGM_RXFIFO_CFG 0x884
1939 1939
1940#define S_RXFIFO_EMPTY 31
1941#define V_RXFIFO_EMPTY(x) ((x) << S_RXFIFO_EMPTY)
1942#define F_RXFIFO_EMPTY V_RXFIFO_EMPTY(1U)
1943
1940#define S_RXFIFOPAUSEHWM 17 1944#define S_RXFIFOPAUSEHWM 17
1941#define M_RXFIFOPAUSEHWM 0xfff 1945#define M_RXFIFOPAUSEHWM 0xfff
1942 1946
@@ -1961,6 +1965,10 @@
1961 1965
1962#define A_XGM_TXFIFO_CFG 0x888 1966#define A_XGM_TXFIFO_CFG 0x888
1963 1967
1968#define S_UNDERUNFIX 22
1969#define V_UNDERUNFIX(x) ((x) << S_UNDERUNFIX)
1970#define F_UNDERUNFIX V_UNDERUNFIX(1U)
1971
1964#define S_TXIPG 13 1972#define S_TXIPG 13
1965#define M_TXIPG 0xff 1973#define M_TXIPG 0xff
1966#define V_TXIPG(x) ((x) << S_TXIPG) 1974#define V_TXIPG(x) ((x) << S_TXIPG)
@@ -2034,10 +2042,27 @@
2034#define V_XAUIIMP(x) ((x) << S_XAUIIMP) 2042#define V_XAUIIMP(x) ((x) << S_XAUIIMP)
2035 2043
2036#define A_XGM_RX_MAX_PKT_SIZE 0x8a8 2044#define A_XGM_RX_MAX_PKT_SIZE 0x8a8
2037#define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 2045
2046#define S_RXMAXFRAMERSIZE 17
2047#define M_RXMAXFRAMERSIZE 0x3fff
2048#define V_RXMAXFRAMERSIZE(x) ((x) << S_RXMAXFRAMERSIZE)
2049#define G_RXMAXFRAMERSIZE(x) (((x) >> S_RXMAXFRAMERSIZE) & M_RXMAXFRAMERSIZE)
2050
2051#define S_RXENFRAMER 14
2052#define V_RXENFRAMER(x) ((x) << S_RXENFRAMER)
2053#define F_RXENFRAMER V_RXENFRAMER(1U)
2054
2055#define S_RXMAXPKTSIZE 0
2056#define M_RXMAXPKTSIZE 0x3fff
2057#define V_RXMAXPKTSIZE(x) ((x) << S_RXMAXPKTSIZE)
2058#define G_RXMAXPKTSIZE(x) (((x) >> S_RXMAXPKTSIZE) & M_RXMAXPKTSIZE)
2038 2059
2039#define A_XGM_RESET_CTRL 0x8ac 2060#define A_XGM_RESET_CTRL 0x8ac
2040 2061
2062#define S_XGMAC_STOP_EN 4
2063#define V_XGMAC_STOP_EN(x) ((x) << S_XGMAC_STOP_EN)
2064#define F_XGMAC_STOP_EN V_XGMAC_STOP_EN(1U)
2065
2041#define S_XG2G_RESET_ 3 2066#define S_XG2G_RESET_ 3
2042#define V_XG2G_RESET_(x) ((x) << S_XG2G_RESET_) 2067#define V_XG2G_RESET_(x) ((x) << S_XG2G_RESET_)
2043#define F_XG2G_RESET_ V_XG2G_RESET_(1U) 2068#define F_XG2G_RESET_ V_XG2G_RESET_(1U)
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index d4ee00d32219..522834c42ae7 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -447,8 +447,8 @@ static const struct adapter_info t3_adap_info[] = {
447 &mi1_mdio_ops, "Chelsio T302"}, 447 &mi1_mdio_ops, "Chelsio T302"},
448 {1, 0, 0, 0, 448 {1, 0, 0, 0,
449 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | 449 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
450 F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, 450 F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
451 SUPPORTED_10000baseT_Full | SUPPORTED_AUI, 451 0, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
452 &mi1_mdio_ext_ops, "Chelsio T310"}, 452 &mi1_mdio_ext_ops, "Chelsio T310"},
453 {2, 0, 0, 0, 453 {2, 0, 0, 0,
454 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | 454 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
@@ -2613,7 +2613,7 @@ static void __devinit init_mtus(unsigned short mtus[])
2613 * it can accomodate max size TCP/IP headers when SACK and timestamps 2613 * it can accomodate max size TCP/IP headers when SACK and timestamps
2614 * are enabled and still have at least 8 bytes of payload. 2614 * are enabled and still have at least 8 bytes of payload.
2615 */ 2615 */
2616 mtus[1] = 88; 2616 mtus[0] = 88;
2617 mtus[1] = 88; 2617 mtus[1] = 88;
2618 mtus[2] = 256; 2618 mtus[2] = 256;
2619 mtus[3] = 512; 2619 mtus[3] = 512;
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index eeb766aeced9..efcf09a709cf 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -106,6 +106,7 @@ int t3_mac_reset(struct cmac *mac)
106 t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft, 106 t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft,
107 F_RXSTRFRWRD | F_DISERRFRAMES, 107 F_RXSTRFRWRD | F_DISERRFRAMES,
108 uses_xaui(adap) ? 0 : F_RXSTRFRWRD); 108 uses_xaui(adap) ? 0 : F_RXSTRFRWRD);
109 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + oft, 0, F_UNDERUNFIX);
109 110
110 if (uses_xaui(adap)) { 111 if (uses_xaui(adap)) {
111 if (adap->params.rev == 0) { 112 if (adap->params.rev == 0) {
@@ -124,7 +125,11 @@ int t3_mac_reset(struct cmac *mac)
124 xaui_serdes_reset(mac); 125 xaui_serdes_reset(mac);
125 } 126 }
126 127
127 val = F_MAC_RESET_; 128 t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + oft,
129 V_RXMAXFRAMERSIZE(M_RXMAXFRAMERSIZE),
130 V_RXMAXFRAMERSIZE(MAX_FRAME_SIZE) | F_RXENFRAMER);
131 val = F_MAC_RESET_ | F_XGMAC_STOP_EN;
132
128 if (is_10G(adap)) 133 if (is_10G(adap))
129 val |= F_PCS_RESET_; 134 val |= F_PCS_RESET_;
130 else if (uses_xaui(adap)) 135 else if (uses_xaui(adap))
@@ -313,8 +318,9 @@ static int rx_fifo_hwm(int mtu)
313 318
314int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) 319int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
315{ 320{
316 int hwm, lwm; 321 int hwm, lwm, divisor;
317 unsigned int thres, v; 322 int ipg;
323 unsigned int thres, v, reg;
318 struct adapter *adap = mac->adapter; 324 struct adapter *adap = mac->adapter;
319 325
320 /* 326 /*
@@ -335,27 +341,32 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
335 hwm = min(hwm, MAC_RXFIFO_SIZE - 8192); 341 hwm = min(hwm, MAC_RXFIFO_SIZE - 8192);
336 lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4); 342 lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4);
337 343
338 if (adap->params.rev == T3_REV_B2 && 344 if (adap->params.rev >= T3_REV_B2 &&
339 (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) { 345 (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) {
340 disable_exact_filters(mac); 346 disable_exact_filters(mac);
341 v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset); 347 v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset);
342 t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset, 348 t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset,
343 F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST); 349 F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST);
344 350
345 /* drain rx FIFO */ 351 reg = adap->params.rev == T3_REV_B2 ?
346 if (t3_wait_op_done(adap, 352 A_XGM_RX_MAX_PKT_SIZE_ERR_CNT : A_XGM_RXFIFO_CFG;
347 A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + 353
348 mac->offset, 354 /* drain RX FIFO */
349 1 << 31, 1, 20, 5)) { 355 if (t3_wait_op_done(adap, reg + mac->offset,
356 F_RXFIFO_EMPTY, 1, 20, 5)) {
350 t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); 357 t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v);
351 enable_exact_filters(mac); 358 enable_exact_filters(mac);
352 return -EIO; 359 return -EIO;
353 } 360 }
354 t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); 361 t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset,
362 V_RXMAXPKTSIZE(M_RXMAXPKTSIZE),
363 V_RXMAXPKTSIZE(mtu));
355 t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); 364 t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v);
356 enable_exact_filters(mac); 365 enable_exact_filters(mac);
357 } else 366 } else
358 t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); 367 t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset,
368 V_RXMAXPKTSIZE(M_RXMAXPKTSIZE),
369 V_RXMAXPKTSIZE(mtu));
359 370
360 /* 371 /*
361 * Adjust the PAUSE frame watermarks. We always set the LWM, and the 372 * Adjust the PAUSE frame watermarks. We always set the LWM, and the
@@ -379,13 +390,16 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
379 thres /= 10; 390 thres /= 10;
380 thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; 391 thres = mtu > thres ? (mtu - thres + 7) / 8 : 0;
381 thres = max(thres, 8U); /* need at least 8 */ 392 thres = max(thres, 8U); /* need at least 8 */
393 ipg = (adap->params.rev == T3_REV_C) ? 0 : 1;
382 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, 394 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset,
383 V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), 395 V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG),
384 V_TXFIFOTHRESH(thres) | V_TXIPG(1)); 396 V_TXFIFOTHRESH(thres) | V_TXIPG(ipg));
385 397
386 if (adap->params.rev > 0) 398 if (adap->params.rev > 0) {
399 divisor = (adap->params.rev == T3_REV_C) ? 64 : 8;
387 t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, 400 t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset,
388 (hwm - lwm) * 4 / 8); 401 (hwm - lwm) * 4 / divisor);
402 }
389 t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, 403 t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset,
390 MAC_RXFIFO_SIZE * 4 * 8 / 512); 404 MAC_RXFIFO_SIZE * 4 * 8 / 512);
391 return 0; 405 return 0;
@@ -522,7 +536,7 @@ int t3b2_mac_watchdog_task(struct cmac *mac)
522 goto rxcheck; 536 goto rxcheck;
523 } 537 }
524 538
525 if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { 539 if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) {
526 if (mac->toggle_cnt > 4) { 540 if (mac->toggle_cnt > 4) {
527 status = 2; 541 status = 2;
528 goto out; 542 goto out;