Skip to content

Commit

Permalink
Merge branch 'net-ethernet-ti-am65-cpsw-nuss-support-stacked-switches'
Browse files Browse the repository at this point in the history
Alexander Sverdlin says:

====================
net: ethernet: ti: am65-cpsw-nuss: support stacked switches

Currently an external Ethernet switch connected to a am65-cpsw-nuss CPU
port will not be probed successfully because of_find_net_device_by_node()
will not be able to find the netdev of the CPU port.

It's necessary to populate of_node of the struct device for the
am65-cpsw-nuss ports. DT nodes of the ports are already stored in per-port
private data, but because of some legacy reasons the naming ("phy_node")
was misleading.
====================

Link: https://lore.kernel.org/r/20240528075954.3608118-1-alexander.sverdlin@siemens.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed May 30, 2024
2 parents 0f4b437 + 29c71bf commit 1e37449
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions drivers/net/ethernet/ti/am65-cpsw-nuss.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
/* mac_sl should be configured via phy-link interface */
am65_cpsw_sl_ctl_reset(port);

ret = phylink_of_phy_connect(port->slave.phylink, port->slave.phy_node, 0);
ret = phylink_of_phy_connect(port->slave.phylink, port->slave.port_np, 0);
if (ret)
goto error_cleanup;

Expand Down Expand Up @@ -2611,7 +2611,7 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
of_property_read_bool(port_np, "ti,mac-only");

/* get phy/link info */
port->slave.phy_node = port_np;
port->slave.port_np = port_np;
ret = of_get_phy_mode(port_np, &port->slave.phy_if);
if (ret) {
dev_err(dev, "%pOF read phy-mode err %d\n",
Expand Down Expand Up @@ -2703,6 +2703,7 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
mutex_init(&ndev_priv->mm_lock);
port->qos.link_speed = SPEED_UNKNOWN;
SET_NETDEV_DEV(port->ndev, dev);
port->ndev->dev.of_node = port->slave.port_np;

eth_hw_addr_set(port->ndev, port->slave.mac_addr);

Expand Down Expand Up @@ -2760,7 +2761,7 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
}

phylink = phylink_create(&port->slave.phylink_config,
of_node_to_fwnode(port->slave.phy_node),
of_node_to_fwnode(port->slave.port_np),
port->slave.phy_if,
&am65_cpsw_phylink_mac_ops);
if (IS_ERR(phylink))
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/ti/am65-cpsw-nuss.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct am65_cpts;
struct am65_cpsw_slave_data {
bool mac_only;
struct cpsw_sl *mac_sl;
struct device_node *phy_node;
struct device_node *port_np;
phy_interface_t phy_if;
struct phy *ifphy;
struct phy *serdes_phy;
Expand Down

0 comments on commit 1e37449

Please sign in to comment.