slave.c (448cc2fb3a7b327823a9afd374808c37b8e6194f) | slave.c (21bd64bd717dedac96f53b668144cbe37d3c12d4) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * net/dsa/slave.c - Slave device handling 4 * Copyright (c) 2008-2009 Marvell Semiconductor 5 */ 6 7#include <linux/list.h> 8#include <linux/etherdevice.h> --- 1837 unchanged lines hidden (view full) --- 1846 return phylink_connect_phy(dp->pl, slave_dev->phydev); 1847} 1848 1849static int dsa_slave_phy_setup(struct net_device *slave_dev) 1850{ 1851 struct dsa_port *dp = dsa_slave_to_port(slave_dev); 1852 struct device_node *port_dn = dp->dn; 1853 struct dsa_switch *ds = dp->ds; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * net/dsa/slave.c - Slave device handling 4 * Copyright (c) 2008-2009 Marvell Semiconductor 5 */ 6 7#include <linux/list.h> 8#include <linux/etherdevice.h> --- 1837 unchanged lines hidden (view full) --- 1846 return phylink_connect_phy(dp->pl, slave_dev->phydev); 1847} 1848 1849static int dsa_slave_phy_setup(struct net_device *slave_dev) 1850{ 1851 struct dsa_port *dp = dsa_slave_to_port(slave_dev); 1852 struct device_node *port_dn = dp->dn; 1853 struct dsa_switch *ds = dp->ds; |
1854 phy_interface_t mode; | |
1855 u32 phy_flags = 0; 1856 int ret; 1857 | 1854 u32 phy_flags = 0; 1855 int ret; 1856 |
1858 ret = of_get_phy_mode(port_dn, &mode); 1859 if (ret) 1860 mode = PHY_INTERFACE_MODE_NA; 1861 | |
1862 dp->pl_config.dev = &slave_dev->dev; 1863 dp->pl_config.type = PHYLINK_NETDEV; 1864 1865 /* The get_fixed_state callback takes precedence over polling the 1866 * link GPIO in PHYLINK (see phylink_get_fixed_state). Only set 1867 * this if the switch provides such a callback. 1868 */ 1869 if (ds->ops->phylink_fixed_state) { 1870 dp->pl_config.get_fixed_state = dsa_slave_phylink_fixed_state; 1871 dp->pl_config.poll_fixed_state = true; 1872 } 1873 | 1857 dp->pl_config.dev = &slave_dev->dev; 1858 dp->pl_config.type = PHYLINK_NETDEV; 1859 1860 /* The get_fixed_state callback takes precedence over polling the 1861 * link GPIO in PHYLINK (see phylink_get_fixed_state). Only set 1862 * this if the switch provides such a callback. 1863 */ 1864 if (ds->ops->phylink_fixed_state) { 1865 dp->pl_config.get_fixed_state = dsa_slave_phylink_fixed_state; 1866 dp->pl_config.poll_fixed_state = true; 1867 } 1868 |
1874 if (ds->ops->phylink_get_interfaces) 1875 ds->ops->phylink_get_interfaces(ds, dp->index, 1876 dp->pl_config.supported_interfaces); | 1869 ret = dsa_port_phylink_create(dp); 1870 if (ret) 1871 return ret; |
1877 | 1872 |
1878 dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn), mode, 1879 &dsa_port_phylink_mac_ops); 1880 if (IS_ERR(dp->pl)) { 1881 netdev_err(slave_dev, 1882 "error creating PHYLINK: %ld\n", PTR_ERR(dp->pl)); 1883 return PTR_ERR(dp->pl); 1884 } 1885 | |
1886 if (ds->ops->get_phy_flags) 1887 phy_flags = ds->ops->get_phy_flags(ds, dp->index); 1888 1889 ret = phylink_of_phy_connect(dp->pl, port_dn, phy_flags); 1890 if (ret == -ENODEV && ds->slave_mii_bus) { 1891 /* We could not connect to a designated PHY or SFP, so try to 1892 * use the switch internal MDIO bus instead 1893 */ --- 749 unchanged lines hidden --- | 1873 if (ds->ops->get_phy_flags) 1874 phy_flags = ds->ops->get_phy_flags(ds, dp->index); 1875 1876 ret = phylink_of_phy_connect(dp->pl, port_dn, phy_flags); 1877 if (ret == -ENODEV && ds->slave_mii_bus) { 1878 /* We could not connect to a designated PHY or SFP, so try to 1879 * use the switch internal MDIO bus instead 1880 */ --- 749 unchanged lines hidden --- |