Re: [RFC PATCH 02/10] net: ti: prueth: Adds ICSSM Ethernet driver
From: Basharath Hussain Khaja
Date: Wed Jan 22 2025 - 10:34:05 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.
>
Yes. This API does same functionality, we will replace three APIs with single
API in the next version.
>> + /* 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?
>
It is capable of both 100M/10M full/half-duplex modes. In this patch series we are
adding support for 100M full duplex operation. Support for other modes will be added
subsequently.
>> + if (of_property_read_bool(eth_node, "ti,no-half-duplex")) {
>
> Is this becasue 100baseT_Half is broken in some versions of the
> hardware?
>
No.This property will be removed as we have added support only for 100M full duplex.
>> + 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?
>
Though TI PHY default state is clear(ASM_DIR - 0 & PAUSE - 0 as Default
state in ANAR register), this bits are cleared again to handle if in case
of change in PHY.
>> +static const struct of_device_id prueth_dt_match[];
>
> Please avoid forward references. If you need the match table, define
> it here.
>
Sure. This got escaped while cleanup. We will address this in the next version.
Thanks & Best Regards,
Basharath