aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0293-staging-fsl_ppfe-eth-Enable-PFE-in-clause-45-mode.patch
blob: dac3a937212b472b29c7517de3c1dabc54c60aae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From 666f91f706c167b061ec29f45936a9f24e86e55c Mon Sep 17 00:00:00 2001
From: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Date: Wed, 29 Nov 2017 12:08:00 +0530
Subject: [PATCH] staging: fsl_ppfe/eth: Enable PFE in clause 45 mode

when we opearate in clause 45 mode, we need to call
the function get_phy_device() with its 3rd argument as
"true" and then the resultant phy device needs to be
register with phy layer via phy_device_register()

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
---
 drivers/staging/fsl_ppfe/pfe_eth.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

--- a/drivers/staging/fsl_ppfe/pfe_eth.c
+++ b/drivers/staging/fsl_ppfe/pfe_eth.c
@@ -923,7 +923,8 @@ static int pfe_eth_mdio_init(struct pfe_
 			     struct ls1012a_mdio_platform_data *minfo)
 {
 	struct mii_bus *bus;
-	int rc;
+	int rc, ii;
+	struct phy_device *phydev;
 
 	netif_info(priv, drv, priv->ndev, "%s\n", __func__);
 	pr_info("%s\n", __func__);
@@ -962,6 +963,31 @@ static int pfe_eth_mdio_init(struct pfe_
 	}
 
 	priv->mii_bus = bus;
+
+	/* For clause 45 we need to call get_phy_device() with it's
+	 * 3rd argument as true and then register the phy device
+	 * via phy_device_register()
+	 */
+
+	if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII) {
+		for (ii = 0; ii < NUM_GEMAC_SUPPORT; ii++) {
+			phydev = get_phy_device(priv->mii_bus,
+					priv->einfo->phy_id + ii, true);
+			if (!phydev || IS_ERR(phydev)) {
+				rc = -EIO;
+				netdev_err(priv->ndev, "fail to get device\n");
+				goto err1;
+			}
+			rc = phy_device_register(phydev);
+			if (rc) {
+				phy_device_free(phydev);
+				netdev_err(priv->ndev,
+					"phy_device_register() failed\n");
+				goto err1;
+			}
+		}
+	}
+
 	pfe_eth_mdio_reset(bus);
 
 	return 0;
@@ -1149,7 +1175,7 @@ static void ls1012a_configure_serdes(str
 	int sgmii_2500 = 0;
 	struct mii_bus *bus = priv->mii_bus;
 
-	if (priv->einfo->mii_config == PHY_INTERFACE_MODE_SGMII_2500)
+	if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII)
 		sgmii_2500 = 1;
 
 	netif_info(priv, drv, ndev, "%s\n", __func__);
@@ -1198,7 +1224,7 @@ static int pfe_phy_init(struct net_devic
 	netif_info(priv, drv, ndev, "%s: %s\n", __func__, phy_id);
 	interface = priv->einfo->mii_config;
 	if ((interface == PHY_INTERFACE_MODE_SGMII) ||
-	    (interface == PHY_INTERFACE_MODE_SGMII_2500)) {
+	    (interface == PHY_INTERFACE_MODE_2500SGMII)) {
 		/*Configure SGMII PCS */
 		if (pfe->scfg) {
 			/*Config MDIO from serdes */