Commit 476095772f3aa58ee581943e4e993d9b8a61239c
1 parent
ebf8644a11
Exists in
v2017.01-smarct4x
and in
37 other branches
macb: simplify gmac initialisation
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Cc: Joe Hershberger <joe.hershberger@gmail.com> Cc: Bo Shen <voice.shen@atmel.com>
Showing 1 changed file with 8 additions and 17 deletions Side-by-side Diff
drivers/net/macb.c
... | ... | @@ -479,31 +479,22 @@ |
479 | 479 | /* First check for GMAC */ |
480 | 480 | if (macb_is_gem(macb)) { |
481 | 481 | lpa = macb_mdio_read(macb, MII_STAT1000); |
482 | - if (lpa & (1 << 11)) { | |
483 | - speed = 1000; | |
484 | - duplex = 1; | |
485 | - } else { | |
486 | - if (lpa & (1 << 10)) { | |
487 | - speed = 1000; | |
488 | - duplex = 1; | |
489 | - } else { | |
490 | - speed = 0; | |
491 | - } | |
492 | - } | |
493 | 482 | |
494 | - if (speed == 1000) { | |
495 | - printf("%s: link up, %dMbps %s-duplex (lpa: 0x%04x)\n", | |
483 | + if (lpa & (LPA_1000FULL | LPA_1000HALF)) { | |
484 | + duplex = ((lpa & LPA_1000FULL) ? 1 : 0); | |
485 | + | |
486 | + printf("%s: link up, 1000Mbps %s-duplex (lpa: 0x%04x)\n", | |
496 | 487 | netdev->name, |
497 | - speed, | |
498 | 488 | duplex ? "full" : "half", |
499 | 489 | lpa); |
500 | 490 | |
501 | 491 | ncfgr = macb_readl(macb, NCFGR); |
502 | - ncfgr &= ~(GEM_BIT(GBE) | MACB_BIT(SPD) | MACB_BIT(FD)); | |
503 | - if (speed) | |
504 | - ncfgr |= GEM_BIT(GBE); | |
492 | + ncfgr &= ~(MACB_BIT(SPD) | MACB_BIT(FD)); | |
493 | + ncfgr |= GEM_BIT(GBE); | |
494 | + | |
505 | 495 | if (duplex) |
506 | 496 | ncfgr |= MACB_BIT(FD); |
497 | + | |
507 | 498 | macb_writel(macb, NCFGR, ncfgr); |
508 | 499 | |
509 | 500 | return 1; |