diff options
Diffstat (limited to 'drivers/net/dsa/mt7530.c')
-rw-r--r-- | drivers/net/dsa/mt7530.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 1e46418a3b74..264b281eb86b 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c | |||
@@ -625,6 +625,44 @@ static void mt7530_adjust_link(struct dsa_switch *ds, int port, | |||
625 | * all finished. | 625 | * all finished. |
626 | */ | 626 | */ |
627 | mt7623_pad_clk_setup(ds); | 627 | mt7623_pad_clk_setup(ds); |
628 | } else { | ||
629 | u16 lcl_adv = 0, rmt_adv = 0; | ||
630 | u8 flowctrl; | ||
631 | u32 mcr = PMCR_USERP_LINK | PMCR_FORCE_MODE; | ||
632 | |||
633 | switch (phydev->speed) { | ||
634 | case SPEED_1000: | ||
635 | mcr |= PMCR_FORCE_SPEED_1000; | ||
636 | break; | ||
637 | case SPEED_100: | ||
638 | mcr |= PMCR_FORCE_SPEED_100; | ||
639 | break; | ||
640 | }; | ||
641 | |||
642 | if (phydev->link) | ||
643 | mcr |= PMCR_FORCE_LNK; | ||
644 | |||
645 | if (phydev->duplex) { | ||
646 | mcr |= PMCR_FORCE_FDX; | ||
647 | |||
648 | if (phydev->pause) | ||
649 | rmt_adv = LPA_PAUSE_CAP; | ||
650 | if (phydev->asym_pause) | ||
651 | rmt_adv |= LPA_PAUSE_ASYM; | ||
652 | |||
653 | if (phydev->advertising & ADVERTISED_Pause) | ||
654 | lcl_adv |= ADVERTISE_PAUSE_CAP; | ||
655 | if (phydev->advertising & ADVERTISED_Asym_Pause) | ||
656 | lcl_adv |= ADVERTISE_PAUSE_ASYM; | ||
657 | |||
658 | flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); | ||
659 | |||
660 | if (flowctrl & FLOW_CTRL_TX) | ||
661 | mcr |= PMCR_TX_FC_EN; | ||
662 | if (flowctrl & FLOW_CTRL_RX) | ||
663 | mcr |= PMCR_RX_FC_EN; | ||
664 | } | ||
665 | mt7530_write(priv, MT7530_PMCR_P(port), mcr); | ||
628 | } | 666 | } |
629 | } | 667 | } |
630 | 668 | ||