1 From 78378454e7978ea3b4128822880677e6efa9ddef Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Mon, 6 Jan 2020 14:31:22 +0200
4 Subject: [PATCH] Revert "enetc: export enetc_mdio definitionns to
7 This reverts commit f8d80c003b76f397696bf887ebbd37a78781c050.
9 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
11 drivers/net/ethernet/freescale/enetc/enetc_mdio.c | 18 +---------
12 drivers/net/ethernet/freescale/enetc/enetc_mdio.h | 12 +++++++
13 .../net/ethernet/freescale/enetc/enetc_pci_mdio.c | 41 +++++++++-------------
14 include/linux/fsl/enetc_mdio.h | 21 -----------
15 4 files changed, 30 insertions(+), 62 deletions(-)
16 create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_mdio.h
17 delete mode 100644 include/linux/fsl/enetc_mdio.h
19 --- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
20 +++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
22 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
23 /* Copyright 2019 NXP */
25 -#include <linux/fsl/enetc_mdio.h>
26 #include <linux/mdio.h>
27 #include <linux/of_mdio.h>
28 #include <linux/iopoll.h>
32 +#include "enetc_mdio.h"
34 #define ENETC_MDIO_CFG 0x0 /* MDIO configuration and status */
35 #define ENETC_MDIO_CTL 0x4 /* MDIO control */
36 @@ -99,7 +99,6 @@ int enetc_mdio_write(struct mii_bus *bus
40 -EXPORT_SYMBOL_GPL(enetc_mdio_write);
42 int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
44 @@ -155,21 +154,6 @@ int enetc_mdio_read(struct mii_bus *bus,
48 -EXPORT_SYMBOL_GPL(enetc_mdio_read);
50 -struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs)
52 - struct enetc_hw *hw;
54 - hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
56 - return ERR_PTR(-ENOMEM);
58 - hw->port = port_regs;
62 -EXPORT_SYMBOL_GPL(enetc_hw_alloc);
64 int enetc_mdio_probe(struct enetc_pf *pf)
67 +++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.h
69 +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
70 +/* Copyright 2019 NXP */
72 +#include <linux/phy.h>
74 +struct enetc_mdio_priv {
75 + struct enetc_hw *hw;
79 +int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value);
80 +int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum);
81 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
82 +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
84 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
85 /* Copyright 2019 NXP */
86 -#include <linux/fsl/enetc_mdio.h>
87 #include <linux/of_mdio.h>
89 +#include "enetc_mdio.h"
91 #define ENETC_MDIO_DEV_ID 0xee01
92 #define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO"
93 @@ -14,29 +14,17 @@ static int enetc_pci_mdio_probe(struct p
95 struct enetc_mdio_priv *mdio_priv;
96 struct device *dev = &pdev->dev;
97 - void __iomem *port_regs;
102 - port_regs = pci_iomap(pdev, 0, 0);
104 - dev_err(dev, "iomap failed\n");
109 - hw = enetc_hw_alloc(dev, port_regs);
110 - if (IS_ERR(enetc_hw_alloc)) {
114 + hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
118 bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv));
121 - goto err_mdiobus_alloc;
126 bus->name = ENETC_MDIO_BUS_NAME;
127 bus->read = enetc_mdio_read;
128 @@ -51,7 +39,7 @@ static int enetc_pci_mdio_probe(struct p
129 err = pci_enable_device_mem(pdev);
131 dev_err(dev, "device enable failed\n");
132 - goto err_pci_enable;
136 err = pci_request_region(pdev, 0, KBUILD_MODNAME);
137 @@ -60,6 +48,13 @@ static int enetc_pci_mdio_probe(struct p
138 goto err_pci_mem_reg;
141 + hw->port = pci_iomap(pdev, 0, 0);
144 + dev_err(dev, "iomap failed\n");
148 err = of_mdiobus_register(bus, dev->of_node);
150 goto err_mdiobus_reg;
151 @@ -69,14 +64,12 @@ static int enetc_pci_mdio_probe(struct p
155 + iounmap(mdio_priv->hw->port);
157 pci_release_mem_regions(pdev);
159 pci_disable_device(pdev);
162 - iounmap(port_regs);
169 --- a/include/linux/fsl/enetc_mdio.h
172 -/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
173 -/* Copyright 2019 NXP */
175 -#include <linux/phy.h>
178 -#define ENETC_PCS_LINK_TIMER1 0x12
179 -#define ENETC_PCS_LINK_TIMER1_VAL 0x06a0
180 -#define ENETC_PCS_LINK_TIMER2 0x13
181 -#define ENETC_PCS_LINK_TIMER2_VAL 0x0003
182 -#define ENETC_PCS_IF_MODE 0x14
183 -#define ENETC_PCS_IF_MODE_SGMII_AN 0x0003
185 -struct enetc_mdio_priv {
186 - struct enetc_hw *hw;
190 -int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value);
191 -int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum);
192 -struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs);