aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch')
-rw-r--r--target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch192
1 files changed, 0 insertions, 192 deletions
diff --git a/target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch b/target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch
deleted file mode 100644
index b558a78cee..0000000000
--- a/target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch
+++ /dev/null
@@ -1,192 +0,0 @@
-From 210fde07cd9e3f2dc826f538ccec4e90b54eb7e5 Mon Sep 17 00:00:00 2001
-From: Vladimir Oltean <vladimir.oltean@nxp.com>
-Date: Fri, 22 Nov 2019 17:47:56 +0200
-Subject: [PATCH] enetc: export enetc_mdio definitionns to include/linux/fsl
-
-The Felix DSA switch has an internal MDIO bus that has the same register
-map as the ENETC one, so the accessors can be reused.
-
-Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
----
- drivers/net/ethernet/freescale/enetc/enetc_mdio.c | 18 +++++++++-
- drivers/net/ethernet/freescale/enetc/enetc_mdio.h | 12 -------
- .../net/ethernet/freescale/enetc/enetc_pci_mdio.c | 41 +++++++++++++---------
- include/linux/fsl/enetc_mdio.h | 21 +++++++++++
- 4 files changed, 62 insertions(+), 30 deletions(-)
- delete mode 100644 drivers/net/ethernet/freescale/enetc/enetc_mdio.h
- create mode 100644 include/linux/fsl/enetc_mdio.h
-
---- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
-+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
-@@ -1,13 +1,13 @@
- // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
- /* Copyright 2019 NXP */
-
-+#include <linux/fsl/enetc_mdio.h>
- #include <linux/mdio.h>
- #include <linux/of_mdio.h>
- #include <linux/iopoll.h>
- #include <linux/of.h>
-
- #include "enetc_pf.h"
--#include "enetc_mdio.h"
-
- #define ENETC_MDIO_CFG 0x0 /* MDIO configuration and status */
- #define ENETC_MDIO_CTL 0x4 /* MDIO control */
-@@ -99,6 +99,7 @@ int enetc_mdio_write(struct mii_bus *bus
-
- return 0;
- }
-+EXPORT_SYMBOL_GPL(enetc_mdio_write);
-
- int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
- {
-@@ -154,6 +155,21 @@ int enetc_mdio_read(struct mii_bus *bus,
-
- return value;
- }
-+EXPORT_SYMBOL_GPL(enetc_mdio_read);
-+
-+struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs)
-+{
-+ struct enetc_hw *hw;
-+
-+ hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
-+ if (!hw)
-+ return ERR_PTR(-ENOMEM);
-+
-+ hw->port = port_regs;
-+
-+ return hw;
-+}
-+EXPORT_SYMBOL_GPL(enetc_hw_alloc);
-
- int enetc_mdio_probe(struct enetc_pf *pf)
- {
---- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.h
-+++ /dev/null
-@@ -1,12 +0,0 @@
--/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
--/* Copyright 2019 NXP */
--
--#include <linux/phy.h>
--
--struct enetc_mdio_priv {
-- struct enetc_hw *hw;
-- int mdio_base;
--};
--
--int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value);
--int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum);
---- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
-+++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
-@@ -1,8 +1,8 @@
- // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
- /* Copyright 2019 NXP */
-+#include <linux/fsl/enetc_mdio.h>
- #include <linux/of_mdio.h>
- #include "enetc_pf.h"
--#include "enetc_mdio.h"
-
- #define ENETC_MDIO_DEV_ID 0xee01
- #define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO"
-@@ -14,17 +14,29 @@ static int enetc_pci_mdio_probe(struct p
- {
- struct enetc_mdio_priv *mdio_priv;
- struct device *dev = &pdev->dev;
-+ void __iomem *port_regs;
- struct enetc_hw *hw;
- struct mii_bus *bus;
- int err;
-
-- hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
-- if (!hw)
-- return -ENOMEM;
-+ port_regs = pci_iomap(pdev, 0, 0);
-+ if (!port_regs) {
-+ dev_err(dev, "iomap failed\n");
-+ err = -ENXIO;
-+ goto err_ioremap;
-+ }
-+
-+ hw = enetc_hw_alloc(dev, port_regs);
-+ if (IS_ERR(enetc_hw_alloc)) {
-+ err = PTR_ERR(hw);
-+ goto err_hw_alloc;
-+ }
-
- bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv));
-- if (!bus)
-- return -ENOMEM;
-+ if (!bus) {
-+ err = -ENOMEM;
-+ goto err_mdiobus_alloc;
-+ }
-
- bus->name = ENETC_MDIO_BUS_NAME;
- bus->read = enetc_mdio_read;
-@@ -39,7 +51,7 @@ static int enetc_pci_mdio_probe(struct p
- err = pci_enable_device_mem(pdev);
- if (err) {
- dev_err(dev, "device enable failed\n");
-- return err;
-+ goto err_pci_enable;
- }
-
- err = pci_request_region(pdev, 0, KBUILD_MODNAME);
-@@ -48,13 +60,6 @@ static int enetc_pci_mdio_probe(struct p
- goto err_pci_mem_reg;
- }
-
-- hw->port = pci_iomap(pdev, 0, 0);
-- if (!hw->port) {
-- err = -ENXIO;
-- dev_err(dev, "iomap failed\n");
-- goto err_ioremap;
-- }
--
- err = of_mdiobus_register(bus, dev->of_node);
- if (err)
- goto err_mdiobus_reg;
-@@ -64,12 +69,14 @@ static int enetc_pci_mdio_probe(struct p
- return 0;
-
- err_mdiobus_reg:
-- iounmap(mdio_priv->hw->port);
--err_ioremap:
- pci_release_mem_regions(pdev);
- err_pci_mem_reg:
- pci_disable_device(pdev);
--
-+err_pci_enable:
-+err_mdiobus_alloc:
-+ iounmap(port_regs);
-+err_hw_alloc:
-+err_ioremap:
- return err;
- }
-
---- /dev/null
-+++ b/include/linux/fsl/enetc_mdio.h
-@@ -0,0 +1,21 @@
-+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
-+/* Copyright 2019 NXP */
-+
-+#include <linux/phy.h>
-+
-+/* PCS registers */
-+#define ENETC_PCS_LINK_TIMER1 0x12
-+#define ENETC_PCS_LINK_TIMER1_VAL 0x06a0
-+#define ENETC_PCS_LINK_TIMER2 0x13
-+#define ENETC_PCS_LINK_TIMER2_VAL 0x0003
-+#define ENETC_PCS_IF_MODE 0x14
-+#define ENETC_PCS_IF_MODE_SGMII_AN 0x0003
-+
-+struct enetc_mdio_priv {
-+ struct enetc_hw *hw;
-+ int mdio_base;
-+};
-+
-+int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value);
-+int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum);
-+struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs);