@@ -563,17 +563,6 @@ mt7530_mib_reset(struct dsa_switch *ds)
563563 mt7530_write (priv , MT7530_MIB_CCR , CCR_MIB_ACTIVATE );
564564}
565565
566- static void
567- mt7530_port_set_status (struct mt7530_priv * priv , int port , int enable )
568- {
569- u32 mask = PMCR_TX_EN | PMCR_RX_EN | PMCR_FORCE_LNK ;
570-
571- if (enable )
572- mt7530_set (priv , MT7530_PMCR_P (port ), mask );
573- else
574- mt7530_clear (priv , MT7530_PMCR_P (port ), mask );
575- }
576-
577566static int mt7530_phy_read (struct dsa_switch * ds , int port , int regnum )
578567{
579568 struct mt7530_priv * priv = ds -> priv ;
@@ -750,7 +739,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
750739 priv -> ports [port ].enable = true;
751740 mt7530_rmw (priv , MT7530_PCR_P (port ), PCR_MATRIX_MASK ,
752741 priv -> ports [port ].pm );
753- mt7530_port_set_status (priv , port , 0 );
742+ mt7530_clear (priv , MT7530_PMCR_P ( port ), PMCR_LINK_SETTINGS_MASK );
754743
755744 mutex_unlock (& priv -> reg_mutex );
756745
@@ -773,7 +762,7 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
773762 priv -> ports [port ].enable = false;
774763 mt7530_rmw (priv , MT7530_PCR_P (port ), PCR_MATRIX_MASK ,
775764 PCR_MATRIX_CLR );
776- mt7530_port_set_status (priv , port , 0 );
765+ mt7530_clear (priv , MT7530_PMCR_P ( port ), PMCR_LINK_SETTINGS_MASK );
777766
778767 mutex_unlock (& priv -> reg_mutex );
779768}
@@ -1499,31 +1488,14 @@ static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port,
14991488
15001489 mcr_cur = mt7530_read (priv , MT7530_PMCR_P (port ));
15011490 mcr_new = mcr_cur ;
1502- mcr_new &= ~(PMCR_FORCE_SPEED_1000 | PMCR_FORCE_SPEED_100 |
1503- PMCR_FORCE_FDX | PMCR_TX_FC_EN | PMCR_RX_FC_EN );
1491+ mcr_new &= ~PMCR_LINK_SETTINGS_MASK ;
15041492 mcr_new |= PMCR_IFG_XMIT (1 ) | PMCR_MAC_MODE | PMCR_BACKOFF_EN |
15051493 PMCR_BACKPR_EN | PMCR_FORCE_MODE ;
15061494
15071495 /* Are we connected to external phy */
15081496 if (port == 5 && dsa_is_user_port (ds , 5 ))
15091497 mcr_new |= PMCR_EXT_PHY ;
15101498
1511- switch (state -> speed ) {
1512- case SPEED_1000 :
1513- mcr_new |= PMCR_FORCE_SPEED_1000 ;
1514- break ;
1515- case SPEED_100 :
1516- mcr_new |= PMCR_FORCE_SPEED_100 ;
1517- break ;
1518- }
1519- if (state -> duplex == DUPLEX_FULL ) {
1520- mcr_new |= PMCR_FORCE_FDX ;
1521- if (state -> pause & MLO_PAUSE_TX )
1522- mcr_new |= PMCR_TX_FC_EN ;
1523- if (state -> pause & MLO_PAUSE_RX )
1524- mcr_new |= PMCR_RX_FC_EN ;
1525- }
1526-
15271499 if (mcr_new != mcr_cur )
15281500 mt7530_write (priv , MT7530_PMCR_P (port ), mcr_new );
15291501}
@@ -1534,7 +1506,7 @@ static void mt7530_phylink_mac_link_down(struct dsa_switch *ds, int port,
15341506{
15351507 struct mt7530_priv * priv = ds -> priv ;
15361508
1537- mt7530_port_set_status (priv , port , 0 );
1509+ mt7530_clear (priv , MT7530_PMCR_P ( port ), PMCR_LINK_SETTINGS_MASK );
15381510}
15391511
15401512static void mt7530_phylink_mac_link_up (struct dsa_switch * ds , int port ,
@@ -1545,8 +1517,27 @@ static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port,
15451517 bool tx_pause , bool rx_pause )
15461518{
15471519 struct mt7530_priv * priv = ds -> priv ;
1520+ u32 mcr ;
1521+
1522+ mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK ;
1523+
1524+ switch (speed ) {
1525+ case SPEED_1000 :
1526+ mcr |= PMCR_FORCE_SPEED_1000 ;
1527+ break ;
1528+ case SPEED_100 :
1529+ mcr |= PMCR_FORCE_SPEED_100 ;
1530+ break ;
1531+ }
1532+ if (duplex == DUPLEX_FULL ) {
1533+ mcr |= PMCR_FORCE_FDX ;
1534+ if (tx_pause )
1535+ mcr |= PMCR_TX_FC_EN ;
1536+ if (rx_pause )
1537+ mcr |= PMCR_RX_FC_EN ;
1538+ }
15481539
1549- mt7530_port_set_status (priv , port , 1 );
1540+ mt7530_set (priv , MT7530_PMCR_P ( port ), mcr );
15501541}
15511542
15521543static void mt7530_phylink_validate (struct dsa_switch * ds , int port ,
0 commit comments