Commit 8a26a9de authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'net-ftgmac100-support-fixed-link'

Tao Ren says:

====================
net: ftgmac100: support fixed link

The patch series adds fixed link support to ftgmac100 driver.

Patch #1 adds fixed link logic into ftgmac100 driver.

Patch #2 enables mac3 controller in Elbert dts: Elbert mac3 is connected
to the onboard switch BCM53134P's IMP_RGMII port directly (no PHY
between BMC MAC and BCM53134P).
====================

Link: https://lore.kernel.org/r/20220907054453.20016-1-rentao.bupt@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 9724343e ce6ce917
...@@ -183,3 +183,21 @@ imux31: i2c@7 { ...@@ -183,3 +183,21 @@ imux31: i2c@7 {
&i2c11 { &i2c11 {
status = "okay"; status = "okay";
}; };
/*
* BMC's "mac3" controller is connected to BCM53134P's IMP_RGMII port
* directly (fixed link, no PHY in between).
* Note: BMC's "mdio0" controller is connected to BCM53134P's MDIO
* interface, and the MDIO channel will be enabled in dts later, when
* BCM53134 is added to "bcm53xx" DSA driver.
*/
&mac3 {
status = "okay";
phy-mode = "rgmii";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_rgmii4_default>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
...@@ -1701,10 +1701,14 @@ static int ftgmac100_setup_mdio(struct net_device *netdev) ...@@ -1701,10 +1701,14 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
static void ftgmac100_phy_disconnect(struct net_device *netdev) static void ftgmac100_phy_disconnect(struct net_device *netdev)
{ {
struct ftgmac100 *priv = netdev_priv(netdev);
if (!netdev->phydev) if (!netdev->phydev)
return; return;
phy_disconnect(netdev->phydev); phy_disconnect(netdev->phydev);
if (of_phy_is_fixed_link(priv->dev->of_node))
of_phy_deregister_fixed_link(priv->dev->of_node);
} }
static void ftgmac100_destroy_mdio(struct net_device *netdev) static void ftgmac100_destroy_mdio(struct net_device *netdev)
...@@ -1867,6 +1871,26 @@ static int ftgmac100_probe(struct platform_device *pdev) ...@@ -1867,6 +1871,26 @@ static int ftgmac100_probe(struct platform_device *pdev)
err = -EINVAL; err = -EINVAL;
goto err_phy_connect; goto err_phy_connect;
} }
} else if (np && of_phy_is_fixed_link(np)) {
struct phy_device *phy;
err = of_phy_register_fixed_link(np);
if (err) {
dev_err(&pdev->dev, "Failed to register fixed PHY\n");
goto err_phy_connect;
}
phy = of_phy_get_and_connect(priv->netdev, np,
&ftgmac100_adjust_link);
if (!phy) {
dev_err(&pdev->dev, "Failed to connect to fixed PHY\n");
of_phy_deregister_fixed_link(np);
err = -EINVAL;
goto err_phy_connect;
}
/* Display what we found */
phy_attached_info(phy);
} else if (np && of_get_property(np, "phy-handle", NULL)) { } else if (np && of_get_property(np, "phy-handle", NULL)) {
struct phy_device *phy; struct phy_device *phy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment