aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 13:37:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 13:37:28 -0400
commitd7e9660ad9d5e0845f52848bce31bcf5cdcdea6b (patch)
treec6c67d145771187b194d79d603742b31090a59d6 /drivers/net/cxgb3
parentb8cb48aae1b8c50b37dcb7710363aa69a7a0d9ca (diff)
parent13af7a6ea502fcdd4c0e3d7de6e332b102309491 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1623 commits) netxen: update copyright netxen: fix tx timeout recovery netxen: fix file firmware leak netxen: improve pci memory access netxen: change firmware write size tg3: Fix return ring size breakage netxen: build fix for INET=n cdc-phonet: autoconfigure Phonet address Phonet: back-end for autoconfigured addresses Phonet: fix netlink address dump error handling ipv6: Add IFA_F_DADFAILED flag net: Add DEVTYPE support for Ethernet based devices mv643xx_eth.c: remove unused txq_set_wrr() ucc_geth: Fix hangs after switching from full to half duplex ucc_geth: Rearrange some code to avoid forward declarations phy/marvell: Make non-aneg speed/duplex forcing work for 88E1111 PHYs drivers/net/phy: introduce missing kfree drivers/net/wan: introduce missing kfree net: force bridge module(s) to be GPL Subject: [PATCH] appletalk: Fix skb leak when ipddp interface is not loaded ... Fixed up trivial conflicts: - arch/x86/include/asm/socket.h converted to <asm-generic/socket.h> in the x86 tree. The generic header has the same new #define's, so that works out fine. - drivers/net/tun.c fix conflict between 89f56d1e9 ("tun: reuse struct sock fields") that switched over to using 'tun->socket.sk' instead of the redundantly available (and thus removed) 'tun->sk', and 2b980dbd ("lsm: Add hooks to the TUN driver") which added a new 'tun->sk' use. Noted in 'next' by Stephen Rothwell.
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/adapter.h12
-rw-r--r--drivers/net/cxgb3/ael1002.c1193
-rw-r--r--drivers/net/cxgb3/aq100x.c7
-rw-r--r--drivers/net/cxgb3/common.h10
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c99
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/cxgb3/t3_hw.c19
-rw-r--r--drivers/net/cxgb3/xgmac.c11
8 files changed, 255 insertions, 1098 deletions
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 1694fad38720..2b1aea6aa558 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -276,6 +276,14 @@ static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
276 return netdev_priv(adap->port[idx]); 276 return netdev_priv(adap->port[idx]);
277} 277}
278 278
279static inline int phy2portid(struct cphy *phy)
280{
281 struct adapter *adap = phy->adapter;
282 struct port_info *port0 = adap2pinfo(adap, 0);
283
284 return &port0->phy == phy ? 0 : 1;
285}
286
279#define OFFLOAD_DEVMAP_BIT 15 287#define OFFLOAD_DEVMAP_BIT 15
280 288
281#define tdev2adap(d) container_of(d, struct adapter, tdev) 289#define tdev2adap(d) container_of(d, struct adapter, tdev)
@@ -301,7 +309,7 @@ void t3_stop_sge_timers(struct adapter *adap);
301void t3_free_sge_resources(struct adapter *adap); 309void t3_free_sge_resources(struct adapter *adap);
302void t3_sge_err_intr_handler(struct adapter *adapter); 310void t3_sge_err_intr_handler(struct adapter *adapter);
303irq_handler_t t3_intr_handler(struct adapter *adap, int polling); 311irq_handler_t t3_intr_handler(struct adapter *adap, int polling);
304int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev); 312netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev);
305int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb); 313int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
306void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p); 314void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p);
307int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, 315int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
@@ -312,4 +320,6 @@ int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx,
312 unsigned char *data); 320 unsigned char *data);
313irqreturn_t t3_sge_intr_msix(int irq, void *cookie); 321irqreturn_t t3_sge_intr_msix(int irq, void *cookie);
314 322
323int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size);
324
315#endif /* __T3_ADAPTER_H__ */ 325#endif /* __T3_ADAPTER_H__ */
diff --git a/drivers/net/cxgb3/ael1002.c b/drivers/net/cxgb3/ael1002.c
index 9fe008ec9ba5..5248f9e0b2f4 100644
--- a/drivers/net/cxgb3/ael1002.c
+++ b/drivers/net/cxgb3/ael1002.c
@@ -224,12 +224,6 @@ static int ael1006_reset(struct cphy *phy, int wait)
224 return t3_phy_reset(phy, MDIO_MMD_PMAPMD, wait); 224 return t3_phy_reset(phy, MDIO_MMD_PMAPMD, wait);
225} 225}
226 226
227static int ael1006_power_down(struct cphy *phy, int enable)
228{
229 return mdio_set_flag(&phy->mdio, phy->mdio.prtad, MDIO_MMD_PMAPMD,
230 MDIO_CTRL1, MDIO_CTRL1_LPOWER, enable);
231}
232
233static struct cphy_ops ael1006_ops = { 227static struct cphy_ops ael1006_ops = {
234 .reset = ael1006_reset, 228 .reset = ael1006_reset,
235 .intr_enable = t3_phy_lasi_intr_enable, 229 .intr_enable = t3_phy_lasi_intr_enable,
@@ -237,7 +231,7 @@ static struct cphy_ops ael1006_ops = {
237 .intr_clear = t3_phy_lasi_intr_clear, 231 .intr_clear = t3_phy_lasi_intr_clear,
238 .intr_handler = t3_phy_lasi_intr_handler, 232 .intr_handler = t3_phy_lasi_intr_handler,
239 .get_link_status = get_link_status_r, 233 .get_link_status = get_link_status_r,
240 .power_down = ael1006_power_down, 234 .power_down = ael1002_power_down,
241 .mmds = MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS | MDIO_DEVS_PHYXS, 235 .mmds = MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS | MDIO_DEVS_PHYXS,
242}; 236};
243 237
@@ -304,279 +298,7 @@ static int ael2005_setup_sr_edc(struct cphy *phy)
304 { MDIO_MMD_PMAPMD, 0xc04a, 0xffff, 0x5200 }, 298 { MDIO_MMD_PMAPMD, 0xc04a, 0xffff, 0x5200 },
305 { 0, 0, 0, 0 } 299 { 0, 0, 0, 0 }
306 }; 300 };
307 static u16 sr_edc[] = { 301
308 0xcc00, 0x2ff4,
309 0xcc01, 0x3cd4,
310 0xcc02, 0x2015,
311 0xcc03, 0x3105,
312 0xcc04, 0x6524,
313 0xcc05, 0x27ff,
314 0xcc06, 0x300f,
315 0xcc07, 0x2c8b,
316 0xcc08, 0x300b,
317 0xcc09, 0x4009,
318 0xcc0a, 0x400e,
319 0xcc0b, 0x2f72,
320 0xcc0c, 0x3002,
321 0xcc0d, 0x1002,
322 0xcc0e, 0x2172,
323 0xcc0f, 0x3012,
324 0xcc10, 0x1002,
325 0xcc11, 0x25d2,
326 0xcc12, 0x3012,
327 0xcc13, 0x1002,
328 0xcc14, 0xd01e,
329 0xcc15, 0x27d2,
330 0xcc16, 0x3012,
331 0xcc17, 0x1002,
332 0xcc18, 0x2004,
333 0xcc19, 0x3c84,
334 0xcc1a, 0x6436,
335 0xcc1b, 0x2007,
336 0xcc1c, 0x3f87,
337 0xcc1d, 0x8676,
338 0xcc1e, 0x40b7,
339 0xcc1f, 0xa746,
340 0xcc20, 0x4047,
341 0xcc21, 0x5673,
342 0xcc22, 0x2982,
343 0xcc23, 0x3002,
344 0xcc24, 0x13d2,
345 0xcc25, 0x8bbd,
346 0xcc26, 0x2862,
347 0xcc27, 0x3012,
348 0xcc28, 0x1002,
349 0xcc29, 0x2092,
350 0xcc2a, 0x3012,
351 0xcc2b, 0x1002,
352 0xcc2c, 0x5cc3,
353 0xcc2d, 0x314,
354 0xcc2e, 0x2942,
355 0xcc2f, 0x3002,
356 0xcc30, 0x1002,
357 0xcc31, 0xd019,
358 0xcc32, 0x2032,
359 0xcc33, 0x3012,
360 0xcc34, 0x1002,
361 0xcc35, 0x2a04,
362 0xcc36, 0x3c74,
363 0xcc37, 0x6435,
364 0xcc38, 0x2fa4,
365 0xcc39, 0x3cd4,
366 0xcc3a, 0x6624,
367 0xcc3b, 0x5563,
368 0xcc3c, 0x2d42,
369 0xcc3d, 0x3002,
370 0xcc3e, 0x13d2,
371 0xcc3f, 0x464d,
372 0xcc40, 0x2862,
373 0xcc41, 0x3012,
374 0xcc42, 0x1002,
375 0xcc43, 0x2032,
376 0xcc44, 0x3012,
377 0xcc45, 0x1002,
378 0xcc46, 0x2fb4,
379 0xcc47, 0x3cd4,
380 0xcc48, 0x6624,
381 0xcc49, 0x5563,
382 0xcc4a, 0x2d42,
383 0xcc4b, 0x3002,
384 0xcc4c, 0x13d2,
385 0xcc4d, 0x2ed2,
386 0xcc4e, 0x3002,
387 0xcc4f, 0x1002,
388 0xcc50, 0x2fd2,
389 0xcc51, 0x3002,
390 0xcc52, 0x1002,
391 0xcc53, 0x004,
392 0xcc54, 0x2942,
393 0xcc55, 0x3002,
394 0xcc56, 0x1002,
395 0xcc57, 0x2092,
396 0xcc58, 0x3012,
397 0xcc59, 0x1002,
398 0xcc5a, 0x5cc3,
399 0xcc5b, 0x317,
400 0xcc5c, 0x2f72,
401 0xcc5d, 0x3002,
402 0xcc5e, 0x1002,
403 0xcc5f, 0x2942,
404 0xcc60, 0x3002,
405 0xcc61, 0x1002,
406 0xcc62, 0x22cd,
407 0xcc63, 0x301d,
408 0xcc64, 0x2862,
409 0xcc65, 0x3012,
410 0xcc66, 0x1002,
411 0xcc67, 0x2ed2,
412 0xcc68, 0x3002,
413 0xcc69, 0x1002,
414 0xcc6a, 0x2d72,
415 0xcc6b, 0x3002,
416 0xcc6c, 0x1002,
417 0xcc6d, 0x628f,
418 0xcc6e, 0x2112,
419 0xcc6f, 0x3012,
420 0xcc70, 0x1002,
421 0xcc71, 0x5aa3,
422 0xcc72, 0x2dc2,
423 0xcc73, 0x3002,
424 0xcc74, 0x1312,
425 0xcc75, 0x6f72,
426 0xcc76, 0x1002,
427 0xcc77, 0x2807,
428 0xcc78, 0x31a7,
429 0xcc79, 0x20c4,
430 0xcc7a, 0x3c24,
431 0xcc7b, 0x6724,
432 0xcc7c, 0x1002,
433 0xcc7d, 0x2807,
434 0xcc7e, 0x3187,
435 0xcc7f, 0x20c4,
436 0xcc80, 0x3c24,
437 0xcc81, 0x6724,
438 0xcc82, 0x1002,
439 0xcc83, 0x2514,
440 0xcc84, 0x3c64,
441 0xcc85, 0x6436,
442 0xcc86, 0xdff4,
443 0xcc87, 0x6436,
444 0xcc88, 0x1002,
445 0xcc89, 0x40a4,
446 0xcc8a, 0x643c,
447 0xcc8b, 0x4016,
448 0xcc8c, 0x8c6c,
449 0xcc8d, 0x2b24,
450 0xcc8e, 0x3c24,
451 0xcc8f, 0x6435,
452 0xcc90, 0x1002,
453 0xcc91, 0x2b24,
454 0xcc92, 0x3c24,
455 0xcc93, 0x643a,
456 0xcc94, 0x4025,
457 0xcc95, 0x8a5a,
458 0xcc96, 0x1002,
459 0xcc97, 0x2731,
460 0xcc98, 0x3011,
461 0xcc99, 0x1001,
462 0xcc9a, 0xc7a0,
463 0xcc9b, 0x100,
464 0xcc9c, 0xc502,
465 0xcc9d, 0x53ac,
466 0xcc9e, 0xc503,
467 0xcc9f, 0xd5d5,
468 0xcca0, 0xc600,
469 0xcca1, 0x2a6d,
470 0xcca2, 0xc601,
471 0xcca3, 0x2a4c,
472 0xcca4, 0xc602,
473 0xcca5, 0x111,
474 0xcca6, 0xc60c,
475 0xcca7, 0x5900,
476 0xcca8, 0xc710,
477 0xcca9, 0x700,
478 0xccaa, 0xc718,
479 0xccab, 0x700,
480 0xccac, 0xc720,
481 0xccad, 0x4700,
482 0xccae, 0xc801,
483 0xccaf, 0x7f50,
484 0xccb0, 0xc802,
485 0xccb1, 0x7760,
486 0xccb2, 0xc803,
487 0xccb3, 0x7fce,
488 0xccb4, 0xc804,
489 0xccb5, 0x5700,
490 0xccb6, 0xc805,
491 0xccb7, 0x5f11,
492 0xccb8, 0xc806,
493 0xccb9, 0x4751,
494 0xccba, 0xc807,
495 0xccbb, 0x57e1,
496 0xccbc, 0xc808,
497 0xccbd, 0x2700,
498 0xccbe, 0xc809,
499 0xccbf, 0x000,
500 0xccc0, 0xc821,
501 0xccc1, 0x002,
502 0xccc2, 0xc822,
503 0xccc3, 0x014,
504 0xccc4, 0xc832,
505 0xccc5, 0x1186,
506 0xccc6, 0xc847,
507 0xccc7, 0x1e02,
508 0xccc8, 0xc013,
509 0xccc9, 0xf341,
510 0xccca, 0xc01a,
511 0xcccb, 0x446,
512 0xcccc, 0xc024,
513 0xcccd, 0x1000,
514 0xccce, 0xc025,
515 0xcccf, 0xa00,
516 0xccd0, 0xc026,
517 0xccd1, 0xc0c,
518 0xccd2, 0xc027,
519 0xccd3, 0xc0c,
520 0xccd4, 0xc029,
521 0xccd5, 0x0a0,
522 0xccd6, 0xc030,
523 0xccd7, 0xa00,
524 0xccd8, 0xc03c,
525 0xccd9, 0x01c,
526 0xccda, 0xc005,
527 0xccdb, 0x7a06,
528 0xccdc, 0x000,
529 0xccdd, 0x2731,
530 0xccde, 0x3011,
531 0xccdf, 0x1001,
532 0xcce0, 0xc620,
533 0xcce1, 0x000,
534 0xcce2, 0xc621,
535 0xcce3, 0x03f,
536 0xcce4, 0xc622,
537 0xcce5, 0x000,
538 0xcce6, 0xc623,
539 0xcce7, 0x000,
540 0xcce8, 0xc624,
541 0xcce9, 0x000,
542 0xccea, 0xc625,
543 0xcceb, 0x000,
544 0xccec, 0xc627,
545 0xcced, 0x000,
546 0xccee, 0xc628,
547 0xccef, 0x000,
548 0xccf0, 0xc62c,
549 0xccf1, 0x000,
550 0xccf2, 0x000,
551 0xccf3, 0x2806,
552 0xccf4, 0x3cb6,
553 0xccf5, 0xc161,
554 0xccf6, 0x6134,
555 0xccf7, 0x6135,
556 0xccf8, 0x5443,
557 0xccf9, 0x303,
558 0xccfa, 0x6524,
559 0xccfb, 0x00b,
560 0xccfc, 0x1002,
561 0xccfd, 0x2104,
562 0xccfe, 0x3c24,
563 0xccff, 0x2105,
564 0xcd00, 0x3805,
565 0xcd01, 0x6524,
566 0xcd02, 0xdff4,
567 0xcd03, 0x4005,
568 0xcd04, 0x6524,
569 0xcd05, 0x1002,
570 0xcd06, 0x5dd3,
571 0xcd07, 0x306,
572 0xcd08, 0x2ff7,
573 0xcd09, 0x38f7,
574 0xcd0a, 0x60b7,
575 0xcd0b, 0xdffd,
576 0xcd0c, 0x00a,
577 0xcd0d, 0x1002,
578 0xcd0e, 0
579 };
580 int i, err; 302 int i, err;
581 303
582 err = set_phy_regs(phy, regs); 304 err = set_phy_regs(phy, regs);
@@ -585,9 +307,16 @@ static int ael2005_setup_sr_edc(struct cphy *phy)
585 307
586 msleep(50); 308 msleep(50);
587 309
588 for (i = 0; i < ARRAY_SIZE(sr_edc) && !err; i += 2) 310 if (phy->priv != edc_sr)
589 err = t3_mdio_write(phy, MDIO_MMD_PMAPMD, sr_edc[i], 311 err = t3_get_edc_fw(phy, EDC_OPT_AEL2005,
590 sr_edc[i + 1]); 312 EDC_OPT_AEL2005_SIZE);
313 if (err)
314 return err;
315
316 for (i = 0; i < EDC_OPT_AEL2005_SIZE / sizeof(u16) && !err; i += 2)
317 err = t3_mdio_write(phy, MDIO_MMD_PMAPMD,
318 phy->phy_cache[i],
319 phy->phy_cache[i + 1]);
591 if (!err) 320 if (!err)
592 phy->priv = edc_sr; 321 phy->priv = edc_sr;
593 return err; 322 return err;
@@ -604,374 +333,6 @@ static int ael2005_setup_twinax_edc(struct cphy *phy, int modtype)
604 { MDIO_MMD_PMAPMD, 0xc015, 0xffff, 0xa000 }, 333 { MDIO_MMD_PMAPMD, 0xc015, 0xffff, 0xa000 },
605 { 0, 0, 0, 0 } 334 { 0, 0, 0, 0 }
606 }; 335 };
607 static u16 twinax_edc[] = {
608 0xcc00, 0x4009,
609 0xcc01, 0x27ff,
610 0xcc02, 0x300f,
611 0xcc03, 0x40aa,
612 0xcc04, 0x401c,
613 0xcc05, 0x401e,
614 0xcc06, 0x2ff4,
615 0xcc07, 0x3cd4,
616 0xcc08, 0x2035,
617 0xcc09, 0x3145,
618 0xcc0a, 0x6524,
619 0xcc0b, 0x26a2,
620 0xcc0c, 0x3012,
621 0xcc0d, 0x1002,
622 0xcc0e, 0x29c2,
623 0xcc0f, 0x3002,
624 0xcc10, 0x1002,
625 0xcc11, 0x2072,
626 0xcc12, 0x3012,
627 0xcc13, 0x1002,
628 0xcc14, 0x22cd,
629 0xcc15, 0x301d,
630 0xcc16, 0x2e52,
631 0xcc17, 0x3012,
632 0xcc18, 0x1002,
633 0xcc19, 0x28e2,
634 0xcc1a, 0x3002,
635 0xcc1b, 0x1002,
636 0xcc1c, 0x628f,
637 0xcc1d, 0x2ac2,
638 0xcc1e, 0x3012,
639 0xcc1f, 0x1002,
640 0xcc20, 0x5553,
641 0xcc21, 0x2ae2,
642 0xcc22, 0x3002,
643 0xcc23, 0x1302,
644 0xcc24, 0x401e,
645 0xcc25, 0x2be2,
646 0xcc26, 0x3012,
647 0xcc27, 0x1002,
648 0xcc28, 0x2da2,
649 0xcc29, 0x3012,
650 0xcc2a, 0x1002,
651 0xcc2b, 0x2ba2,
652 0xcc2c, 0x3002,
653 0xcc2d, 0x1002,
654 0xcc2e, 0x5ee3,
655 0xcc2f, 0x305,
656 0xcc30, 0x400e,
657 0xcc31, 0x2bc2,
658 0xcc32, 0x3002,
659 0xcc33, 0x1002,
660 0xcc34, 0x2b82,
661 0xcc35, 0x3012,
662 0xcc36, 0x1002,
663 0xcc37, 0x5663,
664 0xcc38, 0x302,
665 0xcc39, 0x401e,
666 0xcc3a, 0x6f72,
667 0xcc3b, 0x1002,
668 0xcc3c, 0x628f,
669 0xcc3d, 0x2be2,
670 0xcc3e, 0x3012,
671 0xcc3f, 0x1002,
672 0xcc40, 0x22cd,
673 0xcc41, 0x301d,
674 0xcc42, 0x2e52,
675 0xcc43, 0x3012,
676 0xcc44, 0x1002,
677 0xcc45, 0x2522,
678 0xcc46, 0x3012,
679 0xcc47, 0x1002,
680 0xcc48, 0x2da2,
681 0xcc49, 0x3012,
682 0xcc4a, 0x1002,
683 0xcc4b, 0x2ca2,
684 0xcc4c, 0x3012,
685 0xcc4d, 0x1002,
686 0xcc4e, 0x2fa4,
687 0xcc4f, 0x3cd4,
688 0xcc50, 0x6624,
689 0xcc51, 0x410b,
690 0xcc52, 0x56b3,
691 0xcc53, 0x3c4,
692 0xcc54, 0x2fb2,
693 0xcc55, 0x3002,
694 0xcc56, 0x1002,
695 0xcc57, 0x220b,
696 0xcc58, 0x303b,
697 0xcc59, 0x56b3,
698 0xcc5a, 0x3c3,
699 0xcc5b, 0x866b,
700 0xcc5c, 0x400c,
701 0xcc5d, 0x23a2,
702 0xcc5e, 0x3012,
703 0xcc5f, 0x1002,
704 0xcc60, 0x2da2,
705 0xcc61, 0x3012,
706 0xcc62, 0x1002,
707 0xcc63, 0x2ca2,
708 0xcc64, 0x3012,
709 0xcc65, 0x1002,
710 0xcc66, 0x2fb4,
711 0xcc67, 0x3cd4,
712 0xcc68, 0x6624,
713 0xcc69, 0x56b3,
714 0xcc6a, 0x3c3,
715 0xcc6b, 0x866b,
716 0xcc6c, 0x401c,
717 0xcc6d, 0x2205,
718 0xcc6e, 0x3035,
719 0xcc6f, 0x5b53,
720 0xcc70, 0x2c52,
721 0xcc71, 0x3002,
722 0xcc72, 0x13c2,
723 0xcc73, 0x5cc3,
724 0xcc74, 0x317,
725 0xcc75, 0x2522,
726 0xcc76, 0x3012,
727 0xcc77, 0x1002,
728 0xcc78, 0x2da2,
729 0xcc79, 0x3012,
730 0xcc7a, 0x1002,
731 0xcc7b, 0x2b82,
732 0xcc7c, 0x3012,
733 0xcc7d, 0x1002,
734 0xcc7e, 0x5663,
735 0xcc7f, 0x303,
736 0xcc80, 0x401e,
737 0xcc81, 0x004,
738 0xcc82, 0x2c42,
739 0xcc83, 0x3012,
740 0xcc84, 0x1002,
741 0xcc85, 0x6f72,
742 0xcc86, 0x1002,
743 0xcc87, 0x628f,
744 0xcc88, 0x2304,
745 0xcc89, 0x3c84,
746 0xcc8a, 0x6436,
747 0xcc8b, 0xdff4,
748 0xcc8c, 0x6436,
749 0xcc8d, 0x2ff5,
750 0xcc8e, 0x3005,
751 0xcc8f, 0x8656,
752 0xcc90, 0xdfba,
753 0xcc91, 0x56a3,
754 0xcc92, 0xd05a,
755 0xcc93, 0x21c2,
756 0xcc94, 0x3012,
757 0xcc95, 0x1392,
758 0xcc96, 0xd05a,
759 0xcc97, 0x56a3,
760 0xcc98, 0xdfba,
761 0xcc99, 0x383,
762 0xcc9a, 0x6f72,
763 0xcc9b, 0x1002,
764 0xcc9c, 0x28c5,
765 0xcc9d, 0x3005,
766 0xcc9e, 0x4178,
767 0xcc9f, 0x5653,
768 0xcca0, 0x384,
769 0xcca1, 0x22b2,
770 0xcca2, 0x3012,
771 0xcca3, 0x1002,
772 0xcca4, 0x2be5,
773 0xcca5, 0x3005,
774 0xcca6, 0x41e8,
775 0xcca7, 0x5653,
776 0xcca8, 0x382,
777 0xcca9, 0x002,
778 0xccaa, 0x4258,
779 0xccab, 0x2474,
780 0xccac, 0x3c84,
781 0xccad, 0x6437,
782 0xccae, 0xdff4,
783 0xccaf, 0x6437,
784 0xccb0, 0x2ff5,
785 0xccb1, 0x3c05,
786 0xccb2, 0x8757,
787 0xccb3, 0xb888,
788 0xccb4, 0x9787,
789 0xccb5, 0xdff4,
790 0xccb6, 0x6724,
791 0xccb7, 0x866a,
792 0xccb8, 0x6f72,
793 0xccb9, 0x1002,
794 0xccba, 0x2d01,
795 0xccbb, 0x3011,
796 0xccbc, 0x1001,
797 0xccbd, 0xc620,
798 0xccbe, 0x14e5,
799 0xccbf, 0xc621,
800 0xccc0, 0xc53d,
801 0xccc1, 0xc622,
802 0xccc2, 0x3cbe,
803 0xccc3, 0xc623,
804 0xccc4, 0x4452,
805 0xccc5, 0xc624,
806 0xccc6, 0xc5c5,
807 0xccc7, 0xc625,
808 0xccc8, 0xe01e,
809 0xccc9, 0xc627,
810 0xccca, 0x000,
811 0xcccb, 0xc628,
812 0xcccc, 0x000,
813 0xcccd, 0xc62b,
814 0xccce, 0x000,
815 0xcccf, 0xc62c,
816 0xccd0, 0x000,
817 0xccd1, 0x000,
818 0xccd2, 0x2d01,
819 0xccd3, 0x3011,
820 0xccd4, 0x1001,
821 0xccd5, 0xc620,
822 0xccd6, 0x000,
823 0xccd7, 0xc621,
824 0xccd8, 0x000,
825 0xccd9, 0xc622,
826 0xccda, 0x0ce,
827 0xccdb, 0xc623,
828 0xccdc, 0x07f,
829 0xccdd, 0xc624,
830 0xccde, 0x032,
831 0xccdf, 0xc625,
832 0xcce0, 0x000,
833 0xcce1, 0xc627,
834 0xcce2, 0x000,
835 0xcce3, 0xc628,
836 0xcce4, 0x000,
837 0xcce5, 0xc62b,
838 0xcce6, 0x000,
839 0xcce7, 0xc62c,
840 0xcce8, 0x000,
841 0xcce9, 0x000,
842 0xccea, 0x2d01,
843 0xcceb, 0x3011,
844 0xccec, 0x1001,
845 0xcced, 0xc502,
846 0xccee, 0x609f,
847 0xccef, 0xc600,
848 0xccf0, 0x2a6e,
849 0xccf1, 0xc601,
850 0xccf2, 0x2a2c,
851 0xccf3, 0xc60c,
852 0xccf4, 0x5400,
853 0xccf5, 0xc710,
854 0xccf6, 0x700,
855 0xccf7, 0xc718,
856 0xccf8, 0x700,
857 0xccf9, 0xc720,
858 0xccfa, 0x4700,
859 0xccfb, 0xc728,
860 0xccfc, 0x700,
861 0xccfd, 0xc729,
862 0xccfe, 0x1207,
863 0xccff, 0xc801,
864 0xcd00, 0x7f50,
865 0xcd01, 0xc802,
866 0xcd02, 0x7760,
867 0xcd03, 0xc803,
868 0xcd04, 0x7fce,
869 0xcd05, 0xc804,
870 0xcd06, 0x520e,
871 0xcd07, 0xc805,
872 0xcd08, 0x5c11,
873 0xcd09, 0xc806,
874 0xcd0a, 0x3c51,
875 0xcd0b, 0xc807,
876 0xcd0c, 0x4061,
877 0xcd0d, 0xc808,
878 0xcd0e, 0x49c1,
879 0xcd0f, 0xc809,
880 0xcd10, 0x3840,
881 0xcd11, 0xc80a,
882 0xcd12, 0x000,
883 0xcd13, 0xc821,
884 0xcd14, 0x002,
885 0xcd15, 0xc822,
886 0xcd16, 0x046,
887 0xcd17, 0xc844,
888 0xcd18, 0x182f,
889 0xcd19, 0xc013,
890 0xcd1a, 0xf341,
891 0xcd1b, 0xc01a,
892 0xcd1c, 0x446,
893 0xcd1d, 0xc024,
894 0xcd1e, 0x1000,
895 0xcd1f, 0xc025,
896 0xcd20, 0xa00,
897 0xcd21, 0xc026,
898 0xcd22, 0xc0c,
899 0xcd23, 0xc027,
900 0xcd24, 0xc0c,
901 0xcd25, 0xc029,
902 0xcd26, 0x0a0,
903 0xcd27, 0xc030,
904 0xcd28, 0xa00,
905 0xcd29, 0xc03c,
906 0xcd2a, 0x01c,
907 0xcd2b, 0x000,
908 0xcd2c, 0x2b84,
909 0xcd2d, 0x3c74,
910 0xcd2e, 0x6435,
911 0xcd2f, 0xdff4,
912 0xcd30, 0x6435,
913 0xcd31, 0x2806,
914 0xcd32, 0x3006,
915 0xcd33, 0x8565,
916 0xcd34, 0x2b24,
917 0xcd35, 0x3c24,
918 0xcd36, 0x6436,
919 0xcd37, 0x1002,
920 0xcd38, 0x2b24,
921 0xcd39, 0x3c24,
922 0xcd3a, 0x6436,
923 0xcd3b, 0x4045,
924 0xcd3c, 0x8656,
925 0xcd3d, 0x1002,
926 0xcd3e, 0x2807,
927 0xcd3f, 0x31a7,
928 0xcd40, 0x20c4,
929 0xcd41, 0x3c24,
930 0xcd42, 0x6724,
931 0xcd43, 0x1002,
932 0xcd44, 0x2807,
933 0xcd45, 0x3187,
934 0xcd46, 0x20c4,
935 0xcd47, 0x3c24,
936 0xcd48, 0x6724,
937 0xcd49, 0x1002,
938 0xcd4a, 0x2514,
939 0xcd4b, 0x3c64,
940 0xcd4c, 0x6436,
941 0xcd4d, 0xdff4,
942 0xcd4e, 0x6436,
943 0xcd4f, 0x1002,
944 0xcd50, 0x2806,
945 0xcd51, 0x3cb6,
946 0xcd52, 0xc161,
947 0xcd53, 0x6134,
948 0xcd54, 0x6135,
949 0xcd55, 0x5443,
950 0xcd56, 0x303,
951 0xcd57, 0x6524,
952 0xcd58, 0x00b,
953 0xcd59, 0x1002,
954 0xcd5a, 0xd019,
955 0xcd5b, 0x2104,
956 0xcd5c, 0x3c24,
957 0xcd5d, 0x2105,
958 0xcd5e, 0x3805,
959 0xcd5f, 0x6524,
960 0xcd60, 0xdff4,
961 0xcd61, 0x4005,
962 0xcd62, 0x6524,
963 0xcd63, 0x2e8d,
964 0xcd64, 0x303d,
965 0xcd65, 0x5dd3,
966 0xcd66, 0x306,
967 0xcd67, 0x2ff7,
968 0xcd68, 0x38f7,
969 0xcd69, 0x60b7,
970 0xcd6a, 0xdffd,
971 0xcd6b, 0x00a,
972 0xcd6c, 0x1002,
973 0xcd6d, 0
974 };
975 int i, err; 336 int i, err;
976 337
977 err = set_phy_regs(phy, regs); 338 err = set_phy_regs(phy, regs);
@@ -982,9 +343,16 @@ static int ael2005_setup_twinax_edc(struct cphy *phy, int modtype)
982 343
983 msleep(50); 344 msleep(50);
984 345
985 for (i = 0; i < ARRAY_SIZE(twinax_edc) && !err; i += 2) 346 if (phy->priv != edc_twinax)
986 err = t3_mdio_write(phy, MDIO_MMD_PMAPMD, twinax_edc[i], 347 err = t3_get_edc_fw(phy, EDC_TWX_AEL2005,
987 twinax_edc[i + 1]); 348 EDC_TWX_AEL2005_SIZE);
349 if (err)
350 return err;
351
352 for (i = 0; i < EDC_TWX_AEL2005_SIZE / sizeof(u16) && !err; i += 2)
353 err = t3_mdio_write(phy, MDIO_MMD_PMAPMD,
354 phy->phy_cache[i],
355 phy->phy_cache[i + 1]);
988 if (!err) 356 if (!err)
989 phy->priv = edc_twinax; 357 phy->priv = edc_twinax;
990 return err; 358 return err;
@@ -1201,405 +569,6 @@ static int ael2020_setup_twinax_edc(struct cphy *phy, int modtype)
1201 { MDIO_MMD_PMAPMD, 0xd092, 0xffff, 0x0000 }, 569 { MDIO_MMD_PMAPMD, 0xd092, 0xffff, 0x0000 },
1202 { 0, 0, 0, 0 } 570 { 0, 0, 0, 0 }
1203 }; 571 };
1204
1205 /* TWINAX EDC firmware */
1206 static u16 twinax_edc[] = {
1207 0xd800, 0x4009,
1208 0xd801, 0x2fff,
1209 0xd802, 0x300f,
1210 0xd803, 0x40aa,
1211 0xd804, 0x401c,
1212 0xd805, 0x401e,
1213 0xd806, 0x2ff4,
1214 0xd807, 0x3dc4,
1215 0xd808, 0x2035,
1216 0xd809, 0x3035,
1217 0xd80a, 0x6524,
1218 0xd80b, 0x2cb2,
1219 0xd80c, 0x3012,
1220 0xd80d, 0x1002,
1221 0xd80e, 0x26e2,
1222 0xd80f, 0x3022,
1223 0xd810, 0x1002,
1224 0xd811, 0x27d2,
1225 0xd812, 0x3022,
1226 0xd813, 0x1002,
1227 0xd814, 0x2822,
1228 0xd815, 0x3012,
1229 0xd816, 0x1002,
1230 0xd817, 0x2492,
1231 0xd818, 0x3022,
1232 0xd819, 0x1002,
1233 0xd81a, 0x2772,
1234 0xd81b, 0x3012,
1235 0xd81c, 0x1002,
1236 0xd81d, 0x23d2,
1237 0xd81e, 0x3022,
1238 0xd81f, 0x1002,
1239 0xd820, 0x22cd,
1240 0xd821, 0x301d,
1241 0xd822, 0x27f2,
1242 0xd823, 0x3022,
1243 0xd824, 0x1002,
1244 0xd825, 0x5553,
1245 0xd826, 0x0307,
1246 0xd827, 0x2522,
1247 0xd828, 0x3022,
1248 0xd829, 0x1002,
1249 0xd82a, 0x2142,
1250 0xd82b, 0x3012,
1251 0xd82c, 0x1002,
1252 0xd82d, 0x4016,
1253 0xd82e, 0x5e63,
1254 0xd82f, 0x0344,
1255 0xd830, 0x2142,
1256 0xd831, 0x3012,
1257 0xd832, 0x1002,
1258 0xd833, 0x400e,
1259 0xd834, 0x2522,
1260 0xd835, 0x3022,
1261 0xd836, 0x1002,
1262 0xd837, 0x2b52,
1263 0xd838, 0x3012,
1264 0xd839, 0x1002,
1265 0xd83a, 0x2742,
1266 0xd83b, 0x3022,
1267 0xd83c, 0x1002,
1268 0xd83d, 0x25e2,
1269 0xd83e, 0x3022,
1270 0xd83f, 0x1002,
1271 0xd840, 0x2fa4,
1272 0xd841, 0x3dc4,
1273 0xd842, 0x6624,
1274 0xd843, 0x414b,
1275 0xd844, 0x56b3,
1276 0xd845, 0x03c6,
1277 0xd846, 0x866b,
1278 0xd847, 0x400c,
1279 0xd848, 0x2712,
1280 0xd849, 0x3012,
1281 0xd84a, 0x1002,
1282 0xd84b, 0x2c4b,
1283 0xd84c, 0x309b,
1284 0xd84d, 0x56b3,
1285 0xd84e, 0x03c3,
1286 0xd84f, 0x866b,
1287 0xd850, 0x400c,
1288 0xd851, 0x2272,
1289 0xd852, 0x3022,
1290 0xd853, 0x1002,
1291 0xd854, 0x2742,
1292 0xd855, 0x3022,
1293 0xd856, 0x1002,
1294 0xd857, 0x25e2,
1295 0xd858, 0x3022,
1296 0xd859, 0x1002,
1297 0xd85a, 0x2fb4,
1298 0xd85b, 0x3dc4,
1299 0xd85c, 0x6624,
1300 0xd85d, 0x56b3,
1301 0xd85e, 0x03c3,
1302 0xd85f, 0x866b,
1303 0xd860, 0x401c,
1304 0xd861, 0x2c45,
1305 0xd862, 0x3095,
1306 0xd863, 0x5b53,
1307 0xd864, 0x2372,
1308 0xd865, 0x3012,
1309 0xd866, 0x13c2,
1310 0xd867, 0x5cc3,
1311 0xd868, 0x2712,
1312 0xd869, 0x3012,
1313 0xd86a, 0x1312,
1314 0xd86b, 0x2b52,
1315 0xd86c, 0x3012,
1316 0xd86d, 0x1002,
1317 0xd86e, 0x2742,
1318 0xd86f, 0x3022,
1319 0xd870, 0x1002,
1320 0xd871, 0x2582,
1321 0xd872, 0x3022,
1322 0xd873, 0x1002,
1323 0xd874, 0x2142,
1324 0xd875, 0x3012,
1325 0xd876, 0x1002,
1326 0xd877, 0x628f,
1327 0xd878, 0x2985,
1328 0xd879, 0x33a5,
1329 0xd87a, 0x25e2,
1330 0xd87b, 0x3022,
1331 0xd87c, 0x1002,
1332 0xd87d, 0x5653,
1333 0xd87e, 0x03d2,
1334 0xd87f, 0x401e,
1335 0xd880, 0x6f72,
1336 0xd881, 0x1002,
1337 0xd882, 0x628f,
1338 0xd883, 0x2304,
1339 0xd884, 0x3c84,
1340 0xd885, 0x6436,
1341 0xd886, 0xdff4,
1342 0xd887, 0x6436,
1343 0xd888, 0x2ff5,
1344 0xd889, 0x3005,
1345 0xd88a, 0x8656,
1346 0xd88b, 0xdfba,
1347 0xd88c, 0x56a3,
1348 0xd88d, 0xd05a,
1349 0xd88e, 0x2972,
1350 0xd88f, 0x3012,
1351 0xd890, 0x1392,
1352 0xd891, 0xd05a,
1353 0xd892, 0x56a3,
1354 0xd893, 0xdfba,
1355 0xd894, 0x0383,
1356 0xd895, 0x6f72,
1357 0xd896, 0x1002,
1358 0xd897, 0x2b45,
1359 0xd898, 0x3005,
1360 0xd899, 0x4178,
1361 0xd89a, 0x5653,
1362 0xd89b, 0x0384,
1363 0xd89c, 0x2a62,
1364 0xd89d, 0x3012,
1365 0xd89e, 0x1002,
1366 0xd89f, 0x2f05,
1367 0xd8a0, 0x3005,
1368 0xd8a1, 0x41c8,
1369 0xd8a2, 0x5653,
1370 0xd8a3, 0x0382,
1371 0xd8a4, 0x0002,
1372 0xd8a5, 0x4218,
1373 0xd8a6, 0x2474,
1374 0xd8a7, 0x3c84,
1375 0xd8a8, 0x6437,
1376 0xd8a9, 0xdff4,
1377 0xd8aa, 0x6437,
1378 0xd8ab, 0x2ff5,
1379 0xd8ac, 0x3c05,
1380 0xd8ad, 0x8757,
1381 0xd8ae, 0xb888,
1382 0xd8af, 0x9787,
1383 0xd8b0, 0xdff4,
1384 0xd8b1, 0x6724,
1385 0xd8b2, 0x866a,
1386 0xd8b3, 0x6f72,
1387 0xd8b4, 0x1002,
1388 0xd8b5, 0x2641,
1389 0xd8b6, 0x3021,
1390 0xd8b7, 0x1001,
1391 0xd8b8, 0xc620,
1392 0xd8b9, 0x0000,
1393 0xd8ba, 0xc621,
1394 0xd8bb, 0x0000,
1395 0xd8bc, 0xc622,
1396 0xd8bd, 0x00ce,
1397 0xd8be, 0xc623,
1398 0xd8bf, 0x007f,
1399 0xd8c0, 0xc624,
1400 0xd8c1, 0x0032,
1401 0xd8c2, 0xc625,
1402 0xd8c3, 0x0000,
1403 0xd8c4, 0xc627,
1404 0xd8c5, 0x0000,
1405 0xd8c6, 0xc628,
1406 0xd8c7, 0x0000,
1407 0xd8c8, 0xc62c,
1408 0xd8c9, 0x0000,
1409 0xd8ca, 0x0000,
1410 0xd8cb, 0x2641,
1411 0xd8cc, 0x3021,
1412 0xd8cd, 0x1001,
1413 0xd8ce, 0xc502,
1414 0xd8cf, 0x53ac,
1415 0xd8d0, 0xc503,
1416 0xd8d1, 0x2cd3,
1417 0xd8d2, 0xc600,
1418 0xd8d3, 0x2a6e,
1419 0xd8d4, 0xc601,
1420 0xd8d5, 0x2a2c,
1421 0xd8d6, 0xc605,
1422 0xd8d7, 0x5557,
1423 0xd8d8, 0xc60c,
1424 0xd8d9, 0x5400,
1425 0xd8da, 0xc710,
1426 0xd8db, 0x0700,
1427 0xd8dc, 0xc711,
1428 0xd8dd, 0x0f06,
1429 0xd8de, 0xc718,
1430 0xd8df, 0x0700,
1431 0xd8e0, 0xc719,
1432 0xd8e1, 0x0f06,
1433 0xd8e2, 0xc720,
1434 0xd8e3, 0x4700,
1435 0xd8e4, 0xc721,
1436 0xd8e5, 0x0f06,
1437 0xd8e6, 0xc728,
1438 0xd8e7, 0x0700,
1439 0xd8e8, 0xc729,
1440 0xd8e9, 0x1207,
1441 0xd8ea, 0xc801,
1442 0xd8eb, 0x7f50,
1443 0xd8ec, 0xc802,
1444 0xd8ed, 0x7760,
1445 0xd8ee, 0xc803,
1446 0xd8ef, 0x7fce,
1447 0xd8f0, 0xc804,
1448 0xd8f1, 0x520e,
1449 0xd8f2, 0xc805,
1450 0xd8f3, 0x5c11,
1451 0xd8f4, 0xc806,
1452 0xd8f5, 0x3c51,
1453 0xd8f6, 0xc807,
1454 0xd8f7, 0x4061,
1455 0xd8f8, 0xc808,
1456 0xd8f9, 0x49c1,
1457 0xd8fa, 0xc809,
1458 0xd8fb, 0x3840,
1459 0xd8fc, 0xc80a,
1460 0xd8fd, 0x0000,
1461 0xd8fe, 0xc821,
1462 0xd8ff, 0x0002,
1463 0xd900, 0xc822,
1464 0xd901, 0x0046,
1465 0xd902, 0xc844,
1466 0xd903, 0x182f,
1467 0xd904, 0xc013,
1468 0xd905, 0xf341,
1469 0xd906, 0xc084,
1470 0xd907, 0x0030,
1471 0xd908, 0xc904,
1472 0xd909, 0x1401,
1473 0xd90a, 0xcb0c,
1474 0xd90b, 0x0004,
1475 0xd90c, 0xcb0e,
1476 0xd90d, 0xa00a,
1477 0xd90e, 0xcb0f,
1478 0xd90f, 0xc0c0,
1479 0xd910, 0xcb10,
1480 0xd911, 0xc0c0,
1481 0xd912, 0xcb11,
1482 0xd913, 0x00a0,
1483 0xd914, 0xcb12,
1484 0xd915, 0x0007,
1485 0xd916, 0xc241,
1486 0xd917, 0xa000,
1487 0xd918, 0xc243,
1488 0xd919, 0x7fe0,
1489 0xd91a, 0xc604,
1490 0xd91b, 0x000e,
1491 0xd91c, 0xc609,
1492 0xd91d, 0x00f5,
1493 0xd91e, 0xc611,
1494 0xd91f, 0x000e,
1495 0xd920, 0xc660,
1496 0xd921, 0x9600,
1497 0xd922, 0xc687,
1498 0xd923, 0x0004,
1499 0xd924, 0xc60a,
1500 0xd925, 0x04f5,
1501 0xd926, 0x0000,
1502 0xd927, 0x2641,
1503 0xd928, 0x3021,
1504 0xd929, 0x1001,
1505 0xd92a, 0xc620,
1506 0xd92b, 0x14e5,
1507 0xd92c, 0xc621,
1508 0xd92d, 0xc53d,
1509 0xd92e, 0xc622,
1510 0xd92f, 0x3cbe,
1511 0xd930, 0xc623,
1512 0xd931, 0x4452,
1513 0xd932, 0xc624,
1514 0xd933, 0xc5c5,
1515 0xd934, 0xc625,
1516 0xd935, 0xe01e,
1517 0xd936, 0xc627,
1518 0xd937, 0x0000,
1519 0xd938, 0xc628,
1520 0xd939, 0x0000,
1521 0xd93a, 0xc62c,
1522 0xd93b, 0x0000,
1523 0xd93c, 0x0000,
1524 0xd93d, 0x2b84,
1525 0xd93e, 0x3c74,
1526 0xd93f, 0x6435,
1527 0xd940, 0xdff4,
1528 0xd941, 0x6435,
1529 0xd942, 0x2806,
1530 0xd943, 0x3006,
1531 0xd944, 0x8565,
1532 0xd945, 0x2b24,
1533 0xd946, 0x3c24,
1534 0xd947, 0x6436,
1535 0xd948, 0x1002,
1536 0xd949, 0x2b24,
1537 0xd94a, 0x3c24,
1538 0xd94b, 0x6436,
1539 0xd94c, 0x4045,
1540 0xd94d, 0x8656,
1541 0xd94e, 0x5663,
1542 0xd94f, 0x0302,
1543 0xd950, 0x401e,
1544 0xd951, 0x1002,
1545 0xd952, 0x2807,
1546 0xd953, 0x31a7,
1547 0xd954, 0x20c4,
1548 0xd955, 0x3c24,
1549 0xd956, 0x6724,
1550 0xd957, 0x1002,
1551 0xd958, 0x2807,
1552 0xd959, 0x3187,
1553 0xd95a, 0x20c4,
1554 0xd95b, 0x3c24,
1555 0xd95c, 0x6724,
1556 0xd95d, 0x1002,
1557 0xd95e, 0x24f4,
1558 0xd95f, 0x3c64,
1559 0xd960, 0x6436,
1560 0xd961, 0xdff4,
1561 0xd962, 0x6436,
1562 0xd963, 0x1002,
1563 0xd964, 0x2006,
1564 0xd965, 0x3d76,
1565 0xd966, 0xc161,
1566 0xd967, 0x6134,
1567 0xd968, 0x6135,
1568 0xd969, 0x5443,
1569 0xd96a, 0x0303,
1570 0xd96b, 0x6524,
1571 0xd96c, 0x00fb,
1572 0xd96d, 0x1002,
1573 0xd96e, 0x20d4,
1574 0xd96f, 0x3c24,
1575 0xd970, 0x2025,
1576 0xd971, 0x3005,
1577 0xd972, 0x6524,
1578 0xd973, 0x1002,
1579 0xd974, 0xd019,
1580 0xd975, 0x2104,
1581 0xd976, 0x3c24,
1582 0xd977, 0x2105,
1583 0xd978, 0x3805,
1584 0xd979, 0x6524,
1585 0xd97a, 0xdff4,
1586 0xd97b, 0x4005,
1587 0xd97c, 0x6524,
1588 0xd97d, 0x2e8d,
1589 0xd97e, 0x303d,
1590 0xd97f, 0x2408,
1591 0xd980, 0x35d8,
1592 0xd981, 0x5dd3,
1593 0xd982, 0x0307,
1594 0xd983, 0x8887,
1595 0xd984, 0x63a7,
1596 0xd985, 0x8887,
1597 0xd986, 0x63a7,
1598 0xd987, 0xdffd,
1599 0xd988, 0x00f9,
1600 0xd989, 0x1002,
1601 0xd98a, 0x0000,
1602 };
1603 int i, err; 572 int i, err;
1604 573
1605 /* set uC clock and activate it */ 574 /* set uC clock and activate it */
@@ -1612,10 +581,16 @@ static int ael2020_setup_twinax_edc(struct cphy *phy, int modtype)
1612 if (err) 581 if (err)
1613 return err; 582 return err;
1614 583
1615 /* write TWINAX EDC firmware into PHY */ 584 if (phy->priv != edc_twinax)
1616 for (i = 0; i < ARRAY_SIZE(twinax_edc) && !err; i += 2) 585 err = t3_get_edc_fw(phy, EDC_TWX_AEL2020,
1617 err = t3_mdio_write(phy, MDIO_MMD_PMAPMD, twinax_edc[i], 586 EDC_TWX_AEL2020_SIZE);
1618 twinax_edc[i + 1]); 587 if (err)
588 return err;
589
590 for (i = 0; i < EDC_TWX_AEL2020_SIZE / sizeof(u16) && !err; i += 2)
591 err = t3_mdio_write(phy, MDIO_MMD_PMAPMD,
592 phy->phy_cache[i],
593 phy->phy_cache[i + 1]);
1619 /* activate uC */ 594 /* activate uC */
1620 err = set_phy_regs(phy, uCactivate); 595 err = set_phy_regs(phy, uCactivate);
1621 if (!err) 596 if (!err)
@@ -1649,9 +624,39 @@ static int ael2020_get_module_type(struct cphy *phy, int delay_ms)
1649 */ 624 */
1650static int ael2020_intr_enable(struct cphy *phy) 625static int ael2020_intr_enable(struct cphy *phy)
1651{ 626{
1652 int err = t3_mdio_write(phy, MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL, 627 struct reg_val regs[] = {
1653 0x2 << (AEL2020_GPIO_MODDET*4)); 628 /* output Module's Loss Of Signal (LOS) to LED */
1654 return err ? err : t3_phy_lasi_intr_enable(phy); 629 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CFG+AEL2020_GPIO_LSTAT,
630 0xffff, 0x4 },
631 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL,
632 0xffff, 0x8 << (AEL2020_GPIO_LSTAT*4) },
633
634 /* enable module detect status change interrupts */
635 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL,
636 0xffff, 0x2 << (AEL2020_GPIO_MODDET*4) },
637
638 /* end */
639 { 0, 0, 0, 0 }
640 };
641 int err, link_ok = 0;
642
643 /* set up "link status" LED and enable module change interrupts */
644 err = set_phy_regs(phy, regs);
645 if (err)
646 return err;
647
648 err = get_link_status_r(phy, &link_ok, NULL, NULL, NULL);
649 if (err)
650 return err;
651 if (link_ok)
652 t3_link_changed(phy->adapter,
653 phy2portid(phy));
654
655 err = t3_phy_lasi_intr_enable(phy);
656 if (err)
657 return err;
658
659 return 0;
1655} 660}
1656 661
1657/* 662/*
@@ -1659,9 +664,26 @@ static int ael2020_intr_enable(struct cphy *phy)
1659 */ 664 */
1660static int ael2020_intr_disable(struct cphy *phy) 665static int ael2020_intr_disable(struct cphy *phy)
1661{ 666{
1662 int err = t3_mdio_write(phy, MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL, 667 struct reg_val regs[] = {
1663 0x1 << (AEL2020_GPIO_MODDET*4)); 668 /* reset "link status" LED to "off" */
1664 return err ? err : t3_phy_lasi_intr_disable(phy); 669 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL,
670 0xffff, 0xb << (AEL2020_GPIO_LSTAT*4) },
671
672 /* disable module detect status change interrupts */
673 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL,
674 0xffff, 0x1 << (AEL2020_GPIO_MODDET*4) },
675
676 /* end */
677 { 0, 0, 0, 0 }
678 };
679 int err;
680
681 /* turn off "link status" LED and disable module change interrupts */
682 err = set_phy_regs(phy, regs);
683 if (err)
684 return err;
685
686 return t3_phy_lasi_intr_disable(phy);
1665} 687}
1666 688
1667/* 689/*
@@ -1679,31 +701,26 @@ static int ael2020_intr_clear(struct cphy *phy)
1679 return err ? err : t3_phy_lasi_intr_clear(phy); 701 return err ? err : t3_phy_lasi_intr_clear(phy);
1680} 702}
1681 703
704static struct reg_val ael2020_reset_regs[] = {
705 /* Erratum #2: CDRLOL asserted, causing PMA link down status */
706 { MDIO_MMD_PMAPMD, 0xc003, 0xffff, 0x3101 },
707
708 /* force XAUI to send LF when RX_LOS is asserted */
709 { MDIO_MMD_PMAPMD, 0xcd40, 0xffff, 0x0001 },
710
711 /* allow writes to transceiver module EEPROM on i2c bus */
712 { MDIO_MMD_PMAPMD, 0xff02, 0xffff, 0x0023 },
713 { MDIO_MMD_PMAPMD, 0xff03, 0xffff, 0x0000 },
714 { MDIO_MMD_PMAPMD, 0xff04, 0xffff, 0x0000 },
715
716 /* end */
717 { 0, 0, 0, 0 }
718};
1682/* 719/*
1683 * Reset the PHY and put it into a canonical operating state. 720 * Reset the PHY and put it into a canonical operating state.
1684 */ 721 */
1685static int ael2020_reset(struct cphy *phy, int wait) 722static int ael2020_reset(struct cphy *phy, int wait)
1686{ 723{
1687 static struct reg_val regs0[] = {
1688 /* Erratum #2: CDRLOL asserted, causing PMA link down status */
1689 { MDIO_MMD_PMAPMD, 0xc003, 0xffff, 0x3101 },
1690
1691 /* force XAUI to send LF when RX_LOS is asserted */
1692 { MDIO_MMD_PMAPMD, 0xcd40, 0xffff, 0x0001 },
1693
1694 /* RX_LOS pin is active high */
1695 { MDIO_MMD_PMAPMD, AEL_OPT_SETTINGS,
1696 0x0020, 0x0020 },
1697
1698 /* output Module's Loss Of Signal (LOS) to LED */
1699 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CFG+AEL2020_GPIO_LSTAT,
1700 0xffff, 0x0004 },
1701 { MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL,
1702 0xffff, 0x8 << (AEL2020_GPIO_LSTAT*4) },
1703
1704 /* end */
1705 { 0, 0, 0, 0 }
1706 };
1707 int err; 724 int err;
1708 unsigned int lasi_ctrl; 725 unsigned int lasi_ctrl;
1709 726
@@ -1720,7 +737,7 @@ static int ael2020_reset(struct cphy *phy, int wait)
1720 737
1721 /* basic initialization for all module types */ 738 /* basic initialization for all module types */
1722 phy->priv = edc_none; 739 phy->priv = edc_none;
1723 err = set_phy_regs(phy, regs0); 740 err = set_phy_regs(phy, ael2020_reset_regs);
1724 if (err) 741 if (err)
1725 return err; 742 return err;
1726 743
@@ -1798,10 +815,16 @@ static struct cphy_ops ael2020_ops = {
1798int t3_ael2020_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr, 815int t3_ael2020_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
1799 const struct mdio_ops *mdio_ops) 816 const struct mdio_ops *mdio_ops)
1800{ 817{
818 int err;
819
1801 cphy_init(phy, adapter, phy_addr, &ael2020_ops, mdio_ops, 820 cphy_init(phy, adapter, phy_addr, &ael2020_ops, mdio_ops,
1802 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE | 821 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE |
1803 SUPPORTED_IRQ, "10GBASE-R"); 822 SUPPORTED_IRQ, "10GBASE-R");
1804 msleep(125); 823 msleep(125);
824
825 err = set_phy_regs(phy, ael2020_reset_regs);
826 if (err)
827 return err;
1805 return 0; 828 return 0;
1806} 829}
1807 830
@@ -1840,7 +863,7 @@ static struct cphy_ops qt2045_ops = {
1840 .intr_clear = t3_phy_lasi_intr_clear, 863 .intr_clear = t3_phy_lasi_intr_clear,
1841 .intr_handler = t3_phy_lasi_intr_handler, 864 .intr_handler = t3_phy_lasi_intr_handler,
1842 .get_link_status = get_link_status_x, 865 .get_link_status = get_link_status_x,
1843 .power_down = ael1006_power_down, 866 .power_down = ael1002_power_down,
1844 .mmds = MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS | MDIO_DEVS_PHYXS, 867 .mmds = MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS | MDIO_DEVS_PHYXS,
1845}; 868};
1846 869
diff --git a/drivers/net/cxgb3/aq100x.c b/drivers/net/cxgb3/aq100x.c
index b1fd5bf836e4..341b7ef1508f 100644
--- a/drivers/net/cxgb3/aq100x.c
+++ b/drivers/net/cxgb3/aq100x.c
@@ -271,7 +271,8 @@ int t3_aq100x_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
271 271
272 cphy_init(phy, adapter, phy_addr, &aq100x_ops, mdio_ops, 272 cphy_init(phy, adapter, phy_addr, &aq100x_ops, mdio_ops,
273 SUPPORTED_1000baseT_Full | SUPPORTED_10000baseT_Full | 273 SUPPORTED_1000baseT_Full | SUPPORTED_10000baseT_Full |
274 SUPPORTED_Autoneg | SUPPORTED_AUI, "1000/10GBASE-T"); 274 SUPPORTED_TP | SUPPORTED_Autoneg | SUPPORTED_AUI,
275 "1000/10GBASE-T");
275 276
276 /* 277 /*
277 * The PHY has been out of reset ever since the system powered up. So 278 * The PHY has been out of reset ever since the system powered up. So
@@ -316,11 +317,9 @@ int t3_aq100x_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
316 317
317 /* Firmware version check. */ 318 /* Firmware version check. */
318 t3_mdio_read(phy, MDIO_MMD_VEND1, AQ_FW_VERSION, &v); 319 t3_mdio_read(phy, MDIO_MMD_VEND1, AQ_FW_VERSION, &v);
319 if (v != 30) { 320 if (v != 101)
320 CH_WARN(adapter, "PHY%d: unsupported firmware %d\n", 321 CH_WARN(adapter, "PHY%d: unsupported firmware %d\n",
321 phy_addr, v); 322 phy_addr, v);
322 return 0; /* allow t3_prep_adapter to succeed */
323 }
324 323
325 /* 324 /*
326 * The PHY should start in really-low-power mode. Prepare it for normal 325 * The PHY should start in really-low-power mode. Prepare it for normal
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index d21b705501a9..1b2c305fb82b 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -566,6 +566,15 @@ struct cphy_ops {
566 566
567 u32 mmds; 567 u32 mmds;
568}; 568};
569enum {
570 EDC_OPT_AEL2005 = 0,
571 EDC_OPT_AEL2005_SIZE = 1084,
572 EDC_TWX_AEL2005 = 1,
573 EDC_TWX_AEL2005_SIZE = 1464,
574 EDC_TWX_AEL2020 = 2,
575 EDC_TWX_AEL2020_SIZE = 1628,
576 EDC_MAX_SIZE = EDC_TWX_AEL2020_SIZE, /* Max cache size */
577};
569 578
570/* A PHY instance */ 579/* A PHY instance */
571struct cphy { 580struct cphy {
@@ -577,6 +586,7 @@ struct cphy {
577 unsigned long fifo_errors; /* FIFO over/under-flows */ 586 unsigned long fifo_errors; /* FIFO over/under-flows */
578 const struct cphy_ops *ops; /* PHY operations */ 587 const struct cphy_ops *ops; /* PHY operations */
579 struct mdio_if_info mdio; 588 struct mdio_if_info mdio;
589 u16 phy_cache[EDC_MAX_SIZE]; /* EDC cache */
580}; 590};
581 591
582/* Convenience MDIO read/write wrappers */ 592/* Convenience MDIO read/write wrappers */
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index c97ab82ec743..34e776c5f06b 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -172,6 +172,23 @@ static void link_report(struct net_device *dev)
172 } 172 }
173} 173}
174 174
175static void enable_tx_fifo_drain(struct adapter *adapter,
176 struct port_info *pi)
177{
178 t3_set_reg_field(adapter, A_XGM_TXFIFO_CFG + pi->mac.offset, 0,
179 F_ENDROPPKT);
180 t3_write_reg(adapter, A_XGM_RX_CTRL + pi->mac.offset, 0);
181 t3_write_reg(adapter, A_XGM_TX_CTRL + pi->mac.offset, F_TXEN);
182 t3_write_reg(adapter, A_XGM_RX_CTRL + pi->mac.offset, F_RXEN);
183}
184
185static void disable_tx_fifo_drain(struct adapter *adapter,
186 struct port_info *pi)
187{
188 t3_set_reg_field(adapter, A_XGM_TXFIFO_CFG + pi->mac.offset,
189 F_ENDROPPKT, 0);
190}
191
175void t3_os_link_fault(struct adapter *adap, int port_id, int state) 192void t3_os_link_fault(struct adapter *adap, int port_id, int state)
176{ 193{
177 struct net_device *dev = adap->port[port_id]; 194 struct net_device *dev = adap->port[port_id];
@@ -185,6 +202,8 @@ void t3_os_link_fault(struct adapter *adap, int port_id, int state)
185 202
186 netif_carrier_on(dev); 203 netif_carrier_on(dev);
187 204
205 disable_tx_fifo_drain(adap, pi);
206
188 /* Clear local faults */ 207 /* Clear local faults */
189 t3_xgm_intr_disable(adap, pi->port_id); 208 t3_xgm_intr_disable(adap, pi->port_id);
190 t3_read_reg(adap, A_XGM_INT_STATUS + 209 t3_read_reg(adap, A_XGM_INT_STATUS +
@@ -200,9 +219,12 @@ void t3_os_link_fault(struct adapter *adap, int port_id, int state)
200 t3_xgm_intr_enable(adap, pi->port_id); 219 t3_xgm_intr_enable(adap, pi->port_id);
201 220
202 t3_mac_enable(mac, MAC_DIRECTION_TX); 221 t3_mac_enable(mac, MAC_DIRECTION_TX);
203 } else 222 } else {
204 netif_carrier_off(dev); 223 netif_carrier_off(dev);
205 224
225 /* Flush TX FIFO */
226 enable_tx_fifo_drain(adap, pi);
227 }
206 link_report(dev); 228 link_report(dev);
207} 229}
208 230
@@ -232,6 +254,8 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
232 254
233 if (link_stat != netif_carrier_ok(dev)) { 255 if (link_stat != netif_carrier_ok(dev)) {
234 if (link_stat) { 256 if (link_stat) {
257 disable_tx_fifo_drain(adapter, pi);
258
235 t3_mac_enable(mac, MAC_DIRECTION_RX); 259 t3_mac_enable(mac, MAC_DIRECTION_RX);
236 260
237 /* Clear local faults */ 261 /* Clear local faults */
@@ -263,6 +287,9 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
263 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset); 287 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset);
264 t3_mac_disable(mac, MAC_DIRECTION_RX); 288 t3_mac_disable(mac, MAC_DIRECTION_RX);
265 t3_link_start(&pi->phy, mac, &pi->link_config); 289 t3_link_start(&pi->phy, mac, &pi->link_config);
290
291 /* Flush TX FIFO */
292 enable_tx_fifo_drain(adapter, pi);
266 } 293 }
267 294
268 link_report(dev); 295 link_report(dev);
@@ -443,6 +470,7 @@ static int init_tp_parity(struct adapter *adap)
443 memset(req, 0, sizeof(*req)); 470 memset(req, 0, sizeof(*req));
444 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 471 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
445 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i)); 472 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i));
473 req->mtu_idx = NMTUS - 1;
446 req->iff = i; 474 req->iff = i;
447 t3_mgmt_tx(adap, skb); 475 t3_mgmt_tx(adap, skb);
448 if (skb == adap->nofail_skb) { 476 if (skb == adap->nofail_skb) {
@@ -963,6 +991,75 @@ static int bind_qsets(struct adapter *adap)
963 991
964#define FW_FNAME "cxgb3/t3fw-%d.%d.%d.bin" 992#define FW_FNAME "cxgb3/t3fw-%d.%d.%d.bin"
965#define TPSRAM_NAME "cxgb3/t3%c_psram-%d.%d.%d.bin" 993#define TPSRAM_NAME "cxgb3/t3%c_psram-%d.%d.%d.bin"
994#define AEL2005_OPT_EDC_NAME "cxgb3/ael2005_opt_edc.bin"
995#define AEL2005_TWX_EDC_NAME "cxgb3/ael2005_twx_edc.bin"
996#define AEL2020_TWX_EDC_NAME "cxgb3/ael2020_twx_edc.bin"
997
998static inline const char *get_edc_fw_name(int edc_idx)
999{
1000 const char *fw_name = NULL;
1001
1002 switch (edc_idx) {
1003 case EDC_OPT_AEL2005:
1004 fw_name = AEL2005_OPT_EDC_NAME;
1005 break;
1006 case EDC_TWX_AEL2005:
1007 fw_name = AEL2005_TWX_EDC_NAME;
1008 break;
1009 case EDC_TWX_AEL2020:
1010 fw_name = AEL2020_TWX_EDC_NAME;
1011 break;
1012 }
1013 return fw_name;
1014}
1015
1016int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size)
1017{
1018 struct adapter *adapter = phy->adapter;
1019 const struct firmware *fw;
1020 char buf[64];
1021 u32 csum;
1022 const __be32 *p;
1023 u16 *cache = phy->phy_cache;
1024 int i, ret;
1025
1026 snprintf(buf, sizeof(buf), get_edc_fw_name(edc_idx));
1027
1028 ret = request_firmware(&fw, buf, &adapter->pdev->dev);
1029 if (ret < 0) {
1030 dev_err(&adapter->pdev->dev,
1031 "could not upgrade firmware: unable to load %s\n",
1032 buf);
1033 return ret;
1034 }
1035
1036 /* check size, take checksum in account */
1037 if (fw->size > size + 4) {
1038 CH_ERR(adapter, "firmware image too large %u, expected %d\n",
1039 (unsigned int)fw->size, size + 4);
1040 ret = -EINVAL;
1041 }
1042
1043 /* compute checksum */
1044 p = (const __be32 *)fw->data;
1045 for (csum = 0, i = 0; i < fw->size / sizeof(csum); i++)
1046 csum += ntohl(p[i]);
1047
1048 if (csum != 0xffffffff) {
1049 CH_ERR(adapter, "corrupted firmware image, checksum %u\n",
1050 csum);
1051 ret = -EINVAL;
1052 }
1053
1054 for (i = 0; i < size / 4 ; i++) {
1055 *cache++ = (be32_to_cpu(p[i]) & 0xffff0000) >> 16;
1056 *cache++ = be32_to_cpu(p[i]) & 0xffff;
1057 }
1058
1059 release_firmware(fw);
1060
1061 return ret;
1062}
966 1063
967static int upgrade_fw(struct adapter *adap) 1064static int upgrade_fw(struct adapter *adap)
968{ 1065{
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 29c79eb43beb..f86612857a73 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1216,7 +1216,7 @@ static inline void t3_stop_tx_queue(struct netdev_queue *txq,
1216 * 1216 *
1217 * Add a packet to an SGE Tx queue. Runs with softirqs disabled. 1217 * Add a packet to an SGE Tx queue. Runs with softirqs disabled.
1218 */ 1218 */
1219int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) 1219netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1220{ 1220{
1221 int qidx; 1221 int qidx;
1222 unsigned int ndesc, pidx, credits, gen, compl; 1222 unsigned int ndesc, pidx, credits, gen, compl;
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 870d44992c70..032cfe065570 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -3465,7 +3465,7 @@ static void config_pcie(struct adapter *adap)
3465 {201, 321, 258, 450, 834, 1602} 3465 {201, 321, 258, 450, 834, 1602}
3466 }; 3466 };
3467 3467
3468 u16 val; 3468 u16 val, devid;
3469 unsigned int log2_width, pldsize; 3469 unsigned int log2_width, pldsize;
3470 unsigned int fst_trn_rx, fst_trn_tx, acklat, rpllmt; 3470 unsigned int fst_trn_rx, fst_trn_tx, acklat, rpllmt;
3471 3471
@@ -3473,6 +3473,17 @@ static void config_pcie(struct adapter *adap)
3473 adap->params.pci.pcie_cap_addr + PCI_EXP_DEVCTL, 3473 adap->params.pci.pcie_cap_addr + PCI_EXP_DEVCTL,
3474 &val); 3474 &val);
3475 pldsize = (val & PCI_EXP_DEVCTL_PAYLOAD) >> 5; 3475 pldsize = (val & PCI_EXP_DEVCTL_PAYLOAD) >> 5;
3476
3477 pci_read_config_word(adap->pdev, 0x2, &devid);
3478 if (devid == 0x37) {
3479 pci_write_config_word(adap->pdev,
3480 adap->params.pci.pcie_cap_addr +
3481 PCI_EXP_DEVCTL,
3482 val & ~PCI_EXP_DEVCTL_READRQ &
3483 ~PCI_EXP_DEVCTL_PAYLOAD);
3484 pldsize = 0;
3485 }
3486
3476 pci_read_config_word(adap->pdev, 3487 pci_read_config_word(adap->pdev,
3477 adap->params.pci.pcie_cap_addr + PCI_EXP_LNKCTL, 3488 adap->params.pci.pcie_cap_addr + PCI_EXP_LNKCTL,
3478 &val); 3489 &val);
@@ -3681,7 +3692,13 @@ static void mc7_prep(struct adapter *adapter, struct mc7 *mc7,
3681 3692
3682void mac_prep(struct cmac *mac, struct adapter *adapter, int index) 3693void mac_prep(struct cmac *mac, struct adapter *adapter, int index)
3683{ 3694{
3695 u16 devid;
3696
3684 mac->adapter = adapter; 3697 mac->adapter = adapter;
3698 pci_read_config_word(adapter->pdev, 0x2, &devid);
3699
3700 if (devid == 0x37 && !adapter->params.vpd.xauicfg[1])
3701 index = 0;
3685 mac->offset = (XGMAC0_1_BASE_ADDR - XGMAC0_0_BASE_ADDR) * index; 3702 mac->offset = (XGMAC0_1_BASE_ADDR - XGMAC0_0_BASE_ADDR) * index;
3686 mac->nucast = 1; 3703 mac->nucast = 1;
3687 3704
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index f87f9435049f..0109ee4f2f91 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -447,11 +447,12 @@ int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc)
447 447
448 val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft); 448 val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft);
449 val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM); 449 val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM);
450 if (fc & PAUSE_TX) 450 if (fc & PAUSE_TX) {
451 val |= V_RXFIFOPAUSEHWM(rx_fifo_hwm( 451 u32 rx_max_pkt_size =
452 t3_read_reg(adap, 452 G_RXMAXPKTSIZE(t3_read_reg(adap,
453 A_XGM_RX_MAX_PKT_SIZE 453 A_XGM_RX_MAX_PKT_SIZE + oft));
454 + oft)) / 8); 454 val |= V_RXFIFOPAUSEHWM(rx_fifo_hwm(rx_max_pkt_size) / 8);
455 }
455 t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val); 456 t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val);
456 457
457 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, 458 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN,