Re: [RFC PATCH 02/10] net: ti: prueth: Adds ICSSM Ethernet driver

From: Andrew Lunn
Date: Thu Jan 09 2025 - 11:00:23 EST


> + emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0);
> + if (!emac->phy_node) {
> + dev_err(prueth->dev, "couldn't find phy-handle\n");
> + ret = -ENODEV;
> + goto free;
> + }
> +
> + ret = of_get_phy_mode(eth_node, &emac->phy_if);
> + if (ret) {
> + dev_err(prueth->dev, "could not get phy-mode property err %d\n",
> + ret);
> + goto free;
> + }
> +
> + /* connect PHY */
> + emac->phydev = of_phy_connect(ndev, emac->phy_node,
> + &icssm_emac_adjust_link, 0, emac->phy_if);
> + if (!emac->phydev) {
> + dev_dbg(prueth->dev, "couldn't connect to phy %s\n",
> + emac->phy_node->full_name);
> + ret = -EPROBE_DEFER;
> + goto free;
> + }

of_phy_get_and_connect() will simplify this.

> + /* remove unsupported modes */
> + phy_remove_link_mode(emac->phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
> + phy_remove_link_mode(emac->phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);

It only does 100Mbps?

> + if (of_property_read_bool(eth_node, "ti,no-half-duplex")) {

Is this becasue 100baseT_Half is broken in some versions of the
hardware?

> + phy_remove_link_mode(emac->phydev,
> + ETHTOOL_LINK_MODE_100baseT_Half_BIT);
> + }
> +
> + phy_remove_link_mode(emac->phydev, ETHTOOL_LINK_MODE_Pause_BIT);
> + phy_remove_link_mode(emac->phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT);

Is this really needed? I've not checked, but if you don't call
phy_support_sym_pause() or phy_support_asym_pause(), i would of
expected phylib to default to no pause?

> +static const struct of_device_id prueth_dt_match[];

Please avoid forward references. If you need the match table, define
it here.

Andrew