@@ -1670,11 +1670,13 @@ static void gswip_port_set_pause(struct gswip_priv *priv, int port,
1670
1670
mdio_phy , GSWIP_MDIO_PHYp (port ));
1671
1671
}
1672
1672
1673
- static void gswip_phylink_mac_config (struct dsa_switch * ds , int port ,
1673
+ static void gswip_phylink_mac_config (struct phylink_config * config ,
1674
1674
unsigned int mode ,
1675
1675
const struct phylink_link_state * state )
1676
1676
{
1677
- struct gswip_priv * priv = ds -> priv ;
1677
+ struct dsa_port * dp = dsa_phylink_to_port (config );
1678
+ struct gswip_priv * priv = dp -> ds -> priv ;
1679
+ int port = dp -> index ;
1678
1680
u32 miicfg = 0 ;
1679
1681
1680
1682
miicfg |= GSWIP_MII_CFG_LDCLKDIS ;
@@ -1700,7 +1702,7 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
1700
1702
miicfg |= GSWIP_MII_CFG_MODE_GMII ;
1701
1703
break ;
1702
1704
default :
1703
- dev_err (ds -> dev ,
1705
+ dev_err (dp -> ds -> dev ,
1704
1706
"Unsupported interface: %d\n" , state -> interface );
1705
1707
return ;
1706
1708
}
@@ -1726,28 +1728,32 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
1726
1728
}
1727
1729
}
1728
1730
1729
- static void gswip_phylink_mac_link_down (struct dsa_switch * ds , int port ,
1731
+ static void gswip_phylink_mac_link_down (struct phylink_config * config ,
1730
1732
unsigned int mode ,
1731
1733
phy_interface_t interface )
1732
1734
{
1733
- struct gswip_priv * priv = ds -> priv ;
1735
+ struct dsa_port * dp = dsa_phylink_to_port (config );
1736
+ struct gswip_priv * priv = dp -> ds -> priv ;
1737
+ int port = dp -> index ;
1734
1738
1735
1739
gswip_mii_mask_cfg (priv , GSWIP_MII_CFG_EN , 0 , port );
1736
1740
1737
- if (!dsa_is_cpu_port ( ds , port ))
1741
+ if (!dsa_port_is_cpu ( dp ))
1738
1742
gswip_port_set_link (priv , port , false);
1739
1743
}
1740
1744
1741
- static void gswip_phylink_mac_link_up (struct dsa_switch * ds , int port ,
1745
+ static void gswip_phylink_mac_link_up (struct phylink_config * config ,
1746
+ struct phy_device * phydev ,
1742
1747
unsigned int mode ,
1743
1748
phy_interface_t interface ,
1744
- struct phy_device * phydev ,
1745
1749
int speed , int duplex ,
1746
1750
bool tx_pause , bool rx_pause )
1747
1751
{
1748
- struct gswip_priv * priv = ds -> priv ;
1752
+ struct dsa_port * dp = dsa_phylink_to_port (config );
1753
+ struct gswip_priv * priv = dp -> ds -> priv ;
1754
+ int port = dp -> index ;
1749
1755
1750
- if (!dsa_is_cpu_port ( ds , port )) {
1756
+ if (!dsa_port_is_cpu ( dp )) {
1751
1757
gswip_port_set_link (priv , port , true);
1752
1758
gswip_port_set_speed (priv , port , speed , interface );
1753
1759
gswip_port_set_duplex (priv , port , duplex );
@@ -1824,6 +1830,12 @@ static int gswip_get_sset_count(struct dsa_switch *ds, int port, int sset)
1824
1830
return ARRAY_SIZE (gswip_rmon_cnt );
1825
1831
}
1826
1832
1833
+ static const struct phylink_mac_ops gswip_phylink_mac_ops = {
1834
+ .mac_config = gswip_phylink_mac_config ,
1835
+ .mac_link_down = gswip_phylink_mac_link_down ,
1836
+ .mac_link_up = gswip_phylink_mac_link_up ,
1837
+ };
1838
+
1827
1839
static const struct dsa_switch_ops gswip_xrx200_switch_ops = {
1828
1840
.get_tag_protocol = gswip_get_tag_protocol ,
1829
1841
.setup = gswip_setup ,
@@ -1842,9 +1854,6 @@ static const struct dsa_switch_ops gswip_xrx200_switch_ops = {
1842
1854
.port_change_mtu = gswip_port_change_mtu ,
1843
1855
.port_max_mtu = gswip_port_max_mtu ,
1844
1856
.phylink_get_caps = gswip_xrx200_phylink_get_caps ,
1845
- .phylink_mac_config = gswip_phylink_mac_config ,
1846
- .phylink_mac_link_down = gswip_phylink_mac_link_down ,
1847
- .phylink_mac_link_up = gswip_phylink_mac_link_up ,
1848
1857
.get_strings = gswip_get_strings ,
1849
1858
.get_ethtool_stats = gswip_get_ethtool_stats ,
1850
1859
.get_sset_count = gswip_get_sset_count ,
@@ -1868,9 +1877,6 @@ static const struct dsa_switch_ops gswip_xrx300_switch_ops = {
1868
1877
.port_change_mtu = gswip_port_change_mtu ,
1869
1878
.port_max_mtu = gswip_port_max_mtu ,
1870
1879
.phylink_get_caps = gswip_xrx300_phylink_get_caps ,
1871
- .phylink_mac_config = gswip_phylink_mac_config ,
1872
- .phylink_mac_link_down = gswip_phylink_mac_link_down ,
1873
- .phylink_mac_link_up = gswip_phylink_mac_link_up ,
1874
1880
.get_strings = gswip_get_strings ,
1875
1881
.get_ethtool_stats = gswip_get_ethtool_stats ,
1876
1882
.get_sset_count = gswip_get_sset_count ,
@@ -2136,6 +2142,7 @@ static int gswip_probe(struct platform_device *pdev)
2136
2142
priv -> ds -> num_ports = priv -> hw_info -> max_ports ;
2137
2143
priv -> ds -> priv = priv ;
2138
2144
priv -> ds -> ops = priv -> hw_info -> ops ;
2145
+ priv -> ds -> phylink_mac_ops = & gswip_phylink_mac_ops ;
2139
2146
priv -> dev = dev ;
2140
2147
mutex_init (& priv -> pce_table_lock );
2141
2148
version = gswip_switch_r (priv , GSWIP_VERSION );
0 commit comments