|
@@ -1,8 +1,8 @@
|
|
|
-From 8293a26ca56ee2e9a88e4efb5dcc7f647803cd8c Mon Sep 17 00:00:00 2001
|
|
|
+From 5b05b1d7a2d2001d9711856608f61abaf7b9a9a5 Mon Sep 17 00:00:00 2001
|
|
|
From: Alexandru Gagniuc <[email protected]>
|
|
|
-Date: Sun, 5 Jun 2022 21:45:09 -0500
|
|
|
-Subject: [PATCH] nss_dp_main: Use a 'phy-handle' property to connect to the
|
|
|
- PHY
|
|
|
+Date: Fri, 23 Jun 2023 13:34:56 +0200
|
|
|
+Subject: [PATCH 6/8] nss_dp_main: Use a 'phy-handle' property to connect to
|
|
|
+ the PHY
|
|
|
|
|
|
The original method of connecting a PHY to the ethernet controller
|
|
|
requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree
|
|
@@ -18,21 +18,22 @@ as they are no longer used:
|
|
|
* "qcom,forced-duplex"
|
|
|
|
|
|
Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
+Signed-off-by: Robert Marko <[email protected]>
|
|
|
---
|
|
|
include/nss_dp_dev.h | 5 +--
|
|
|
- nss_dp_main.c | 91 +++++---------------------------------------
|
|
|
- 2 files changed, 10 insertions(+), 86 deletions(-)
|
|
|
+ nss_dp_main.c | 91 +++++++-------------------------------------
|
|
|
+ 2 files changed, 14 insertions(+), 82 deletions(-)
|
|
|
|
|
|
--- a/include/nss_dp_dev.h
|
|
|
+++ b/include/nss_dp_dev.h
|
|
|
-@@ -100,13 +100,10 @@ struct nss_dp_dev {
|
|
|
+@@ -202,13 +202,10 @@ struct nss_dp_dev {
|
|
|
unsigned long drv_flags; /* Driver specific feature flags */
|
|
|
|
|
|
/* Phy related stuff */
|
|
|
-+ struct device_node *phy_node;
|
|
|
++ struct device_node *phy_node; /* Phy device OF node */
|
|
|
struct phy_device *phydev; /* Phy device */
|
|
|
struct mii_bus *miibus; /* MII bus */
|
|
|
- phy_interface_t phy_mii_type; /* RGMII/SGMII/QSGMII */
|
|
|
+ uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */
|
|
|
- uint32_t phy_mdio_addr; /* Mdio address */
|
|
|
- bool link_poll; /* Link polling enable? */
|
|
|
- uint32_t forced_speed; /* Forced speed? */
|
|
@@ -42,7 +43,7 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
|
|
|
--- a/nss_dp_main.c
|
|
|
+++ b/nss_dp_main.c
|
|
|
-@@ -399,7 +399,7 @@ static int nss_dp_open(struct net_device
|
|
|
+@@ -418,7 +418,7 @@ static int nss_dp_open(struct net_device
|
|
|
|
|
|
netif_start_queue(netdev);
|
|
|
|
|
@@ -51,19 +52,23 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
/* Notify data plane link is up */
|
|
|
if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) {
|
|
|
netdev_dbg(netdev, "Data plane set link failed\n");
|
|
|
-@@ -576,6 +576,8 @@ static int32_t nss_dp_of_get_pdata(struc
|
|
|
+@@ -615,6 +615,12 @@ static int32_t nss_dp_of_get_pdata(struc
|
|
|
return -EFAULT;
|
|
|
}
|
|
|
|
|
|
+ dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
|
|
++ if (!dp_priv->phy_node) {
|
|
|
++ pr_err("%s: error parsing phy-handle\n", np->name);
|
|
|
++ return -EFAULT;
|
|
|
++ }
|
|
|
+
|
|
|
if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) {
|
|
|
pr_err("%s: error reading mactype\n", np->name);
|
|
|
return -EFAULT;
|
|
|
-@@ -594,16 +596,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
|
|
- #else
|
|
|
- of_get_phy_mode(np, &dp_priv->phy_mii_type);
|
|
|
+@@ -635,18 +641,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
|
|
+ return -EFAULT;
|
|
|
#endif
|
|
|
+
|
|
|
- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
|
|
|
- if (of_property_read_u32(np, "qcom,phy-mdio-addr",
|
|
|
- &dp_priv->phy_mdio_addr) && dp_priv->link_poll) {
|
|
@@ -74,10 +79,12 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
-
|
|
|
- of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed);
|
|
|
- of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex);
|
|
|
-
|
|
|
- ret = of_get_mac_address(np, maddr);
|
|
|
- if (!ret && is_valid_ether_addr(maddr)) {
|
|
|
-@@ -636,50 +628,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
|
|
+-
|
|
|
+-
|
|
|
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
|
|
|
+ maddr = (uint8_t *)of_get_mac_address(np);
|
|
|
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0))
|
|
|
+@@ -695,56 +689,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -88,7 +95,9 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
-{
|
|
|
- struct device_node *mdio_node;
|
|
|
- struct platform_device *mdio_plat;
|
|
|
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0))
|
|
|
- struct ipq40xx_mdio_data *mdio_data;
|
|
|
+-#endif
|
|
|
-
|
|
|
- /*
|
|
|
- * Find mii_bus using "mdio-bus" handle.
|
|
@@ -115,6 +124,9 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
- return NULL;
|
|
|
- }
|
|
|
-
|
|
|
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0))
|
|
|
+- return dev_get_drvdata(&mdio_plat->dev);
|
|
|
+-#else
|
|
|
- mdio_data = dev_get_drvdata(&mdio_plat->dev);
|
|
|
- if (!mdio_data) {
|
|
|
- dev_err(&pdev->dev, "cannot get mii bus reference from device data\n");
|
|
@@ -123,12 +135,13 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
- }
|
|
|
-
|
|
|
- return mdio_data->mii_bus;
|
|
|
+-#endif
|
|
|
-}
|
|
|
-
|
|
|
#ifdef CONFIG_NET_SWITCHDEV
|
|
|
/*
|
|
|
* nss_dp_is_phy_dev()
|
|
|
-@@ -738,7 +686,6 @@ static int32_t nss_dp_probe(struct platf
|
|
|
+@@ -803,7 +747,6 @@ static int32_t nss_dp_probe(struct platf
|
|
|
struct device_node *np = pdev->dev.of_node;
|
|
|
struct nss_gmac_hal_platform_data gmac_hal_pdata;
|
|
|
int32_t ret = 0;
|
|
@@ -136,7 +149,7 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
#if defined(NSS_DP_PPE_SUPPORT)
|
|
|
uint32_t vsi_id;
|
|
|
fal_port_t port_id;
|
|
|
-@@ -813,37 +760,17 @@ static int32_t nss_dp_probe(struct platf
|
|
|
+@@ -880,22 +823,14 @@ static int32_t nss_dp_probe(struct platf
|
|
|
|
|
|
dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE);
|
|
|
|
|
@@ -151,33 +164,17 @@ Signed-off-by: Alexandru Gagniuc <[email protected]>
|
|
|
-
|
|
|
+ if (dp_priv->phy_node) {
|
|
|
SET_NETDEV_DEV(netdev, &pdev->dev);
|
|
|
--
|
|
|
+
|
|
|
- dp_priv->phydev = phy_connect(netdev, phy_id,
|
|
|
- &nss_dp_adjust_link,
|
|
|
- dp_priv->phy_mii_type);
|
|
|
- if (IS_ERR(dp_priv->phydev)) {
|
|
|
- netdev_dbg(netdev, "failed to connect to phy device\n");
|
|
|
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
|
|
|
-+ &nss_dp_adjust_link, 0,
|
|
|
-+ dp_priv->phy_mii_type);
|
|
|
++ &nss_dp_adjust_link, 0,
|
|
|
++ dp_priv->phy_mii_type);
|
|
|
+ if (!(dp_priv->phydev)) {
|
|
|
-+ dev_err(&pdev->dev, "Could not attach to PHY\n");
|
|
|
++ netdev_err(netdev, "failed to connect to phy device\n");
|
|
|
goto phy_setup_fail;
|
|
|
}
|
|
|
-
|
|
|
--#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))
|
|
|
-- dp_priv->phydev->advertising |=
|
|
|
-- (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
|
|
|
-- dp_priv->phydev->supported |=
|
|
|
-- (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
|
|
|
--#else
|
|
|
-- linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, dp_priv->phydev->advertising);
|
|
|
-- linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, dp_priv->phydev->advertising);
|
|
|
--
|
|
|
-- linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, dp_priv->phydev->supported);
|
|
|
-- linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, dp_priv->phydev->supported);
|
|
|
--#endif
|
|
|
-+ phy_attached_info(dp_priv->phydev);
|
|
|
}
|
|
|
-
|
|
|
- #if defined(NSS_DP_PPE_SUPPORT)
|