diff options
author | Yangbo Lu <yangbo.lu@nxp.com> | 2020-04-10 10:47:05 +0800 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-05-07 12:53:06 +0200 |
commit | cddd4591404fb4c53dc0b3c0b15b942cdbed4356 (patch) | |
tree | 392c1179de46b0f804e3789edca19069b64e6b44 /target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch | |
parent | d1d2c0b5579ea4f69a42246c9318539d61ba1999 (diff) | |
download | upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.gz upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.bz2 upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.zip |
layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/
For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.
The patches are sorted into the following categories:
301-arch-xxxx
302-dts-xxxx
303-core-xxxx
701-net-xxxx
801-audio-xxxx
802-can-xxxx
803-clock-xxxx
804-crypto-xxxx
805-display-xxxx
806-dma-xxxx
807-gpio-xxxx
808-i2c-xxxx
809-jailhouse-xxxx
810-keys-xxxx
811-kvm-xxxx
812-pcie-xxxx
813-pm-xxxx
814-qe-xxxx
815-sata-xxxx
816-sdhc-xxxx
817-spi-xxxx
818-thermal-xxxx
819-uart-xxxx
820-usb-xxxx
821-vfio-xxxx
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
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.patch | 192 |
1 files changed, 192 insertions, 0 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 new file mode 100644 index 0000000000..b558a78cee --- /dev/null +++ b/target/linux/layerscape/patches-5.4/701-net-0278-enetc-export-enetc_mdio-definitionns-to-include-linu.patch @@ -0,0 +1,192 @@ +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); |