layerscape: add patches-5.4
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0293-staging-fsl_ppfe-eth-Enable-PFE-in-clause-45-mode.patch
1 From 666f91f706c167b061ec29f45936a9f24e86e55c Mon Sep 17 00:00:00 2001
2 From: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
3 Date: Wed, 29 Nov 2017 12:08:00 +0530
4 Subject: [PATCH] staging: fsl_ppfe/eth: Enable PFE in clause 45 mode
5
6 when we opearate in clause 45 mode, we need to call
7 the function get_phy_device() with its 3rd argument as
8 "true" and then the resultant phy device needs to be
9 register with phy layer via phy_device_register()
10
11 Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
12 ---
13 drivers/staging/fsl_ppfe/pfe_eth.c | 32 +++++++++++++++++++++++++++++---
14 1 file changed, 29 insertions(+), 3 deletions(-)
15
16 --- a/drivers/staging/fsl_ppfe/pfe_eth.c
17 +++ b/drivers/staging/fsl_ppfe/pfe_eth.c
18 @@ -923,7 +923,8 @@ static int pfe_eth_mdio_init(struct pfe_
19 struct ls1012a_mdio_platform_data *minfo)
20 {
21 struct mii_bus *bus;
22 - int rc;
23 + int rc, ii;
24 + struct phy_device *phydev;
25
26 netif_info(priv, drv, priv->ndev, "%s\n", __func__);
27 pr_info("%s\n", __func__);
28 @@ -962,6 +963,31 @@ static int pfe_eth_mdio_init(struct pfe_
29 }
30
31 priv->mii_bus = bus;
32 +
33 + /* For clause 45 we need to call get_phy_device() with it's
34 + * 3rd argument as true and then register the phy device
35 + * via phy_device_register()
36 + */
37 +
38 + if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII) {
39 + for (ii = 0; ii < NUM_GEMAC_SUPPORT; ii++) {
40 + phydev = get_phy_device(priv->mii_bus,
41 + priv->einfo->phy_id + ii, true);
42 + if (!phydev || IS_ERR(phydev)) {
43 + rc = -EIO;
44 + netdev_err(priv->ndev, "fail to get device\n");
45 + goto err1;
46 + }
47 + rc = phy_device_register(phydev);
48 + if (rc) {
49 + phy_device_free(phydev);
50 + netdev_err(priv->ndev,
51 + "phy_device_register() failed\n");
52 + goto err1;
53 + }
54 + }
55 + }
56 +
57 pfe_eth_mdio_reset(bus);
58
59 return 0;
60 @@ -1149,7 +1175,7 @@ static void ls1012a_configure_serdes(str
61 int sgmii_2500 = 0;
62 struct mii_bus *bus = priv->mii_bus;
63
64 - if (priv->einfo->mii_config == PHY_INTERFACE_MODE_SGMII_2500)
65 + if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII)
66 sgmii_2500 = 1;
67
68 netif_info(priv, drv, ndev, "%s\n", __func__);
69 @@ -1198,7 +1224,7 @@ static int pfe_phy_init(struct net_devic
70 netif_info(priv, drv, ndev, "%s: %s\n", __func__, phy_id);
71 interface = priv->einfo->mii_config;
72 if ((interface == PHY_INTERFACE_MODE_SGMII) ||
73 - (interface == PHY_INTERFACE_MODE_SGMII_2500)) {
74 + (interface == PHY_INTERFACE_MODE_2500SGMII)) {
75 /*Configure SGMII PCS */
76 if (pfe->scfg) {
77 /*Config MDIO from serdes */