diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-12-05 13:15:01 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-07 15:00:36 -0500 |
commit | 75758e8aa4b7d5c651261ce653dd8d0b716e1eda (patch) | |
tree | 1ed8a9555003dd106bb352351542010f7062e31e /drivers/net/cxgb3/xgmac.c | |
parent | fdaea7a93d097b066e76c7db6091228a84f87ec2 (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/net/cxgb3/xgmac.c')
-rw-r--r-- | drivers/net/cxgb3/xgmac.c | 44 |
1 files changed, 29 insertions, 15 deletions
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 | ||
314 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | 319 | int 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; |