From: Adrian Schmutzler Date: Wed, 19 Aug 2020 13:41:30 +0000 (+0200) Subject: layerscape: remove useless pairs of kernel patches X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=cf7c101135934710b1958092da9a0c9ad446de4b;p=openwrt%2Fstaging%2Fnoltari.git layerscape: remove useless pairs of kernel patches The layerscape kernel patches appears to be just some uncleaned local development tree, where patches are sometimes directly followed by their revert. While this does not seem a problem in the first place, it becomes incredibly unpleasant when the upstream kernel changes in the relevant areas and requires rebase. This removes all these patch-revert pairs and refreshs the rest. It removes about 44000 lines of entirely useless code. Signed-off-by: Adrian Schmutzler --- diff --git a/target/linux/layerscape/patches-5.4/302-dts-0085-arm64-dts-LS1028a-rdb-use-Ethernet-PHY-interrupt.patch b/target/linux/layerscape/patches-5.4/302-dts-0085-arm64-dts-LS1028a-rdb-use-Ethernet-PHY-interrupt.patch deleted file mode 100644 index 17286a815e..0000000000 --- a/target/linux/layerscape/patches-5.4/302-dts-0085-arm64-dts-LS1028a-rdb-use-Ethernet-PHY-interrupt.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 3dc3a4c6ac9e8a0940a9974b8fe2da7641bfa3dd Mon Sep 17 00:00:00 2001 -From: Alex Marginean -Date: Thu, 22 Aug 2019 12:47:12 +0300 -Subject: [PATCH] arm64: dts: LS1028a-rdb: use Ethernet PHY interrupt - -Use the PHY interrupt wired to GPIO pins as part of MDIO WA performance -impact mitigation. - -Signed-off-by: Alex Marginean ---- - arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts -+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts -@@ -202,6 +202,8 @@ - #size-cells = <0>; - sgmii_phy0: ethernet-phy@2 { - reg = <0x2>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - }; - }; -@@ -213,18 +215,26 @@ - &enetc_mdio_pf3 { - qsgmii_phy1: ethernet-phy@4 { - reg = <0x10>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - - qsgmii_phy2: ethernet-phy@5 { - reg = <0x11>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - - qsgmii_phy3: ethernet-phy@6 { - reg = <0x12>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - - qsgmii_phy4: ethernet-phy@7 { - reg = <0x13>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - }; - diff --git a/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch b/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch index a6d2253c73..a0fd27e350 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch @@ -32,7 +32,7 @@ Signed-off-by: Wen He --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts -@@ -272,13 +272,6 @@ +@@ -262,13 +262,6 @@ }; &hdptx0 { diff --git a/target/linux/layerscape/patches-5.4/302-dts-0108-Revert-arm64-dts-LS1028a-rdb-use-Ethernet-PHY-interr.patch b/target/linux/layerscape/patches-5.4/302-dts-0108-Revert-arm64-dts-LS1028a-rdb-use-Ethernet-PHY-interr.patch deleted file mode 100644 index efb5cb6cb1..0000000000 --- a/target/linux/layerscape/patches-5.4/302-dts-0108-Revert-arm64-dts-LS1028a-rdb-use-Ethernet-PHY-interr.patch +++ /dev/null @@ -1,85 +0,0 @@ -From c57a0efc17627d0077408544ded02674aefdecae Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 16:59:02 +0200 -Subject: [PATCH] Revert "arm64: dts: LS1028a-rdb: use Ethernet PHY interrupt" - -This reverts commit 841edb98671cfc4d6f010393ac429c78082ec4bd. - -There are 2 separate issues with interrupts on the LS1028A-RDB board: - -1. The GPIO1_DAT25 interrupt line is shared, so there is a real risk of - race conditions if used in edge-triggered mode, as we currently do. - This can be illustrated in the following setup: - - Take 2 LS1028A-RDB boards - - Connect swp0 to swp0, swp1 to swp1, swp2 to swp2 - - Plug/unplug the power to board 2, 10 times in a row. This will make - the PHYs lose link simultaneously. - - Notice that at one point, the net devices on board 1 remain in a - state where not all the links are down (visible in "ip link"): - - 5: swp0: mtu 1468 qdisc pfifo_fast master br0 state UP mode DEFAULT group default qlen 1000 - link/ether be:97:36:d3:3d:70 brd ff:ff:ff:ff:ff:ff - 6: swp1: mtu 1468 qdisc pfifo_fast master br0 state UP mode DEFAULT group default qlen 1000 - link/ether be:97:36:d3:3d:71 brd ff:ff:ff:ff:ff:ff - 7: swp2: mtu 1468 qdisc pfifo_fast master br0 state DOWN mode DEFAULT group default qlen 1000 - link/ether be:97:36:d3:3d:72 brd ff:ff:ff:ff:ff:ff - - This cannot be solved by making the interrupts level-triggered, - because the gpio-mpc8xxx controller only supports generating - edge-triggered interrupts. So the effective reality is that we - cannot not use shared interrupts connected to the gpio1 - interrupt-parent. - -2. The uBUS1 and uBUS2 slots that share this interrupt line with the - Ethernet PHYs are not pulled up by default, they are left floating on - current revisions of the LS1028A-RDB boards. So sufficient electrical - noise on these lines will make the CPLD think there's an interrupt - request, so it asserts the GPIO1_DAT25 signal and leaves it asserted. - This means that the PHYs on those boards will never have link when - used in interrupt mode, because their IRQ will be masked by the uBUS - line that is erroneously kept asserted. In poll mode this issue does - not occur. - -Signed-off-by: Vladimir Oltean ---- - arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts | 10 ---------- - 1 file changed, 10 deletions(-) - ---- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts -+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts -@@ -206,8 +206,6 @@ - #size-cells = <0>; - sgmii_phy0: ethernet-phy@2 { - reg = <0x2>; -- interrupt-parent = <&gpio1>; -- interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - }; - }; -@@ -219,26 +217,18 @@ - &enetc_mdio_pf3 { - qsgmii_phy1: ethernet-phy@4 { - reg = <0x10>; -- interrupt-parent = <&gpio1>; -- interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - - qsgmii_phy2: ethernet-phy@5 { - reg = <0x11>; -- interrupt-parent = <&gpio1>; -- interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - - qsgmii_phy3: ethernet-phy@6 { - reg = <0x12>; -- interrupt-parent = <&gpio1>; -- interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - - qsgmii_phy4: ethernet-phy@7 { - reg = <0x13>; -- interrupt-parent = <&gpio1>; -- interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - }; - }; - diff --git a/target/linux/layerscape/patches-5.4/701-net-0275-mii-Add-helpers-for-parsing-SGMII-auto-negotiation.patch b/target/linux/layerscape/patches-5.4/701-net-0275-mii-Add-helpers-for-parsing-SGMII-auto-negotiation.patch deleted file mode 100644 index c783143dd7..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0275-mii-Add-helpers-for-parsing-SGMII-auto-negotiation.patch +++ /dev/null @@ -1,117 +0,0 @@ -From bc447c21304c1297f340d3daaf69915ebbc1f882 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 30 Sep 2019 19:20:26 +0300 -Subject: [PATCH] mii: Add helpers for parsing SGMII auto-negotiation - -Typically a MAC PCS auto-configures itself after it receives the -negotiated link settings from the PHY, but some MAC devices are more -special and need manual manipulation of the SGMII AN result. - -Therefore, add the bit definitions for the SGMII registers 4 and 5 -(local device ability, link partner ability), as well as a link_mode -conversion helper that can be used to feed the AN results into -phy_resolve_aneg_linkmode. - -Signed-off-by: Vladimir Oltean ---- - include/linux/mii.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ - include/uapi/linux/mii.h | 10 ++++++++++ - 2 files changed, 60 insertions(+) - ---- a/include/linux/mii.h -+++ b/include/linux/mii.h -@@ -373,6 +373,56 @@ static inline u32 mii_lpa_to_ethtool_lpa - } - - /** -+ * mii_lpa_mod_linkmode_adv_sgmii -+ * @lp_advertising: pointer to destination link mode. -+ * @lpa: value of the MII_LPA register -+ * -+ * A small helper function that translates MII_LPA bits to -+ * linkmode advertisement settings for SGMII. -+ * Leaves other bits unchanged. -+ */ -+static inline void -+mii_lpa_mod_linkmode_lpa_sgmii(unsigned long *lp_advertising, u32 lpa) -+{ -+ u32 speed_duplex = lpa & LPA_SGMII_DPX_SPD_MASK; -+ -+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, lp_advertising, -+ speed_duplex == LPA_SGMII_1000HALF); -+ -+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, lp_advertising, -+ speed_duplex == LPA_SGMII_1000FULL); -+ -+ linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, lp_advertising, -+ speed_duplex == LPA_SGMII_100HALF); -+ -+ linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, lp_advertising, -+ speed_duplex == LPA_SGMII_100FULL); -+ -+ linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, lp_advertising, -+ speed_duplex == LPA_SGMII_10HALF); -+ -+ linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, lp_advertising, -+ speed_duplex == LPA_SGMII_10FULL); -+} -+ -+/** -+ * mii_lpa_to_linkmode_adv_sgmii -+ * @advertising: pointer to destination link mode. -+ * @lpa: value of the MII_LPA register -+ * -+ * A small helper function that translates MII_ADVERTISE bits -+ * to linkmode advertisement settings when in SGMII mode. -+ * Clears the old value of advertising. -+ */ -+static inline void mii_lpa_to_linkmode_lpa_sgmii(unsigned long *lp_advertising, -+ u32 lpa) -+{ -+ linkmode_zero(lp_advertising); -+ -+ mii_lpa_mod_linkmode_lpa_sgmii(lp_advertising, lpa); -+} -+ -+/** - * mii_adv_mod_linkmode_adv_t - * @advertising:pointer to destination link mode. - * @adv: value of the MII_ADVERTISE register ---- a/include/uapi/linux/mii.h -+++ b/include/uapi/linux/mii.h -@@ -71,6 +71,7 @@ - /* Advertisement control register. */ - #define ADVERTISE_SLCT 0x001f /* Selector bits */ - #define ADVERTISE_CSMA 0x0001 /* Only selector supported */ -+#define ADVERTISE_SGMII 0x0001 /* Can do SGMII */ - #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ - #define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ - #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ -@@ -94,6 +95,7 @@ - - /* Link partner ability register. */ - #define LPA_SLCT 0x001f /* Same as advertise selector */ -+#define LPA_SGMII 0x0001 /* Can do SGMII */ - #define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ - #define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */ - #define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ -@@ -104,11 +106,19 @@ - #define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/ - #define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ - #define LPA_PAUSE_CAP 0x0400 /* Can pause */ -+#define LPA_SGMII_DPX_SPD_MASK 0x1C00 /* SGMII duplex and speed bits */ -+#define LPA_SGMII_10HALF 0x0000 /* Can do SGMII 10mbps half-duplex */ -+#define LPA_SGMII_10FULL 0x1000 /* Can do SGMII 10mbps full-duplex */ -+#define LPA_SGMII_100HALF 0x0400 /* Can do SGMII 100mbps half-duplex */ -+#define LPA_SGMII_100FULL 0x1400 /* Can do SGMII 100mbps full-duplex */ - #define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ -+#define LPA_SGMII_1000HALF 0x0800 /* Can do SGMII 1000mbps half-duplex */ -+#define LPA_SGMII_1000FULL 0x1800 /* Can do SGMII 1000mbps full-duplex */ - #define LPA_RESV 0x1000 /* Unused... */ - #define LPA_RFAULT 0x2000 /* Link partner faulted */ - #define LPA_LPACK 0x4000 /* Link partner acked us */ - #define LPA_NPAGE 0x8000 /* Next page bit */ -+#define LPA_SGMII_LINK 0x8000 /* Link partner has link */ - - #define LPA_DUPLEX (LPA_10FULL | LPA_100FULL) - #define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4) diff --git a/target/linux/layerscape/patches-5.4/701-net-0276-net-phylink-make-QSGMII-a-valid-PHY-mode-for-in-band.patch b/target/linux/layerscape/patches-5.4/701-net-0276-net-phylink-make-QSGMII-a-valid-PHY-mode-for-in-band.patch deleted file mode 100644 index d04ed91139..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0276-net-phylink-make-QSGMII-a-valid-PHY-mode-for-in-band.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 4446e9789e662fe53dfcfe34551b5b74a013086c Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Fri, 22 Nov 2019 13:46:46 +0200 -Subject: [PATCH] net: phylink: make QSGMII a valid PHY mode for in-band AN - -QSGMII is just SGMII clocked at a higher frequency (5 Gbaud vs 1.25 -Gbaud). Logically it is just 4 SGMII interfaces multiplexed onto the -same physical lanes. Each MAC PCS has its own in-band AN process with -the system side of the QSGMII PHY, which is identical to the regular -SGMII AN process. So allow QSGMII as a valid in-band AN mode. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/phy/phylink.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/phy/phylink.c -+++ b/drivers/net/phy/phylink.c -@@ -283,6 +283,7 @@ static int phylink_parse_mode(struct phy - - switch (pl->link_config.interface) { - case PHY_INTERFACE_MODE_SGMII: -+ case PHY_INTERFACE_MODE_QSGMII: - phylink_set(pl->supported, 10baseT_Half); - phylink_set(pl->supported, 10baseT_Full); - phylink_set(pl->supported, 100baseT_Half); diff --git a/target/linux/layerscape/patches-5.4/701-net-0277-net-phylink-call-mac_an_restart-for-SGMII-QSGMII-inb.patch b/target/linux/layerscape/patches-5.4/701-net-0277-net-phylink-call-mac_an_restart-for-SGMII-QSGMII-inb.patch deleted file mode 100644 index 487a520f32..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0277-net-phylink-call-mac_an_restart-for-SGMII-QSGMII-inb.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d526228a8159d136c914c8f71d5944cda2f93d9a Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Thu, 28 Nov 2019 03:21:53 +0200 -Subject: [PATCH] net: phylink: call mac_an_restart for SGMII/QSGMII inband - interfaces too - -It doesn't quite make sense why restarting the AN process should be -unique to 802.3z (1000Base-X) modes. It is valid to put an SGMII PCS in -in-band AN mode, therefore also make PHYLINK re-trigger an -auto-negotiation if needed. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/phy/phylink.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/phy/phylink.c -+++ b/drivers/net/phy/phylink.c -@@ -360,7 +360,9 @@ static void phylink_mac_config_up(struct - static void phylink_mac_an_restart(struct phylink *pl) - { - if (pl->link_config.an_enabled && -- phy_interface_mode_is_8023z(pl->link_config.interface)) -+ (phy_interface_mode_is_8023z(pl->link_config.interface) || -+ pl->link_config.interface == PHY_INTERFACE_MODE_SGMII || -+ pl->link_config.interface == PHY_INTERFACE_MODE_QSGMII)) - pl->ops->mac_an_restart(pl->config); - } - 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 -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 ---- - 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 - #include - #include - #include - #include - - #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 -- --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 - #include - #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 -+ -+/* 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); diff --git a/target/linux/layerscape/patches-5.4/701-net-0279-enetc-Set-MDIO_CFG_HOLD-to-the-recommended-value-of-.patch b/target/linux/layerscape/patches-5.4/701-net-0279-enetc-Set-MDIO_CFG_HOLD-to-the-recommended-value-of-.patch deleted file mode 100644 index 02ead2712f..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0279-enetc-Set-MDIO_CFG_HOLD-to-the-recommended-value-of-.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 5961ca6738507031a64f8580ceb8ab0b630d47a5 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Wed, 27 Nov 2019 19:21:13 +0200 -Subject: [PATCH] enetc: Set MDIO_CFG_HOLD to the recommended value of 2 - -This increases the MDIO hold time to 5 enet_clk cycles from the previous -value of 0. This is actually the out-of-reset value, that the driver was -previously overwriting with 0. Zero worked for the external MDIO, but -breaks communication with the internal MDIO buses on which the PCS of -ENETC SI's and Felix switch are found. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/ethernet/freescale/enetc/enetc_mdio.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - ---- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c -+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c -@@ -31,15 +31,19 @@ static inline void _enetc_mdio_wr(struct - _enetc_mdio_wr(mdio_priv, ENETC_##off, val) - #define enetc_mdio_rd_reg(off) enetc_mdio_rd(mdio_priv, off) - --#define ENETC_MDC_DIV 258 -- - #define MDIO_CFG_CLKDIV(x) ((((x) >> 1) & 0xff) << 8) - #define MDIO_CFG_BSY BIT(0) - #define MDIO_CFG_RD_ER BIT(1) -+#define MDIO_CFG_HOLD(x) (((x) << 2) & GENMASK(4, 2)) - #define MDIO_CFG_ENC45 BIT(6) - /* external MDIO only - driven on neg MDC edge */ - #define MDIO_CFG_NEG BIT(23) - -+#define ENETC_EMDIO_CFG \ -+ (MDIO_CFG_HOLD(2) | \ -+ MDIO_CFG_CLKDIV(258) | \ -+ MDIO_CFG_NEG) -+ - #define MDIO_CTL_DEV_ADDR(x) ((x) & 0x1f) - #define MDIO_CTL_PORT_ADDR(x) (((x) & 0x1f) << 5) - #define MDIO_CTL_READ BIT(15) -@@ -61,7 +65,7 @@ int enetc_mdio_write(struct mii_bus *bus - u16 dev_addr; - int ret; - -- mdio_cfg = MDIO_CFG_CLKDIV(ENETC_MDC_DIV) | MDIO_CFG_NEG; -+ mdio_cfg = ENETC_EMDIO_CFG; - if (regnum & MII_ADDR_C45) { - dev_addr = (regnum >> 16) & 0x1f; - mdio_cfg |= MDIO_CFG_ENC45; -@@ -108,7 +112,7 @@ int enetc_mdio_read(struct mii_bus *bus, - u16 dev_addr, value; - int ret; - -- mdio_cfg = MDIO_CFG_CLKDIV(ENETC_MDC_DIV) | MDIO_CFG_NEG; -+ mdio_cfg = ENETC_EMDIO_CFG; - if (regnum & MII_ADDR_C45) { - dev_addr = (regnum >> 16) & 0x1f; - mdio_cfg |= MDIO_CFG_ENC45; diff --git a/target/linux/layerscape/patches-5.4/701-net-0280-net-mscc-ocelot-do-not-force-Felix-MACs-at-lower-spe.patch b/target/linux/layerscape/patches-5.4/701-net-0280-net-mscc-ocelot-do-not-force-Felix-MACs-at-lower-spe.patch deleted file mode 100644 index a31321fd17..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0280-net-mscc-ocelot-do-not-force-Felix-MACs-at-lower-spe.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 4ba6e00c2f45bf4189ec6a8ef71b45346ae804f2 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Thu, 28 Nov 2019 15:36:10 +0200 -Subject: [PATCH] net: mscc: ocelot: do not force Felix MACs at lower speeds - than gigabit - -In the LS1028A, the VSC9959 switch was integrated with an NXP PCS which -performs SGMII AN and rate adaptation autonomously. The MAC does not -need to know about this, and forcing the MAC speed to something else, -when connected to a 10/100 link partner, actually breaks the GMII -internal link between the MAC and the PCS. - -Add a quirk system in the ocelot driver, and a first quirk called "PCS -performs rate adaptation", to distinguish the VSC7514 from the VSC9959 -regarding this behavior. - -Signed-off-by: Catalin Horghidan -Signed-off-by: Vladimir Oltean ---- - drivers/net/dsa/ocelot/felix.c | 1 + - drivers/net/dsa/ocelot/felix.h | 1 + - drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + - drivers/net/ethernet/mscc/ocelot.c | 32 ++++++++++++++++++-------------- - include/soc/mscc/ocelot.h | 7 +++++++ - 5 files changed, 28 insertions(+), 14 deletions(-) - ---- a/drivers/net/dsa/ocelot/felix.c -+++ b/drivers/net/dsa/ocelot/felix.c -@@ -249,6 +249,7 @@ static int felix_init_structs(struct fel - ocelot->num_stats = felix->info->num_stats; - ocelot->shared_queue_sz = felix->info->shared_queue_sz; - ocelot->ops = felix->info->ops; -+ ocelot->quirks = felix->info->quirks; - - base = pci_resource_start(felix->pdev, felix->info->pci_bar); - ---- a/drivers/net/dsa/ocelot/felix.h -+++ b/drivers/net/dsa/ocelot/felix.h -@@ -18,6 +18,7 @@ struct felix_info { - unsigned int num_stats; - int num_ports; - int pci_bar; -+ unsigned long quirks; - }; - - extern struct felix_info felix_info_vsc9959; ---- a/drivers/net/dsa/ocelot/felix_vsc9959.c -+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c -@@ -584,4 +584,5 @@ struct felix_info felix_info_vsc9959 = { - .shared_queue_sz = 128 * 1024, - .num_ports = 6, - .pci_bar = 4, -+ .quirks = OCELOT_PCS_PERFORMS_RATE_ADAPTATION, - }; ---- a/drivers/net/ethernet/mscc/ocelot.c -+++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -409,27 +409,32 @@ static u16 ocelot_wm_enc(u16 value) - void ocelot_adjust_link(struct ocelot *ocelot, int port, - struct phy_device *phydev) - { -+ int speed, mac_speed, mac_mode = DEV_MAC_MODE_CFG_FDX_ENA; - struct ocelot_port *ocelot_port = ocelot->ports[port]; -- int speed, mode = 0; - -- switch (phydev->speed) { -+ if (ocelot->quirks & OCELOT_PCS_PERFORMS_RATE_ADAPTATION) -+ speed = SPEED_1000; -+ else -+ speed = phydev->speed; -+ -+ switch (speed) { - case SPEED_10: -- speed = OCELOT_SPEED_10; -+ mac_speed = OCELOT_SPEED_10; - break; - case SPEED_100: -- speed = OCELOT_SPEED_100; -+ mac_speed = OCELOT_SPEED_100; - break; - case SPEED_1000: -- speed = OCELOT_SPEED_1000; -- mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA; -+ mac_speed = OCELOT_SPEED_1000; -+ mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA; - break; - case SPEED_2500: -- speed = OCELOT_SPEED_2500; -- mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA; -+ mac_speed = OCELOT_SPEED_2500; -+ mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA; - break; - default: - dev_err(ocelot->dev, "Unsupported PHY speed on port %d: %d\n", -- port, phydev->speed); -+ port, speed); - return; - } - -@@ -439,8 +444,7 @@ void ocelot_adjust_link(struct ocelot *o - return; - - /* Only full duplex supported for now */ -- ocelot_port_writel(ocelot_port, DEV_MAC_MODE_CFG_FDX_ENA | -- mode, DEV_MAC_MODE_CFG); -+ ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG); - - if (ocelot->ops->pcs_init) - ocelot->ops->pcs_init(ocelot, port); -@@ -451,11 +455,11 @@ void ocelot_adjust_link(struct ocelot *o - - /* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of - * reset */ -- ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed), -+ ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(mac_speed), - DEV_CLOCK_CFG); - - /* No PFC */ -- ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed), -+ ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(mac_speed), - ANA_PFC_PFC_CFG, port); - - /* Core: Enable port for frame transfer */ -@@ -469,7 +473,7 @@ void ocelot_adjust_link(struct ocelot *o - SYS_MAC_FC_CFG_RX_FC_ENA | SYS_MAC_FC_CFG_TX_FC_ENA | - SYS_MAC_FC_CFG_ZERO_PAUSE_ENA | - SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) | -- SYS_MAC_FC_CFG_FC_LINK_SPEED(speed), -+ SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed), - SYS_MAC_FC_CFG, port); - ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); - } ---- a/include/soc/mscc/ocelot.h -+++ b/include/soc/mscc/ocelot.h -@@ -404,6 +404,11 @@ enum ocelot_tag_prefix { - OCELOT_TAG_PREFIX_LONG, - }; - -+/* Hardware quirks (differences between switch instantiations) */ -+enum { -+ OCELOT_PCS_PERFORMS_RATE_ADAPTATION = BIT(0), -+}; -+ - struct ocelot; - - struct ocelot_ops { -@@ -464,6 +469,8 @@ struct ocelot { - struct delayed_work stats_work; - struct workqueue_struct *stats_queue; - -+ unsigned long quirks; -+ - u8 ptp:1; - struct ptp_clock *ptp_clock; - struct ptp_clock_info ptp_info; diff --git a/target/linux/layerscape/patches-5.4/701-net-0281-net-mscc-ocelot-convert-to-PHYLINK.patch b/target/linux/layerscape/patches-5.4/701-net-0281-net-mscc-ocelot-convert-to-PHYLINK.patch deleted file mode 100644 index fcf28b8667..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0281-net-mscc-ocelot-convert-to-PHYLINK.patch +++ /dev/null @@ -1,689 +0,0 @@ -From 0a2b7489bf60d24a54e16147b416f339ebe4f511 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 18 Nov 2019 18:05:01 +0200 -Subject: [PATCH] net: mscc: ocelot: convert to PHYLINK - -This patch reworks ocelot_board.c (aka the MIPS on the VSC7514) to -register a PHYLINK instance for each port. The registration code is -local to the VSC7514, but the PHYLINK callback implementation is common -so that the Felix DSA front-end can use it as well (but DSA does its own -registration). - -Now Felix can use native PHYLINK callbacks instead of the PHYLIB -adaptation layer in DSA, which had issues supporting fixed-link slave -ports (no struct phy_device to pass to the adjust_link callback), as -well as fixed-link CPU port at 2.5Gbps. - -The old code from ocelot_port_enable and ocelot_port_disable has been -moved into ocelot_phylink_mac_link_up and ocelot_phylink_mac_link_down. - -The PHY connect operation has been moved from ocelot_port_open to -mscc_ocelot_probe in ocelot_board.c. - -The phy_set_mode_ext() call for the SerDes PHY has also been moved into -mscc_ocelot_probe from ocelot_port_open, and since that was the only -reason why a reference to it was kept in ocelot_port_private, that -reference was removed. - -Again, the usage of phy_interface_t phy_mode is now local to -mscc_ocelot_probe only, after moving the PHY connect operation. -So it was also removed from ocelot_port_private. -*Maybe* in the future, it can be added back to the common struct -ocelot_port, with the purpose of validating mismatches between -state->phy_interface and ocelot_port->phy_mode in PHYLINK callbacks. -But at the moment that is not critical, since other DSA drivers are not -doing that either. No SFP+ modules are in use with Felix/Ocelot yet, to -my knowledge. - -In-band AN is not yet supported, due to the fact that this is a mostly -mechanical patch for the moment. The mac_an_restart PHYLINK operation -needs to be implemented, as well as mac_link_state. Both are SerDes -specific, and Felix does not have its PCS configured yet (it works just -by virtue of U-Boot initialization at the moment). - -Signed-off-by: Vladimir Oltean ---- - drivers/net/dsa/ocelot/felix.c | 65 +++++++++---- - drivers/net/ethernet/mscc/Kconfig | 2 +- - drivers/net/ethernet/mscc/ocelot.c | 150 ++++++++++++++++-------------- - drivers/net/ethernet/mscc/ocelot.h | 13 +-- - drivers/net/ethernet/mscc/ocelot_board.c | 154 +++++++++++++++++++++++++++---- - include/soc/mscc/ocelot.h | 22 ++++- - 6 files changed, 289 insertions(+), 117 deletions(-) - ---- a/drivers/net/dsa/ocelot/felix.c -+++ b/drivers/net/dsa/ocelot/felix.c -@@ -58,14 +58,6 @@ static int felix_set_ageing_time(struct - return 0; - } - --static void felix_adjust_link(struct dsa_switch *ds, int port, -- struct phy_device *phydev) --{ -- struct ocelot *ocelot = ds->priv; -- -- ocelot_adjust_link(ocelot, port, phydev); --} -- - static int felix_fdb_dump(struct dsa_switch *ds, int port, - dsa_fdb_dump_cb_t *cb, void *data) - { -@@ -185,21 +177,59 @@ static int felix_tsn_enable(struct dsa_p - } - #endif - --static int felix_port_enable(struct dsa_switch *ds, int port, -- struct phy_device *phy) -+static void felix_phylink_validate(struct dsa_switch *ds, int port, -+ unsigned long *supported, -+ struct phylink_link_state *state) - { - struct ocelot *ocelot = ds->priv; - -- ocelot_port_enable(ocelot, port, phy); -+ ocelot_phylink_validate(ocelot, port, supported, state); -+} -+ -+static int felix_phylink_mac_pcs_get_state(struct dsa_switch *ds, int port, -+ struct phylink_link_state *state) -+{ -+ struct ocelot *ocelot = ds->priv; -+ -+ ocelot_phylink_mac_pcs_get_state(ocelot, port, state); - - return 0; - } - --static void felix_port_disable(struct dsa_switch *ds, int port) -+static void felix_phylink_mac_config(struct dsa_switch *ds, int port, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) -+{ -+ struct ocelot *ocelot = ds->priv; -+ -+ ocelot_phylink_mac_config(ocelot, port, link_an_mode, state); -+} -+ -+static void felix_phylink_mac_an_restart(struct dsa_switch *ds, int port) -+{ -+ struct ocelot *ocelot = ds->priv; -+ -+ ocelot_phylink_mac_an_restart(ocelot, port); -+} -+ -+static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, -+ unsigned int link_an_mode, -+ phy_interface_t interface) -+{ -+ struct ocelot *ocelot = ds->priv; -+ -+ ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface); -+} -+ -+static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, -+ unsigned int link_an_mode, -+ phy_interface_t interface, -+ struct phy_device *phydev) - { - struct ocelot *ocelot = ds->priv; - -- return ocelot_port_disable(ocelot, port); -+ ocelot_phylink_mac_link_up(ocelot, port, link_an_mode, interface, -+ phydev); - } - - static void felix_get_strings(struct dsa_switch *ds, int port, -@@ -417,9 +447,12 @@ static const struct dsa_switch_ops felix - .get_ethtool_stats = felix_get_ethtool_stats, - .get_sset_count = felix_get_sset_count, - .get_ts_info = felix_get_ts_info, -- .adjust_link = felix_adjust_link, -- .port_enable = felix_port_enable, -- .port_disable = felix_port_disable, -+ .phylink_validate = felix_phylink_validate, -+ .phylink_mac_link_state = felix_phylink_mac_pcs_get_state, -+ .phylink_mac_config = felix_phylink_mac_config, -+ .phylink_mac_an_restart = felix_phylink_mac_an_restart, -+ .phylink_mac_link_down = felix_phylink_mac_link_down, -+ .phylink_mac_link_up = felix_phylink_mac_link_up, - .port_fdb_dump = felix_fdb_dump, - .port_fdb_add = felix_fdb_add, - .port_fdb_del = felix_fdb_del, ---- a/drivers/net/ethernet/mscc/Kconfig -+++ b/drivers/net/ethernet/mscc/Kconfig -@@ -15,7 +15,7 @@ config MSCC_OCELOT_SWITCH - tristate "Ocelot switch driver" - depends on NET_SWITCHDEV - depends on HAS_IOMEM -- select PHYLIB -+ select PHYLINK - select REGMAP_MMIO - help - This driver supports the Ocelot network switch device. ---- a/drivers/net/ethernet/mscc/ocelot.c -+++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -13,7 +13,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -406,18 +406,66 @@ static u16 ocelot_wm_enc(u16 value) - return value; - } - --void ocelot_adjust_link(struct ocelot *ocelot, int port, -- struct phy_device *phydev) -+void ocelot_phylink_validate(struct ocelot *ocelot, int port, -+ unsigned long *supported, -+ struct phylink_link_state *state) -+{ -+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -+ -+ if (state->interface != PHY_INTERFACE_MODE_NA && -+ state->interface != PHY_INTERFACE_MODE_GMII && -+ state->interface != PHY_INTERFACE_MODE_SGMII && -+ state->interface != PHY_INTERFACE_MODE_QSGMII) { -+ bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -+ return; -+ } -+ -+ /* No half-duplex. */ -+ phylink_set_port_modes(mask); -+ phylink_set(mask, Autoneg); -+ phylink_set(mask, Pause); -+ phylink_set(mask, Asym_Pause); -+ phylink_set(mask, 10baseT_Full); -+ phylink_set(mask, 100baseT_Full); -+ phylink_set(mask, 1000baseT_Full); -+ phylink_set(mask, 2500baseT_Full); -+ -+ bitmap_and(supported, supported, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+ bitmap_and(state->advertising, state->advertising, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+} -+EXPORT_SYMBOL(ocelot_phylink_validate); -+ -+void ocelot_phylink_mac_pcs_get_state(struct ocelot *ocelot, int port, -+ struct phylink_link_state *state) -+{ -+ state->link = 1; -+} -+EXPORT_SYMBOL(ocelot_phylink_mac_pcs_get_state); -+ -+void ocelot_phylink_mac_an_restart(struct ocelot *ocelot, int port) -+{ -+ /* Not supported */ -+} -+EXPORT_SYMBOL(ocelot_phylink_mac_an_restart); -+ -+void ocelot_phylink_mac_config(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) - { - int speed, mac_speed, mac_mode = DEV_MAC_MODE_CFG_FDX_ENA; - struct ocelot_port *ocelot_port = ocelot->ports[port]; -+ u32 mac_fc_cfg; - - if (ocelot->quirks & OCELOT_PCS_PERFORMS_RATE_ADAPTATION) - speed = SPEED_1000; - else -- speed = phydev->speed; -+ speed = state->speed; - - switch (speed) { -+ case SPEED_UNKNOWN: -+ return; - case SPEED_10: - mac_speed = OCELOT_SPEED_10; - break; -@@ -433,16 +481,11 @@ void ocelot_adjust_link(struct ocelot *o - mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA; - break; - default: -- dev_err(ocelot->dev, "Unsupported PHY speed on port %d: %d\n", -+ dev_err(ocelot->dev, "Unsupported speed on port %d: %d\n", - port, speed); - return; - } - -- phy_print_status(phydev); -- -- if (!phydev->link) -- return; -- - /* Only full duplex supported for now */ - ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG); - -@@ -469,27 +512,36 @@ void ocelot_adjust_link(struct ocelot *o - QSYS_SWITCH_PORT_MODE, port); - - /* Flow control */ -- ocelot_write_rix(ocelot, SYS_MAC_FC_CFG_PAUSE_VAL_CFG(0xffff) | -- SYS_MAC_FC_CFG_RX_FC_ENA | SYS_MAC_FC_CFG_TX_FC_ENA | -- SYS_MAC_FC_CFG_ZERO_PAUSE_ENA | -- SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) | -- SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed), -- SYS_MAC_FC_CFG, port); -+ mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed); -+ if (state->pause & MLO_PAUSE_RX) -+ mac_fc_cfg |= SYS_MAC_FC_CFG_RX_FC_ENA; -+ if (state->pause & MLO_PAUSE_TX) -+ mac_fc_cfg |= SYS_MAC_FC_CFG_TX_FC_ENA | -+ SYS_MAC_FC_CFG_PAUSE_VAL_CFG(0xffff) | -+ SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) | -+ SYS_MAC_FC_CFG_ZERO_PAUSE_ENA; -+ ocelot_write_rix(ocelot, mac_fc_cfg, SYS_MAC_FC_CFG, port); -+ - ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); - } --EXPORT_SYMBOL(ocelot_adjust_link); -+EXPORT_SYMBOL(ocelot_phylink_mac_config); - --static void ocelot_port_adjust_link(struct net_device *dev) -+void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ phy_interface_t interface) - { -- struct ocelot_port_private *priv = netdev_priv(dev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -+ struct ocelot_port *ocelot_port = ocelot->ports[port]; - -- ocelot_adjust_link(ocelot, port, dev->phydev); -+ ocelot_port_writel(ocelot_port, 0, DEV_MAC_ENA_CFG); -+ ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA, -+ QSYS_SWITCH_PORT_MODE, port); - } -+EXPORT_SYMBOL(ocelot_phylink_mac_link_down); - --void ocelot_port_enable(struct ocelot *ocelot, int port, -- struct phy_device *phy) -+void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ phy_interface_t interface, -+ struct phy_device *phy) - { - /* Enable receiving frames on the port, and activate auto-learning of - * MAC addresses. -@@ -499,62 +551,22 @@ void ocelot_port_enable(struct ocelot *o - ANA_PORT_PORT_CFG_PORTID_VAL(port), - ANA_PORT_PORT_CFG, port); - } --EXPORT_SYMBOL(ocelot_port_enable); -+EXPORT_SYMBOL(ocelot_phylink_mac_link_up); - - static int ocelot_port_open(struct net_device *dev) - { - struct ocelot_port_private *priv = netdev_priv(dev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- int err; -- -- if (priv->serdes) { -- err = phy_set_mode_ext(priv->serdes, PHY_MODE_ETHERNET, -- priv->phy_mode); -- if (err) { -- netdev_err(dev, "Could not set mode of SerDes\n"); -- return err; -- } -- } -- -- err = phy_connect_direct(dev, priv->phy, &ocelot_port_adjust_link, -- priv->phy_mode); -- if (err) { -- netdev_err(dev, "Could not attach to PHY\n"); -- return err; -- } - -- dev->phydev = priv->phy; -- -- phy_attached_info(priv->phy); -- phy_start(priv->phy); -- -- ocelot_port_enable(ocelot, port, priv->phy); -+ phylink_start(priv->phylink); - - return 0; - } - --void ocelot_port_disable(struct ocelot *ocelot, int port) --{ -- struct ocelot_port *ocelot_port = ocelot->ports[port]; -- -- ocelot_port_writel(ocelot_port, 0, DEV_MAC_ENA_CFG); -- ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA, -- QSYS_SWITCH_PORT_MODE, port); --} --EXPORT_SYMBOL(ocelot_port_disable); -- - static int ocelot_port_stop(struct net_device *dev) - { - struct ocelot_port_private *priv = netdev_priv(dev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- phy_disconnect(priv->phy); -- -- dev->phydev = NULL; - -- ocelot_port_disable(ocelot, port); -+ phylink_stop(priv->phylink); - - return 0; - } -@@ -2251,8 +2263,7 @@ void ocelot_init_port(struct ocelot *oce - EXPORT_SYMBOL(ocelot_init_port); - - int ocelot_probe_port(struct ocelot *ocelot, u8 port, -- void __iomem *regs, -- struct phy_device *phy) -+ void __iomem *regs) - { - struct ocelot_port_private *priv; - struct ocelot_port *ocelot_port; -@@ -2265,7 +2276,6 @@ int ocelot_probe_port(struct ocelot *oce - SET_NETDEV_DEV(dev, ocelot->dev); - priv = netdev_priv(dev); - priv->dev = dev; -- priv->phy = phy; - priv->chip_port = port; - ocelot_port = &priv->port; - ocelot_port->ocelot = ocelot; ---- a/drivers/net/ethernet/mscc/ocelot.h -+++ b/drivers/net/ethernet/mscc/ocelot.h -@@ -12,8 +12,7 @@ - #include - #include - #include --#include --#include -+#include - #include - #include - #include -@@ -65,14 +64,12 @@ struct ocelot_multicast { - struct ocelot_port_private { - struct ocelot_port port; - struct net_device *dev; -- struct phy_device *phy; -+ struct phylink *phylink; -+ struct phylink_config phylink_config; - u8 chip_port; - - u8 vlan_aware; - -- phy_interface_t phy_mode; -- struct phy *serdes; -- - struct ocelot_port_tc tc; - }; - -@@ -83,9 +80,7 @@ void ocelot_port_writel(struct ocelot_po - #define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val)) - - int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops); --int ocelot_probe_port(struct ocelot *ocelot, u8 port, -- void __iomem *regs, -- struct phy_device *phy); -+int ocelot_probe_port(struct ocelot *ocelot, u8 port, void __iomem *regs); - - void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu, - enum ocelot_tag_prefix injection, ---- a/drivers/net/ethernet/mscc/ocelot_board.c -+++ b/drivers/net/ethernet/mscc/ocelot_board.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - #include "ocelot.h" - -@@ -262,6 +263,91 @@ static const struct ocelot_ops ocelot_op - .reset = ocelot_reset, - }; - -+static void ocelot_port_phylink_validate(struct phylink_config *config, -+ unsigned long *supported, -+ struct phylink_link_state *state) -+{ -+ struct net_device *ndev = to_net_dev(config->dev); -+ struct ocelot_port_private *priv = netdev_priv(ndev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ ocelot_phylink_validate(ocelot, port, supported, state); -+} -+ -+static int -+ocelot_port_phylink_mac_pcs_get_state(struct phylink_config *config, -+ struct phylink_link_state *state) -+{ -+ struct net_device *ndev = to_net_dev(config->dev); -+ struct ocelot_port_private *priv = netdev_priv(ndev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ ocelot_phylink_mac_pcs_get_state(ocelot, port, state); -+ -+ return 0; -+} -+ -+static void ocelot_port_phylink_mac_an_restart(struct phylink_config *config) -+{ -+ struct net_device *ndev = to_net_dev(config->dev); -+ struct ocelot_port_private *priv = netdev_priv(ndev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ ocelot_phylink_mac_an_restart(ocelot, port); -+} -+ -+static void -+ocelot_port_phylink_mac_config(struct phylink_config *config, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) -+{ -+ struct net_device *ndev = to_net_dev(config->dev); -+ struct ocelot_port_private *priv = netdev_priv(ndev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ ocelot_phylink_mac_config(ocelot, port, link_an_mode, state); -+} -+ -+static void ocelot_port_phylink_mac_link_down(struct phylink_config *config, -+ unsigned int link_an_mode, -+ phy_interface_t interface) -+{ -+ struct net_device *ndev = to_net_dev(config->dev); -+ struct ocelot_port_private *priv = netdev_priv(ndev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ return ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, -+ interface); -+} -+ -+static void ocelot_port_phylink_mac_link_up(struct phylink_config *config, -+ unsigned int link_an_mode, -+ phy_interface_t interface, -+ struct phy_device *phy) -+{ -+ struct net_device *ndev = to_net_dev(config->dev); -+ struct ocelot_port_private *priv = netdev_priv(ndev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ return ocelot_phylink_mac_link_up(ocelot, port, link_an_mode, -+ interface, phy); -+} -+ -+static const struct phylink_mac_ops ocelot_phylink_ops = { -+ .validate = ocelot_port_phylink_validate, -+ .mac_link_state = ocelot_port_phylink_mac_pcs_get_state, -+ .mac_an_restart = ocelot_port_phylink_mac_an_restart, -+ .mac_config = ocelot_port_phylink_mac_config, -+ .mac_link_down = ocelot_port_phylink_mac_link_down, -+ .mac_link_up = ocelot_port_phylink_mac_link_up, -+}; -+ - static int mscc_ocelot_probe(struct platform_device *pdev) - { - struct device_node *np = pdev->dev.of_node; -@@ -369,8 +455,6 @@ static int mscc_ocelot_probe(struct plat - for_each_available_child_of_node(ports, portnp) { - struct ocelot_port_private *priv; - struct ocelot_port *ocelot_port; -- struct device_node *phy_node; -- struct phy_device *phy; - struct resource *res; - struct phy *serdes; - void __iomem *regs; -@@ -389,16 +473,7 @@ static int mscc_ocelot_probe(struct plat - if (IS_ERR(regs)) - continue; - -- phy_node = of_parse_phandle(portnp, "phy-handle", 0); -- if (!phy_node) -- continue; -- -- phy = of_phy_find_device(phy_node); -- of_node_put(phy_node); -- if (!phy) -- continue; -- -- err = ocelot_probe_port(ocelot, port, regs, phy); -+ err = ocelot_probe_port(ocelot, port, regs); - if (err) { - of_node_put(portnp); - goto out_put_ports; -@@ -412,9 +487,7 @@ static int mscc_ocelot_probe(struct plat - if (phy_mode < 0) - phy_mode = PHY_INTERFACE_MODE_NA; - -- priv->phy_mode = phy_mode; -- -- switch (priv->phy_mode) { -+ switch (phy_mode) { - case PHY_INTERFACE_MODE_NA: - continue; - case PHY_INTERFACE_MODE_SGMII: -@@ -451,7 +524,41 @@ static int mscc_ocelot_probe(struct plat - goto out_put_ports; - } - -- priv->serdes = serdes; -+ if (serdes) { -+ err = phy_set_mode_ext(serdes, PHY_MODE_ETHERNET, -+ phy_mode); -+ if (err) { -+ dev_err(ocelot->dev, -+ "Could not set mode of SerDes\n"); -+ of_node_put(portnp); -+ goto out_put_ports; -+ } -+ } -+ -+ priv->phylink_config.dev = &priv->dev->dev; -+ priv->phylink_config.type = PHYLINK_NETDEV; -+ -+ priv->phylink = phylink_create(&priv->phylink_config, -+ of_fwnode_handle(portnp), -+ phy_mode, &ocelot_phylink_ops); -+ if (IS_ERR(priv->phylink)) { -+ dev_err(ocelot->dev, -+ "Could not create a phylink instance (%ld)\n", -+ PTR_ERR(priv->phylink)); -+ err = PTR_ERR(priv->phylink); -+ priv->phylink = NULL; -+ of_node_put(portnp); -+ goto out_put_ports; -+ } -+ -+ err = phylink_of_phy_connect(priv->phylink, portnp, 0); -+ if (err) { -+ dev_err(ocelot->dev, "Could not connect to PHY: %d\n", -+ err); -+ phylink_destroy(priv->phylink); -+ of_node_put(portnp); -+ goto out_put_ports; -+ } - } - - register_netdevice_notifier(&ocelot_netdevice_nb); -@@ -468,12 +575,27 @@ out_put_ports: - static int mscc_ocelot_remove(struct platform_device *pdev) - { - struct ocelot *ocelot = platform_get_drvdata(pdev); -+ int port; - - ocelot_deinit(ocelot); - unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); - unregister_switchdev_notifier(&ocelot_switchdev_nb); - unregister_netdevice_notifier(&ocelot_netdevice_nb); - -+ for (port = 0; port < ocelot->num_phys_ports; port++) { -+ struct ocelot_port_private *priv; -+ -+ priv = container_of(ocelot->ports[port], -+ struct ocelot_port_private, -+ port); -+ -+ if (priv->phylink) { -+ rtnl_lock(); -+ phylink_destroy(priv->phylink); -+ rtnl_unlock(); -+ } -+ } -+ - return 0; - } - ---- a/include/soc/mscc/ocelot.h -+++ b/include/soc/mscc/ocelot.h -@@ -518,17 +518,12 @@ void ocelot_deinit(struct ocelot *ocelot - void ocelot_init_port(struct ocelot *ocelot, int port); - - /* DSA callbacks */ --void ocelot_port_enable(struct ocelot *ocelot, int port, -- struct phy_device *phy); --void ocelot_port_disable(struct ocelot *ocelot, int port); - void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); - void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data); - int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset); - int ocelot_get_ts_info(struct ocelot *ocelot, int port, - struct ethtool_ts_info *info); - void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs); --void ocelot_adjust_link(struct ocelot *ocelot, int port, -- struct phy_device *phydev); - void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, - bool vlan_aware); - void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state); -@@ -597,4 +592,21 @@ int ocelot_rtag_parse_enable(struct ocel - int ocelot_dscp_set(struct ocelot *ocelot, int port, - bool enable, const u8 dscp_ix, - struct tsn_qos_switch_dscp_conf *c); -+void ocelot_phylink_validate(struct ocelot *ocelot, int port, -+ unsigned long *supported, -+ struct phylink_link_state *state); -+void ocelot_phylink_mac_pcs_get_state(struct ocelot *ocelot, int port, -+ struct phylink_link_state *state); -+void ocelot_phylink_mac_an_restart(struct ocelot *ocelot, int port); -+void ocelot_phylink_mac_config(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state); -+void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ phy_interface_t interface); -+void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ phy_interface_t interface, -+ struct phy_device *phy); -+ - #endif diff --git a/target/linux/layerscape/patches-5.4/701-net-0282-net-mscc-ocelot-introduce-more-focused-PCS-ops-for-P.patch b/target/linux/layerscape/patches-5.4/701-net-0282-net-mscc-ocelot-introduce-more-focused-PCS-ops-for-P.patch deleted file mode 100644 index d7ae1196dd..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0282-net-mscc-ocelot-introduce-more-focused-PCS-ops-for-P.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 07f63e91f5e81f7f36c1e646f72c394c7f60c05c Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Fri, 22 Nov 2019 13:46:34 +0200 -Subject: [PATCH] net: mscc: ocelot: introduce more focused PCS ops for PHYLINK - -The reason for doing this is that the 2 mainline Ocelot switches so far, -VSC7514 and VSC9959, have radically different SoC/SerDes integration. So -although the PHYLINK callbacks are common, the implementations will -actually lie in device-specific function pointers. - -Also, there was a duplicated and unused function pointer for pcs_init in -struct ocelot, remove that. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/ethernet/mscc/ocelot.c | 36 ++++++++------------------------ - drivers/net/ethernet/mscc/ocelot_board.c | 35 ++++++++++++++++++++++++++++++- - include/soc/mscc/ocelot.h | 12 ++++++++--- - 3 files changed, 52 insertions(+), 31 deletions(-) - ---- a/drivers/net/ethernet/mscc/ocelot.c -+++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -410,43 +410,25 @@ void ocelot_phylink_validate(struct ocel - unsigned long *supported, - struct phylink_link_state *state) - { -- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -- -- if (state->interface != PHY_INTERFACE_MODE_NA && -- state->interface != PHY_INTERFACE_MODE_GMII && -- state->interface != PHY_INTERFACE_MODE_SGMII && -- state->interface != PHY_INTERFACE_MODE_QSGMII) { -- bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -- return; -- } -- -- /* No half-duplex. */ -- phylink_set_port_modes(mask); -- phylink_set(mask, Autoneg); -- phylink_set(mask, Pause); -- phylink_set(mask, Asym_Pause); -- phylink_set(mask, 10baseT_Full); -- phylink_set(mask, 100baseT_Full); -- phylink_set(mask, 1000baseT_Full); -- phylink_set(mask, 2500baseT_Full); -- -- bitmap_and(supported, supported, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); -- bitmap_and(state->advertising, state->advertising, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); -+ if (ocelot->ops->pcs_validate) -+ ocelot->ops->pcs_validate(ocelot, port, supported, state); - } - EXPORT_SYMBOL(ocelot_phylink_validate); - - void ocelot_phylink_mac_pcs_get_state(struct ocelot *ocelot, int port, - struct phylink_link_state *state) - { -- state->link = 1; -+ if (ocelot->ops->pcs_link_state) -+ ocelot->ops->pcs_link_state(ocelot, port, state); -+ else -+ state->link = 1; - } - EXPORT_SYMBOL(ocelot_phylink_mac_pcs_get_state); - - void ocelot_phylink_mac_an_restart(struct ocelot *ocelot, int port) - { -- /* Not supported */ -+ if (ocelot->ops->pcs_an_restart) -+ ocelot->ops->pcs_an_restart(ocelot, port); - } - EXPORT_SYMBOL(ocelot_phylink_mac_an_restart); - -@@ -490,7 +472,7 @@ void ocelot_phylink_mac_config(struct oc - ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG); - - if (ocelot->ops->pcs_init) -- ocelot->ops->pcs_init(ocelot, port); -+ ocelot->ops->pcs_init(ocelot, port, link_an_mode, state); - - /* Enable MAC module */ - ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA | ---- a/drivers/net/ethernet/mscc/ocelot_board.c -+++ b/drivers/net/ethernet/mscc/ocelot_board.c -@@ -212,7 +212,9 @@ static const struct of_device_id mscc_oc - }; - MODULE_DEVICE_TABLE(of, mscc_ocelot_match); - --static void ocelot_port_pcs_init(struct ocelot *ocelot, int port) -+static void ocelot_port_pcs_init(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) - { - struct ocelot_port *ocelot_port = ocelot->ports[port]; - -@@ -235,6 +237,36 @@ static void ocelot_port_pcs_init(struct - ocelot_port_writel(ocelot_port, 0, PCS1G_LB_CFG); - } - -+void ocelot_port_pcs_validate(struct ocelot *ocelot, int port, -+ unsigned long *supported, -+ struct phylink_link_state *state) -+{ -+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -+ -+ if (state->interface != PHY_INTERFACE_MODE_NA && -+ state->interface != PHY_INTERFACE_MODE_GMII && -+ state->interface != PHY_INTERFACE_MODE_SGMII && -+ state->interface != PHY_INTERFACE_MODE_QSGMII) { -+ bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -+ return; -+ } -+ -+ /* No half-duplex. */ -+ phylink_set_port_modes(mask); -+ phylink_set(mask, Autoneg); -+ phylink_set(mask, Pause); -+ phylink_set(mask, Asym_Pause); -+ phylink_set(mask, 10baseT_Full); -+ phylink_set(mask, 100baseT_Full); -+ phylink_set(mask, 1000baseT_Full); -+ phylink_set(mask, 2500baseT_Full); -+ -+ bitmap_and(supported, supported, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+ bitmap_and(state->advertising, state->advertising, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+} -+ - static int ocelot_reset(struct ocelot *ocelot) - { - int retries = 100; -@@ -260,6 +292,7 @@ static int ocelot_reset(struct ocelot *o - - static const struct ocelot_ops ocelot_ops = { - .pcs_init = ocelot_port_pcs_init, -+ .pcs_validate = ocelot_port_pcs_validate, - .reset = ocelot_reset, - }; - ---- a/include/soc/mscc/ocelot.h -+++ b/include/soc/mscc/ocelot.h -@@ -412,7 +412,15 @@ enum { - struct ocelot; - - struct ocelot_ops { -- void (*pcs_init)(struct ocelot *ocelot, int port); -+ void (*pcs_init)(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state); -+ void (*pcs_an_restart)(struct ocelot *ocelot, int port); -+ void (*pcs_link_state)(struct ocelot *ocelot, int port, -+ struct phylink_link_state *state); -+ void (*pcs_validate)(struct ocelot *ocelot, int port, -+ unsigned long *supported, -+ struct phylink_link_state *state); - int (*reset)(struct ocelot *ocelot); - }; - -@@ -479,8 +487,6 @@ struct ocelot { - struct mutex ptp_lock; - /* Protects the PTP clock */ - spinlock_t ptp_clock_lock; -- -- void (*port_pcs_init)(struct ocelot_port *port); - }; - - #define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) diff --git a/target/linux/layerscape/patches-5.4/701-net-0283-net-dsa-felix-Add-PCS-operations-for-PHYLINK.patch b/target/linux/layerscape/patches-5.4/701-net-0283-net-dsa-felix-Add-PCS-operations-for-PHYLINK.patch deleted file mode 100644 index e2de403c2d..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0283-net-dsa-felix-Add-PCS-operations-for-PHYLINK.patch +++ /dev/null @@ -1,442 +0,0 @@ -From 0e219a6aa07754d81a25c9e4408d81d194cd2000 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Fri, 22 Nov 2019 13:45:52 +0200 -Subject: [PATCH] net: dsa: felix: Add PCS operations for PHYLINK - -This removes the bootloader dependency for SGMII PCS pre-configuration, -as well as adds support for monitoring the in-band SGMII AN between the -PCS and the system-side link partner (PHY or other MAC). - -Signed-off-by: Vladimir Oltean ---- - drivers/net/dsa/ocelot/felix.c | 23 ++- - drivers/net/dsa/ocelot/felix.h | 7 +- - drivers/net/dsa/ocelot/felix_vsc9959.c | 292 ++++++++++++++++++++++++++++++++- - 3 files changed, 314 insertions(+), 8 deletions(-) - ---- a/drivers/net/dsa/ocelot/felix.c -+++ b/drivers/net/dsa/ocelot/felix.c -@@ -265,7 +265,7 @@ static int felix_get_ts_info(struct dsa_ - static int felix_init_structs(struct felix *felix, int num_phys_ports) - { - struct ocelot *ocelot = &felix->ocelot; -- resource_size_t base; -+ resource_size_t switch_base; - int port, i, err; - - ocelot->num_phys_ports = num_phys_ports; -@@ -281,7 +281,8 @@ static int felix_init_structs(struct fel - ocelot->ops = felix->info->ops; - ocelot->quirks = felix->info->quirks; - -- base = pci_resource_start(felix->pdev, felix->info->pci_bar); -+ switch_base = pci_resource_start(felix->pdev, -+ felix->info->switch_pci_bar); - - for (i = 0; i < TARGET_MAX; i++) { - struct regmap *target; -@@ -292,8 +293,8 @@ static int felix_init_structs(struct fel - - res = &felix->info->target_io_res[i]; - res->flags = IORESOURCE_MEM; -- res->start += base; -- res->end += base; -+ res->start += switch_base; -+ res->end += switch_base; - - target = ocelot_regmap_init(ocelot, res); - if (IS_ERR(target)) { -@@ -327,8 +328,8 @@ static int felix_init_structs(struct fel - - res = &felix->info->port_io_res[port]; - res->flags = IORESOURCE_MEM; -- res->start += base; -- res->end += base; -+ res->start += switch_base; -+ res->end += switch_base; - - port_regs = devm_ioremap_resource(ocelot->dev, res); - if (IS_ERR(port_regs)) { -@@ -342,6 +343,12 @@ static int felix_init_structs(struct fel - ocelot->ports[port] = ocelot_port; - } - -+ if (felix->info->mdio_bus_alloc) { -+ err = felix->info->mdio_bus_alloc(ocelot); -+ if (err < 0) -+ return err; -+ } -+ - return 0; - } - -@@ -377,6 +384,10 @@ static int felix_setup(struct dsa_switch - static void felix_teardown(struct dsa_switch *ds) - { - struct ocelot *ocelot = ds->priv; -+ struct felix *felix = ocelot_to_felix(ocelot); -+ -+ if (felix->imdio) -+ mdiobus_unregister(felix->imdio); - - /* stop workqueue thread */ - ocelot_deinit(ocelot); ---- a/drivers/net/dsa/ocelot/felix.h -+++ b/drivers/net/dsa/ocelot/felix.h -@@ -10,6 +10,7 @@ - struct felix_info { - struct resource *target_io_res; - struct resource *port_io_res; -+ struct resource *imdio_res; - const struct reg_field *regfields; - const u32 *const *map; - const struct ocelot_ops *ops; -@@ -17,8 +18,10 @@ struct felix_info { - const struct ocelot_stat_layout *stats_layout; - unsigned int num_stats; - int num_ports; -- int pci_bar; -+ int switch_pci_bar; -+ int imdio_pci_bar; - unsigned long quirks; -+ int (*mdio_bus_alloc)(struct ocelot *ocelot); - }; - - extern struct felix_info felix_info_vsc9959; -@@ -33,6 +36,8 @@ struct felix { - struct pci_dev *pdev; - struct felix_info *info; - struct ocelot ocelot; -+ struct mii_bus *imdio; -+ struct phy_device **pcs; - }; - - #endif ---- a/drivers/net/dsa/ocelot/felix_vsc9959.c -+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c -@@ -2,6 +2,7 @@ - /* Copyright 2017 Microsemi Corporation - * Copyright 2018-2019 NXP Semiconductors - */ -+#include - #include - #include - #include -@@ -390,6 +391,15 @@ static struct resource vsc9959_port_io_r - }, - }; - -+/* Port MAC 0 Internal MDIO bus through which the SerDes acting as an -+ * SGMII/QSGMII MAC PCS can be found. -+ */ -+static struct resource vsc9959_imdio_res = { -+ .start = 0x8030, -+ .end = 0x8040, -+ .name = "imdio", -+}; -+ - static const struct reg_field vsc9959_regfields[] = { - [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 6, 6), - [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 5), -@@ -569,13 +579,291 @@ static int vsc9959_reset(struct ocelot * - return 0; - } - -+void vsc9959_pcs_validate(struct ocelot *ocelot, int port, -+ unsigned long *supported, -+ struct phylink_link_state *state) -+{ -+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -+ -+ if (state->interface != PHY_INTERFACE_MODE_NA && -+ state->interface != PHY_INTERFACE_MODE_GMII && -+ state->interface != PHY_INTERFACE_MODE_SGMII && -+ state->interface != PHY_INTERFACE_MODE_QSGMII && -+ state->interface != PHY_INTERFACE_MODE_USXGMII) { -+ bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -+ return; -+ } -+ -+ /* No half-duplex. */ -+ phylink_set_port_modes(mask); -+ phylink_set(mask, Autoneg); -+ phylink_set(mask, Pause); -+ phylink_set(mask, Asym_Pause); -+ phylink_set(mask, 10baseT_Full); -+ phylink_set(mask, 100baseT_Full); -+ phylink_set(mask, 1000baseT_Full); -+ phylink_set(mask, 1000baseX_Full); -+ phylink_set(mask, 2500baseT_Full); -+ phylink_set(mask, 2500baseX_Full); -+ phylink_set(mask, 1000baseKX_Full); -+ -+ bitmap_and(supported, supported, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+ bitmap_and(state->advertising, state->advertising, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+} -+ -+static void vsc9959_pcs_an_restart(struct ocelot *ocelot, int port) -+{ -+ struct felix *felix = ocelot_to_felix(ocelot); -+ struct phy_device *pcs = felix->pcs[port]; -+ -+ if (!pcs) -+ return; -+ -+ phy_set_bits(pcs, MII_BMCR, BMCR_ANRESTART); -+} -+ -+static void vsc9959_pcs_init_sgmii(struct phy_device *pcs, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) -+{ -+ /* SGMII spec requires tx_config_Reg[15:0] to be exactly 0x4001 -+ * for the MAC PCS in order to acknowledge the AN. -+ */ -+ phy_write(pcs, MII_ADVERTISE, ADVERTISE_SGMII | ADVERTISE_LPACK); -+ -+ /* Set to SGMII mode, use AN */ -+ phy_write(pcs, ENETC_PCS_IF_MODE, ENETC_PCS_IF_MODE_SGMII_AN); -+ -+ /* Adjust link timer for SGMII */ -+ phy_write(pcs, ENETC_PCS_LINK_TIMER1, ENETC_PCS_LINK_TIMER1_VAL); -+ phy_write(pcs, ENETC_PCS_LINK_TIMER2, ENETC_PCS_LINK_TIMER2_VAL); -+ -+ phy_write(pcs, MII_BMCR, BMCR_SPEED1000 | -+ BMCR_FULLDPLX | -+ BMCR_ANENABLE); -+} -+ -+#define ADVERTISE_USXGMII_FDX BIT(12) -+ -+static void vsc9959_pcs_init_sxgmii(struct phy_device *pcs, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) -+{ -+ /* Configure device ability for the USXGMII Replicator */ -+ phy_write_mmd(pcs, MDIO_MMD_VEND2, MII_ADVERTISE, -+ ADVERTISE_SGMII | -+ ADVERTISE_LPACK | -+ ADVERTISE_USXGMII_FDX); -+} -+ -+static void vsc9959_pcs_init(struct ocelot *ocelot, int port, -+ unsigned int link_an_mode, -+ const struct phylink_link_state *state) -+{ -+ struct felix *felix = ocelot_to_felix(ocelot); -+ struct phy_device *pcs = felix->pcs[port]; -+ -+ if (!pcs) -+ return; -+ -+ if (link_an_mode == MLO_AN_FIXED) { -+ phydev_err(pcs, "Fixed modes are not yet supported.\n"); -+ return; -+ } -+ -+ pcs->interface = state->interface; -+ if (pcs->interface == PHY_INTERFACE_MODE_USXGMII) -+ pcs->is_c45 = true; -+ else -+ pcs->is_c45 = false; -+ -+ /* The PCS does not implement the BMSR register fully, so capability -+ * detection via genphy_read_abilities does not work. Since we can get -+ * the PHY config word from the LPA register though, there is still -+ * value in using the generic phy_resolve_aneg_linkmode function. So -+ * populate the supported and advertising link modes manually here. -+ */ -+ linkmode_set_bit_array(phy_basic_ports_array, -+ ARRAY_SIZE(phy_basic_ports_array), -+ pcs->supported); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, pcs->supported); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, pcs->supported); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, pcs->supported); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, pcs->supported); -+ phy_advertise_supported(pcs); -+ -+ switch (pcs->interface) { -+ case PHY_INTERFACE_MODE_SGMII: -+ case PHY_INTERFACE_MODE_QSGMII: -+ vsc9959_pcs_init_sgmii(pcs, link_an_mode, state); -+ break; -+ case PHY_INTERFACE_MODE_USXGMII: -+ vsc9959_pcs_init_sxgmii(pcs, link_an_mode, state); -+ break; -+ default: -+ dev_err(ocelot->dev, "Unsupported link mode %s\n", -+ phy_modes(pcs->interface)); -+ } -+} -+ -+static void vsc9959_pcs_link_state(struct ocelot *ocelot, int port, -+ struct phylink_link_state *state) -+{ -+ struct felix *felix = ocelot_to_felix(ocelot); -+ struct phy_device *pcs = felix->pcs[port]; -+ int err; -+ -+ if (!pcs) -+ return; -+ -+ /* Reading PCS status not yet supported for USXGMII */ -+ if (pcs->is_c45) { -+ state->link = 1; -+ return; -+ } -+ -+ pcs->speed = SPEED_UNKNOWN; -+ pcs->duplex = DUPLEX_UNKNOWN; -+ pcs->pause = 0; -+ pcs->asym_pause = 0; -+ -+ err = genphy_update_link(pcs); -+ if (err < 0) -+ return; -+ -+ if (pcs->autoneg_complete) { -+ u16 lpa = phy_read(pcs, MII_LPA); -+ -+ switch (state->interface) { -+ case PHY_INTERFACE_MODE_SGMII: -+ case PHY_INTERFACE_MODE_QSGMII: -+ mii_lpa_to_linkmode_lpa_sgmii(pcs->lp_advertising, lpa); -+ break; -+ default: -+ return; -+ } -+ -+ phy_resolve_aneg_linkmode(pcs); -+ } -+ -+ state->an_complete = pcs->autoneg_complete; -+ state->an_enabled = pcs->autoneg; -+ state->link = pcs->link; -+ state->duplex = pcs->duplex; -+ state->speed = pcs->speed; -+ /* SGMII AN does not negotiate flow control, but that's ok, -+ * since phylink already knows that, and does: -+ * link_state.pause |= pl->phy_state.pause; -+ */ -+ state->pause = pcs->pause; -+ -+ dev_dbg(ocelot->dev, -+ "%s: mode=%s/%s/%s adv=%*pb lpa=%*pb link=%u an_enabled=%u an_complete=%u\n", -+ __func__, -+ phy_modes(state->interface), -+ phy_speed_to_str(state->speed), -+ phy_duplex_to_str(state->duplex), -+ __ETHTOOL_LINK_MODE_MASK_NBITS, state->advertising, -+ __ETHTOOL_LINK_MODE_MASK_NBITS, state->lp_advertising, -+ state->link, state->an_enabled, state->an_complete); -+} -+ - static const struct ocelot_ops vsc9959_ops = { - .reset = vsc9959_reset, -+ .pcs_init = vsc9959_pcs_init, -+ .pcs_an_restart = vsc9959_pcs_an_restart, -+ .pcs_link_state = vsc9959_pcs_link_state, -+ .pcs_validate = vsc9959_pcs_validate, - }; - -+static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) -+{ -+ struct felix *felix = ocelot_to_felix(ocelot); -+ struct enetc_mdio_priv *mdio_priv; -+ struct device *dev = ocelot->dev; -+ resource_size_t imdio_base; -+ void __iomem *imdio_regs; -+ struct resource *res; -+ struct enetc_hw *hw; -+ struct mii_bus *bus; -+ int port; -+ int rc; -+ -+ felix->pcs = devm_kcalloc(dev, felix->info->num_ports, -+ sizeof(struct phy_device), -+ GFP_KERNEL); -+ if (!felix->pcs) { -+ dev_err(dev, "failed to allocate array for PCS PHYs\n"); -+ return -ENOMEM; -+ } -+ -+ imdio_base = pci_resource_start(felix->pdev, -+ felix->info->imdio_pci_bar); -+ -+ res = felix->info->imdio_res; -+ res->flags = IORESOURCE_MEM; -+ res->start += imdio_base; -+ res->end += imdio_base; -+ -+ imdio_regs = devm_ioremap_resource(dev, res); -+ if (IS_ERR(imdio_regs)) { -+ dev_err(dev, "failed to map internal MDIO registers\n"); -+ return PTR_ERR(imdio_regs); -+ } -+ -+ hw = enetc_hw_alloc(dev, imdio_regs); -+ if (IS_ERR(hw)) { -+ dev_err(dev, "failed to allocate ENETC HW structure\n"); -+ return PTR_ERR(hw); -+ } -+ -+ bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); -+ if (!bus) -+ return -ENOMEM; -+ -+ bus->name = "VSC9959 internal MDIO bus"; -+ bus->read = enetc_mdio_read; -+ bus->write = enetc_mdio_write; -+ bus->parent = dev; -+ mdio_priv = bus->priv; -+ mdio_priv->hw = hw; -+ /* This gets added to imdio_regs, which already maps addresses -+ * starting with the proper offset. -+ */ -+ mdio_priv->mdio_base = 0; -+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); -+ -+ /* Needed in order to initialize the bus mutex lock */ -+ rc = mdiobus_register(bus); -+ if (rc < 0) { -+ dev_err(dev, "failed to register MDIO bus\n"); -+ return rc; -+ } -+ -+ felix->imdio = bus; -+ -+ for (port = 0; port < felix->info->num_ports; port++) { -+ struct phy_device *pcs; -+ bool is_c45 = false; -+ -+ pcs = get_phy_device(felix->imdio, port, is_c45); -+ if (IS_ERR(pcs)) -+ continue; -+ -+ felix->pcs[port] = pcs; -+ -+ dev_info(dev, "Found PCS at internal MDIO address %d\n", port); -+ } -+ -+ return 0; -+} -+ - struct felix_info felix_info_vsc9959 = { - .target_io_res = vsc9959_target_io_res, - .port_io_res = vsc9959_port_io_res, -+ .imdio_res = &vsc9959_imdio_res, - .regfields = vsc9959_regfields, - .map = vsc9959_regmap, - .ops = &vsc9959_ops, -@@ -583,6 +871,8 @@ struct felix_info felix_info_vsc9959 = { - .num_stats = ARRAY_SIZE(vsc9959_stats_layout), - .shared_queue_sz = 128 * 1024, - .num_ports = 6, -- .pci_bar = 4, -+ .switch_pci_bar = 4, -+ .imdio_pci_bar = 0, - .quirks = OCELOT_PCS_PERFORMS_RATE_ADAPTATION, -+ .mdio_bus_alloc = vsc9959_mdio_bus_alloc, - }; diff --git a/target/linux/layerscape/patches-5.4/701-net-0338-net-dsa-felix-Fix-probing-allocation-and-cleanup-pat.patch b/target/linux/layerscape/patches-5.4/701-net-0338-net-dsa-felix-Fix-probing-allocation-and-cleanup-pat.patch index 3e99861d16..ec4c62a7a5 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0338-net-dsa-felix-Fix-probing-allocation-and-cleanup-pat.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0338-net-dsa-felix-Fix-probing-allocation-and-cleanup-pat.patch @@ -90,7 +90,7 @@ Signed-off-by: Claudiu Manoil --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c -@@ -530,7 +530,7 @@ static int felix_pci_probe(struct pci_de +@@ -485,7 +485,7 @@ static int felix_pci_probe(struct pci_de } } @@ -99,7 +99,7 @@ Signed-off-by: Claudiu Manoil if (!felix) { err = -ENOMEM; dev_err(&pdev->dev, "Failed to allocate driver memory\n"); -@@ -577,11 +577,9 @@ static int felix_pci_probe(struct pci_de +@@ -532,11 +532,9 @@ static int felix_pci_probe(struct pci_de return 0; err_register_ds: @@ -111,7 +111,7 @@ Signed-off-by: Claudiu Manoil err_dma: pci_disable_device(pdev); err_pci_enable: -@@ -596,9 +594,6 @@ static void felix_pci_remove(struct pci_ +@@ -551,9 +549,6 @@ static void felix_pci_remove(struct pci_ dsa_unregister_switch(felix->ds); diff --git a/target/linux/layerscape/patches-5.4/701-net-0341-LF-368-net-mscc-ocelot-add-VCAP-IS2-rule-to-trap-PTP.patch b/target/linux/layerscape/patches-5.4/701-net-0341-LF-368-net-mscc-ocelot-add-VCAP-IS2-rule-to-trap-PTP.patch index af80b9f666..0b4cb96955 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0341-LF-368-net-mscc-ocelot-add-VCAP-IS2-rule-to-trap-PTP.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0341-LF-368-net-mscc-ocelot-add-VCAP-IS2-rule-to-trap-PTP.patch @@ -14,7 +14,7 @@ Signed-off-by: Yangbo Lu --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -2338,6 +2338,20 @@ void ocelot_set_cpu_port(struct ocelot * +@@ -2342,6 +2342,20 @@ void ocelot_set_cpu_port(struct ocelot * } EXPORT_SYMBOL(ocelot_set_cpu_port); @@ -35,7 +35,7 @@ Signed-off-by: Yangbo Lu int ocelot_init(struct ocelot *ocelot) { char queue_name[32]; -@@ -2475,6 +2489,13 @@ int ocelot_init(struct ocelot *ocelot) +@@ -2479,6 +2493,13 @@ int ocelot_init(struct ocelot *ocelot) "Timestamp initialization failed\n"); return ret; } @@ -49,7 +49,7 @@ Signed-off-by: Yangbo Lu } return 0; -@@ -2489,6 +2510,8 @@ void ocelot_deinit(struct ocelot *ocelot +@@ -2493,6 +2514,8 @@ void ocelot_deinit(struct ocelot *ocelot cancel_delayed_work(&ocelot->stats_work); destroy_workqueue(ocelot->stats_queue); mutex_destroy(&ocelot->stats_lock); diff --git a/target/linux/layerscape/patches-5.4/701-net-0367-net-mscc-ocelot-Workaround-to-allow-traffic-to-CPU-i.patch b/target/linux/layerscape/patches-5.4/701-net-0367-net-mscc-ocelot-Workaround-to-allow-traffic-to-CPU-i.patch index 069c518389..f2d69b6333 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0367-net-mscc-ocelot-Workaround-to-allow-traffic-to-CPU-i.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0367-net-mscc-ocelot-Workaround-to-allow-traffic-to-CPU-i.patch @@ -128,7 +128,7 @@ Signed-off-by: Vladimir Oltean --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -2292,6 +2292,18 @@ void ocelot_set_cpu_port(struct ocelot * +@@ -2296,6 +2296,18 @@ void ocelot_set_cpu_port(struct ocelot * enum ocelot_tag_prefix injection, enum ocelot_tag_prefix extraction) { diff --git a/target/linux/layerscape/patches-5.4/701-net-0368-Revert-net-dsa-felix-Add-PCS-operations-for-PHYLINK.patch b/target/linux/layerscape/patches-5.4/701-net-0368-Revert-net-dsa-felix-Add-PCS-operations-for-PHYLINK.patch deleted file mode 100644 index ea01a8b24b..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0368-Revert-net-dsa-felix-Add-PCS-operations-for-PHYLINK.patch +++ /dev/null @@ -1,440 +0,0 @@ -From 9ee918eb911853c7b46cd84779d857988366e845 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:30:24 +0200 -Subject: [PATCH] Revert "net: dsa: felix: Add PCS operations for PHYLINK" - -This reverts commit 1082a3ef9e832cc52c4b0053c7c52453376f4830. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/dsa/ocelot/felix.c | 23 +-- - drivers/net/dsa/ocelot/felix.h | 7 +- - drivers/net/dsa/ocelot/felix_vsc9959.c | 292 +-------------------------------- - 3 files changed, 8 insertions(+), 314 deletions(-) - ---- a/drivers/net/dsa/ocelot/felix.c -+++ b/drivers/net/dsa/ocelot/felix.c -@@ -265,7 +265,7 @@ static int felix_get_ts_info(struct dsa_ - static int felix_init_structs(struct felix *felix, int num_phys_ports) - { - struct ocelot *ocelot = &felix->ocelot; -- resource_size_t switch_base; -+ resource_size_t base; - int port, i, err; - - ocelot->num_phys_ports = num_phys_ports; -@@ -281,8 +281,7 @@ static int felix_init_structs(struct fel - ocelot->ops = felix->info->ops; - ocelot->quirks = felix->info->quirks; - -- switch_base = pci_resource_start(felix->pdev, -- felix->info->switch_pci_bar); -+ base = pci_resource_start(felix->pdev, felix->info->pci_bar); - - for (i = 0; i < TARGET_MAX; i++) { - struct regmap *target; -@@ -293,8 +292,8 @@ static int felix_init_structs(struct fel - - res = &felix->info->target_io_res[i]; - res->flags = IORESOURCE_MEM; -- res->start += switch_base; -- res->end += switch_base; -+ res->start += base; -+ res->end += base; - - target = ocelot_regmap_init(ocelot, res); - if (IS_ERR(target)) { -@@ -328,8 +327,8 @@ static int felix_init_structs(struct fel - - res = &felix->info->port_io_res[port]; - res->flags = IORESOURCE_MEM; -- res->start += switch_base; -- res->end += switch_base; -+ res->start += base; -+ res->end += base; - - port_regs = devm_ioremap_resource(ocelot->dev, res); - if (IS_ERR(port_regs)) { -@@ -343,12 +342,6 @@ static int felix_init_structs(struct fel - ocelot->ports[port] = ocelot_port; - } - -- if (felix->info->mdio_bus_alloc) { -- err = felix->info->mdio_bus_alloc(ocelot); -- if (err < 0) -- return err; -- } -- - return 0; - } - -@@ -384,10 +377,6 @@ static int felix_setup(struct dsa_switch - static void felix_teardown(struct dsa_switch *ds) - { - struct ocelot *ocelot = ds->priv; -- struct felix *felix = ocelot_to_felix(ocelot); -- -- if (felix->imdio) -- mdiobus_unregister(felix->imdio); - - /* stop workqueue thread */ - ocelot_deinit(ocelot); ---- a/drivers/net/dsa/ocelot/felix.h -+++ b/drivers/net/dsa/ocelot/felix.h -@@ -10,7 +10,6 @@ - struct felix_info { - struct resource *target_io_res; - struct resource *port_io_res; -- struct resource *imdio_res; - const struct reg_field *regfields; - const u32 *const *map; - const struct ocelot_ops *ops; -@@ -18,10 +17,8 @@ struct felix_info { - const struct ocelot_stat_layout *stats_layout; - unsigned int num_stats; - int num_ports; -- int switch_pci_bar; -- int imdio_pci_bar; -+ int pci_bar; - unsigned long quirks; -- int (*mdio_bus_alloc)(struct ocelot *ocelot); - }; - - extern struct felix_info felix_info_vsc9959; -@@ -36,8 +33,6 @@ struct felix { - struct pci_dev *pdev; - struct felix_info *info; - struct ocelot ocelot; -- struct mii_bus *imdio; -- struct phy_device **pcs; - }; - - #endif ---- a/drivers/net/dsa/ocelot/felix_vsc9959.c -+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c -@@ -2,7 +2,6 @@ - /* Copyright 2017 Microsemi Corporation - * Copyright 2018-2019 NXP Semiconductors - */ --#include - #include - #include - #include -@@ -391,15 +390,6 @@ static struct resource vsc9959_port_io_r - }, - }; - --/* Port MAC 0 Internal MDIO bus through which the SerDes acting as an -- * SGMII/QSGMII MAC PCS can be found. -- */ --static struct resource vsc9959_imdio_res = { -- .start = 0x8030, -- .end = 0x8040, -- .name = "imdio", --}; -- - static const struct reg_field vsc9959_regfields[] = { - [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 6, 6), - [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 5), -@@ -579,291 +569,13 @@ static int vsc9959_reset(struct ocelot * - return 0; - } - --void vsc9959_pcs_validate(struct ocelot *ocelot, int port, -- unsigned long *supported, -- struct phylink_link_state *state) --{ -- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -- -- if (state->interface != PHY_INTERFACE_MODE_NA && -- state->interface != PHY_INTERFACE_MODE_GMII && -- state->interface != PHY_INTERFACE_MODE_SGMII && -- state->interface != PHY_INTERFACE_MODE_QSGMII && -- state->interface != PHY_INTERFACE_MODE_USXGMII) { -- bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -- return; -- } -- -- /* No half-duplex. */ -- phylink_set_port_modes(mask); -- phylink_set(mask, Autoneg); -- phylink_set(mask, Pause); -- phylink_set(mask, Asym_Pause); -- phylink_set(mask, 10baseT_Full); -- phylink_set(mask, 100baseT_Full); -- phylink_set(mask, 1000baseT_Full); -- phylink_set(mask, 1000baseX_Full); -- phylink_set(mask, 2500baseT_Full); -- phylink_set(mask, 2500baseX_Full); -- phylink_set(mask, 1000baseKX_Full); -- -- bitmap_and(supported, supported, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); -- bitmap_and(state->advertising, state->advertising, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); --} -- --static void vsc9959_pcs_an_restart(struct ocelot *ocelot, int port) --{ -- struct felix *felix = ocelot_to_felix(ocelot); -- struct phy_device *pcs = felix->pcs[port]; -- -- if (!pcs) -- return; -- -- phy_set_bits(pcs, MII_BMCR, BMCR_ANRESTART); --} -- --static void vsc9959_pcs_init_sgmii(struct phy_device *pcs, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) --{ -- /* SGMII spec requires tx_config_Reg[15:0] to be exactly 0x4001 -- * for the MAC PCS in order to acknowledge the AN. -- */ -- phy_write(pcs, MII_ADVERTISE, ADVERTISE_SGMII | ADVERTISE_LPACK); -- -- /* Set to SGMII mode, use AN */ -- phy_write(pcs, ENETC_PCS_IF_MODE, ENETC_PCS_IF_MODE_SGMII_AN); -- -- /* Adjust link timer for SGMII */ -- phy_write(pcs, ENETC_PCS_LINK_TIMER1, ENETC_PCS_LINK_TIMER1_VAL); -- phy_write(pcs, ENETC_PCS_LINK_TIMER2, ENETC_PCS_LINK_TIMER2_VAL); -- -- phy_write(pcs, MII_BMCR, BMCR_SPEED1000 | -- BMCR_FULLDPLX | -- BMCR_ANENABLE); --} -- --#define ADVERTISE_USXGMII_FDX BIT(12) -- --static void vsc9959_pcs_init_sxgmii(struct phy_device *pcs, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) --{ -- /* Configure device ability for the USXGMII Replicator */ -- phy_write_mmd(pcs, MDIO_MMD_VEND2, MII_ADVERTISE, -- ADVERTISE_SGMII | -- ADVERTISE_LPACK | -- ADVERTISE_USXGMII_FDX); --} -- --static void vsc9959_pcs_init(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) --{ -- struct felix *felix = ocelot_to_felix(ocelot); -- struct phy_device *pcs = felix->pcs[port]; -- -- if (!pcs) -- return; -- -- if (link_an_mode == MLO_AN_FIXED) { -- phydev_err(pcs, "Fixed modes are not yet supported.\n"); -- return; -- } -- -- pcs->interface = state->interface; -- if (pcs->interface == PHY_INTERFACE_MODE_USXGMII) -- pcs->is_c45 = true; -- else -- pcs->is_c45 = false; -- -- /* The PCS does not implement the BMSR register fully, so capability -- * detection via genphy_read_abilities does not work. Since we can get -- * the PHY config word from the LPA register though, there is still -- * value in using the generic phy_resolve_aneg_linkmode function. So -- * populate the supported and advertising link modes manually here. -- */ -- linkmode_set_bit_array(phy_basic_ports_array, -- ARRAY_SIZE(phy_basic_ports_array), -- pcs->supported); -- linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, pcs->supported); -- linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, pcs->supported); -- linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, pcs->supported); -- linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, pcs->supported); -- phy_advertise_supported(pcs); -- -- switch (pcs->interface) { -- case PHY_INTERFACE_MODE_SGMII: -- case PHY_INTERFACE_MODE_QSGMII: -- vsc9959_pcs_init_sgmii(pcs, link_an_mode, state); -- break; -- case PHY_INTERFACE_MODE_USXGMII: -- vsc9959_pcs_init_sxgmii(pcs, link_an_mode, state); -- break; -- default: -- dev_err(ocelot->dev, "Unsupported link mode %s\n", -- phy_modes(pcs->interface)); -- } --} -- --static void vsc9959_pcs_link_state(struct ocelot *ocelot, int port, -- struct phylink_link_state *state) --{ -- struct felix *felix = ocelot_to_felix(ocelot); -- struct phy_device *pcs = felix->pcs[port]; -- int err; -- -- if (!pcs) -- return; -- -- /* Reading PCS status not yet supported for USXGMII */ -- if (pcs->is_c45) { -- state->link = 1; -- return; -- } -- -- pcs->speed = SPEED_UNKNOWN; -- pcs->duplex = DUPLEX_UNKNOWN; -- pcs->pause = 0; -- pcs->asym_pause = 0; -- -- err = genphy_update_link(pcs); -- if (err < 0) -- return; -- -- if (pcs->autoneg_complete) { -- u16 lpa = phy_read(pcs, MII_LPA); -- -- switch (state->interface) { -- case PHY_INTERFACE_MODE_SGMII: -- case PHY_INTERFACE_MODE_QSGMII: -- mii_lpa_to_linkmode_lpa_sgmii(pcs->lp_advertising, lpa); -- break; -- default: -- return; -- } -- -- phy_resolve_aneg_linkmode(pcs); -- } -- -- state->an_complete = pcs->autoneg_complete; -- state->an_enabled = pcs->autoneg; -- state->link = pcs->link; -- state->duplex = pcs->duplex; -- state->speed = pcs->speed; -- /* SGMII AN does not negotiate flow control, but that's ok, -- * since phylink already knows that, and does: -- * link_state.pause |= pl->phy_state.pause; -- */ -- state->pause = pcs->pause; -- -- dev_dbg(ocelot->dev, -- "%s: mode=%s/%s/%s adv=%*pb lpa=%*pb link=%u an_enabled=%u an_complete=%u\n", -- __func__, -- phy_modes(state->interface), -- phy_speed_to_str(state->speed), -- phy_duplex_to_str(state->duplex), -- __ETHTOOL_LINK_MODE_MASK_NBITS, state->advertising, -- __ETHTOOL_LINK_MODE_MASK_NBITS, state->lp_advertising, -- state->link, state->an_enabled, state->an_complete); --} -- - static const struct ocelot_ops vsc9959_ops = { - .reset = vsc9959_reset, -- .pcs_init = vsc9959_pcs_init, -- .pcs_an_restart = vsc9959_pcs_an_restart, -- .pcs_link_state = vsc9959_pcs_link_state, -- .pcs_validate = vsc9959_pcs_validate, - }; - --static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) --{ -- struct felix *felix = ocelot_to_felix(ocelot); -- struct enetc_mdio_priv *mdio_priv; -- struct device *dev = ocelot->dev; -- resource_size_t imdio_base; -- void __iomem *imdio_regs; -- struct resource *res; -- struct enetc_hw *hw; -- struct mii_bus *bus; -- int port; -- int rc; -- -- felix->pcs = devm_kcalloc(dev, felix->info->num_ports, -- sizeof(struct phy_device), -- GFP_KERNEL); -- if (!felix->pcs) { -- dev_err(dev, "failed to allocate array for PCS PHYs\n"); -- return -ENOMEM; -- } -- -- imdio_base = pci_resource_start(felix->pdev, -- felix->info->imdio_pci_bar); -- -- res = felix->info->imdio_res; -- res->flags = IORESOURCE_MEM; -- res->start += imdio_base; -- res->end += imdio_base; -- -- imdio_regs = devm_ioremap_resource(dev, res); -- if (IS_ERR(imdio_regs)) { -- dev_err(dev, "failed to map internal MDIO registers\n"); -- return PTR_ERR(imdio_regs); -- } -- -- hw = enetc_hw_alloc(dev, imdio_regs); -- if (IS_ERR(hw)) { -- dev_err(dev, "failed to allocate ENETC HW structure\n"); -- return PTR_ERR(hw); -- } -- -- bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); -- if (!bus) -- return -ENOMEM; -- -- bus->name = "VSC9959 internal MDIO bus"; -- bus->read = enetc_mdio_read; -- bus->write = enetc_mdio_write; -- bus->parent = dev; -- mdio_priv = bus->priv; -- mdio_priv->hw = hw; -- /* This gets added to imdio_regs, which already maps addresses -- * starting with the proper offset. -- */ -- mdio_priv->mdio_base = 0; -- snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); -- -- /* Needed in order to initialize the bus mutex lock */ -- rc = mdiobus_register(bus); -- if (rc < 0) { -- dev_err(dev, "failed to register MDIO bus\n"); -- return rc; -- } -- -- felix->imdio = bus; -- -- for (port = 0; port < felix->info->num_ports; port++) { -- struct phy_device *pcs; -- bool is_c45 = false; -- -- pcs = get_phy_device(felix->imdio, port, is_c45); -- if (IS_ERR(pcs)) -- continue; -- -- felix->pcs[port] = pcs; -- -- dev_info(dev, "Found PCS at internal MDIO address %d\n", port); -- } -- -- return 0; --} -- - struct felix_info felix_info_vsc9959 = { - .target_io_res = vsc9959_target_io_res, - .port_io_res = vsc9959_port_io_res, -- .imdio_res = &vsc9959_imdio_res, - .regfields = vsc9959_regfields, - .map = vsc9959_regmap, - .ops = &vsc9959_ops, -@@ -871,8 +583,6 @@ struct felix_info felix_info_vsc9959 = { - .num_stats = ARRAY_SIZE(vsc9959_stats_layout), - .shared_queue_sz = 128 * 1024, - .num_ports = 6, -- .switch_pci_bar = 4, -- .imdio_pci_bar = 0, -+ .pci_bar = 4, - .quirks = OCELOT_PCS_PERFORMS_RATE_ADAPTATION, -- .mdio_bus_alloc = vsc9959_mdio_bus_alloc, - }; diff --git a/target/linux/layerscape/patches-5.4/701-net-0369-Revert-net-mscc-ocelot-introduce-more-focused-PCS-op.patch b/target/linux/layerscape/patches-5.4/701-net-0369-Revert-net-mscc-ocelot-introduce-more-focused-PCS-op.patch deleted file mode 100644 index 9ba2030314..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0369-Revert-net-mscc-ocelot-introduce-more-focused-PCS-op.patch +++ /dev/null @@ -1,164 +0,0 @@ -From e1aa2a770cc5f4d46693bb491ed2ca7f066c3585 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:30:41 +0200 -Subject: [PATCH] Revert "net: mscc: ocelot: introduce more focused PCS ops for - PHYLINK" - -This reverts commit 423c8b04007c85907f8f514de459ebc8541f0a54. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/ethernet/mscc/ocelot.c | 36 ++++++++++++++++++++++++-------- - drivers/net/ethernet/mscc/ocelot_board.c | 35 +------------------------------ - include/soc/mscc/ocelot.h | 12 +++-------- - 3 files changed, 31 insertions(+), 52 deletions(-) - ---- a/drivers/net/ethernet/mscc/ocelot.c -+++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -410,25 +410,43 @@ void ocelot_phylink_validate(struct ocel - unsigned long *supported, - struct phylink_link_state *state) - { -- if (ocelot->ops->pcs_validate) -- ocelot->ops->pcs_validate(ocelot, port, supported, state); -+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -+ -+ if (state->interface != PHY_INTERFACE_MODE_NA && -+ state->interface != PHY_INTERFACE_MODE_GMII && -+ state->interface != PHY_INTERFACE_MODE_SGMII && -+ state->interface != PHY_INTERFACE_MODE_QSGMII) { -+ bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -+ return; -+ } -+ -+ /* No half-duplex. */ -+ phylink_set_port_modes(mask); -+ phylink_set(mask, Autoneg); -+ phylink_set(mask, Pause); -+ phylink_set(mask, Asym_Pause); -+ phylink_set(mask, 10baseT_Full); -+ phylink_set(mask, 100baseT_Full); -+ phylink_set(mask, 1000baseT_Full); -+ phylink_set(mask, 2500baseT_Full); -+ -+ bitmap_and(supported, supported, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); -+ bitmap_and(state->advertising, state->advertising, mask, -+ __ETHTOOL_LINK_MODE_MASK_NBITS); - } - EXPORT_SYMBOL(ocelot_phylink_validate); - - void ocelot_phylink_mac_pcs_get_state(struct ocelot *ocelot, int port, - struct phylink_link_state *state) - { -- if (ocelot->ops->pcs_link_state) -- ocelot->ops->pcs_link_state(ocelot, port, state); -- else -- state->link = 1; -+ state->link = 1; - } - EXPORT_SYMBOL(ocelot_phylink_mac_pcs_get_state); - - void ocelot_phylink_mac_an_restart(struct ocelot *ocelot, int port) - { -- if (ocelot->ops->pcs_an_restart) -- ocelot->ops->pcs_an_restart(ocelot, port); -+ /* Not supported */ - } - EXPORT_SYMBOL(ocelot_phylink_mac_an_restart); - -@@ -472,7 +490,7 @@ void ocelot_phylink_mac_config(struct oc - ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG); - - if (ocelot->ops->pcs_init) -- ocelot->ops->pcs_init(ocelot, port, link_an_mode, state); -+ ocelot->ops->pcs_init(ocelot, port); - - /* Enable MAC module */ - ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA | ---- a/drivers/net/ethernet/mscc/ocelot_board.c -+++ b/drivers/net/ethernet/mscc/ocelot_board.c -@@ -212,9 +212,7 @@ static const struct of_device_id mscc_oc - }; - MODULE_DEVICE_TABLE(of, mscc_ocelot_match); - --static void ocelot_port_pcs_init(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) -+static void ocelot_port_pcs_init(struct ocelot *ocelot, int port) - { - struct ocelot_port *ocelot_port = ocelot->ports[port]; - -@@ -237,36 +235,6 @@ static void ocelot_port_pcs_init(struct - ocelot_port_writel(ocelot_port, 0, PCS1G_LB_CFG); - } - --void ocelot_port_pcs_validate(struct ocelot *ocelot, int port, -- unsigned long *supported, -- struct phylink_link_state *state) --{ -- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -- -- if (state->interface != PHY_INTERFACE_MODE_NA && -- state->interface != PHY_INTERFACE_MODE_GMII && -- state->interface != PHY_INTERFACE_MODE_SGMII && -- state->interface != PHY_INTERFACE_MODE_QSGMII) { -- bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -- return; -- } -- -- /* No half-duplex. */ -- phylink_set_port_modes(mask); -- phylink_set(mask, Autoneg); -- phylink_set(mask, Pause); -- phylink_set(mask, Asym_Pause); -- phylink_set(mask, 10baseT_Full); -- phylink_set(mask, 100baseT_Full); -- phylink_set(mask, 1000baseT_Full); -- phylink_set(mask, 2500baseT_Full); -- -- bitmap_and(supported, supported, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); -- bitmap_and(state->advertising, state->advertising, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); --} -- - static int ocelot_reset(struct ocelot *ocelot) - { - int retries = 100; -@@ -292,7 +260,6 @@ static int ocelot_reset(struct ocelot *o - - static const struct ocelot_ops ocelot_ops = { - .pcs_init = ocelot_port_pcs_init, -- .pcs_validate = ocelot_port_pcs_validate, - .reset = ocelot_reset, - }; - ---- a/include/soc/mscc/ocelot.h -+++ b/include/soc/mscc/ocelot.h -@@ -412,15 +412,7 @@ enum { - struct ocelot; - - struct ocelot_ops { -- void (*pcs_init)(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- const struct phylink_link_state *state); -- void (*pcs_an_restart)(struct ocelot *ocelot, int port); -- void (*pcs_link_state)(struct ocelot *ocelot, int port, -- struct phylink_link_state *state); -- void (*pcs_validate)(struct ocelot *ocelot, int port, -- unsigned long *supported, -- struct phylink_link_state *state); -+ void (*pcs_init)(struct ocelot *ocelot, int port); - int (*reset)(struct ocelot *ocelot); - }; - -@@ -487,6 +479,8 @@ struct ocelot { - struct mutex ptp_lock; - /* Protects the PTP clock */ - spinlock_t ptp_clock_lock; -+ -+ void (*port_pcs_init)(struct ocelot_port *port); - }; - - #define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) diff --git a/target/linux/layerscape/patches-5.4/701-net-0370-Revert-net-mscc-ocelot-convert-to-PHYLINK.patch b/target/linux/layerscape/patches-5.4/701-net-0370-Revert-net-mscc-ocelot-convert-to-PHYLINK.patch deleted file mode 100644 index 14231041f4..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0370-Revert-net-mscc-ocelot-convert-to-PHYLINK.patch +++ /dev/null @@ -1,653 +0,0 @@ -From 74e550d54d7c8142aefc06d1f00c506cd9039b6d Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:30:48 +0200 -Subject: [PATCH] Revert "net: mscc: ocelot: convert to PHYLINK" - -This reverts commit e51cc023c37902e10d1e0109ff0c6ddcce3d5c03. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/dsa/ocelot/felix.c | 65 ++++--------- - drivers/net/ethernet/mscc/Kconfig | 2 +- - drivers/net/ethernet/mscc/ocelot.c | 150 ++++++++++++++---------------- - drivers/net/ethernet/mscc/ocelot.h | 13 ++- - drivers/net/ethernet/mscc/ocelot_board.c | 154 ++++--------------------------- - include/soc/mscc/ocelot.h | 22 +---- - 6 files changed, 117 insertions(+), 289 deletions(-) - ---- a/drivers/net/dsa/ocelot/felix.c -+++ b/drivers/net/dsa/ocelot/felix.c -@@ -58,6 +58,14 @@ static int felix_set_ageing_time(struct - return 0; - } - -+static void felix_adjust_link(struct dsa_switch *ds, int port, -+ struct phy_device *phydev) -+{ -+ struct ocelot *ocelot = ds->priv; -+ -+ ocelot_adjust_link(ocelot, port, phydev); -+} -+ - static int felix_fdb_dump(struct dsa_switch *ds, int port, - dsa_fdb_dump_cb_t *cb, void *data) - { -@@ -177,59 +185,21 @@ static int felix_tsn_enable(struct dsa_p - } - #endif - --static void felix_phylink_validate(struct dsa_switch *ds, int port, -- unsigned long *supported, -- struct phylink_link_state *state) -+static int felix_port_enable(struct dsa_switch *ds, int port, -+ struct phy_device *phy) - { - struct ocelot *ocelot = ds->priv; - -- ocelot_phylink_validate(ocelot, port, supported, state); --} -- --static int felix_phylink_mac_pcs_get_state(struct dsa_switch *ds, int port, -- struct phylink_link_state *state) --{ -- struct ocelot *ocelot = ds->priv; -- -- ocelot_phylink_mac_pcs_get_state(ocelot, port, state); -+ ocelot_port_enable(ocelot, port, phy); - - return 0; - } - --static void felix_phylink_mac_config(struct dsa_switch *ds, int port, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) --{ -- struct ocelot *ocelot = ds->priv; -- -- ocelot_phylink_mac_config(ocelot, port, link_an_mode, state); --} -- --static void felix_phylink_mac_an_restart(struct dsa_switch *ds, int port) --{ -- struct ocelot *ocelot = ds->priv; -- -- ocelot_phylink_mac_an_restart(ocelot, port); --} -- --static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, -- unsigned int link_an_mode, -- phy_interface_t interface) --{ -- struct ocelot *ocelot = ds->priv; -- -- ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface); --} -- --static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, -- unsigned int link_an_mode, -- phy_interface_t interface, -- struct phy_device *phydev) -+static void felix_port_disable(struct dsa_switch *ds, int port) - { - struct ocelot *ocelot = ds->priv; - -- ocelot_phylink_mac_link_up(ocelot, port, link_an_mode, interface, -- phydev); -+ return ocelot_port_disable(ocelot, port); - } - - static void felix_get_strings(struct dsa_switch *ds, int port, -@@ -447,12 +417,9 @@ static const struct dsa_switch_ops felix - .get_ethtool_stats = felix_get_ethtool_stats, - .get_sset_count = felix_get_sset_count, - .get_ts_info = felix_get_ts_info, -- .phylink_validate = felix_phylink_validate, -- .phylink_mac_link_state = felix_phylink_mac_pcs_get_state, -- .phylink_mac_config = felix_phylink_mac_config, -- .phylink_mac_an_restart = felix_phylink_mac_an_restart, -- .phylink_mac_link_down = felix_phylink_mac_link_down, -- .phylink_mac_link_up = felix_phylink_mac_link_up, -+ .adjust_link = felix_adjust_link, -+ .port_enable = felix_port_enable, -+ .port_disable = felix_port_disable, - .port_fdb_dump = felix_fdb_dump, - .port_fdb_add = felix_fdb_add, - .port_fdb_del = felix_fdb_del, ---- a/drivers/net/ethernet/mscc/Kconfig -+++ b/drivers/net/ethernet/mscc/Kconfig -@@ -15,7 +15,7 @@ config MSCC_OCELOT_SWITCH - tristate "Ocelot switch driver" - depends on NET_SWITCHDEV - depends on HAS_IOMEM -- select PHYLINK -+ select PHYLIB - select REGMAP_MMIO - help - This driver supports the Ocelot network switch device. ---- a/drivers/net/ethernet/mscc/ocelot.c -+++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -13,7 +13,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -406,66 +406,18 @@ static u16 ocelot_wm_enc(u16 value) - return value; - } - --void ocelot_phylink_validate(struct ocelot *ocelot, int port, -- unsigned long *supported, -- struct phylink_link_state *state) --{ -- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -- -- if (state->interface != PHY_INTERFACE_MODE_NA && -- state->interface != PHY_INTERFACE_MODE_GMII && -- state->interface != PHY_INTERFACE_MODE_SGMII && -- state->interface != PHY_INTERFACE_MODE_QSGMII) { -- bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); -- return; -- } -- -- /* No half-duplex. */ -- phylink_set_port_modes(mask); -- phylink_set(mask, Autoneg); -- phylink_set(mask, Pause); -- phylink_set(mask, Asym_Pause); -- phylink_set(mask, 10baseT_Full); -- phylink_set(mask, 100baseT_Full); -- phylink_set(mask, 1000baseT_Full); -- phylink_set(mask, 2500baseT_Full); -- -- bitmap_and(supported, supported, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); -- bitmap_and(state->advertising, state->advertising, mask, -- __ETHTOOL_LINK_MODE_MASK_NBITS); --} --EXPORT_SYMBOL(ocelot_phylink_validate); -- --void ocelot_phylink_mac_pcs_get_state(struct ocelot *ocelot, int port, -- struct phylink_link_state *state) --{ -- state->link = 1; --} --EXPORT_SYMBOL(ocelot_phylink_mac_pcs_get_state); -- --void ocelot_phylink_mac_an_restart(struct ocelot *ocelot, int port) --{ -- /* Not supported */ --} --EXPORT_SYMBOL(ocelot_phylink_mac_an_restart); -- --void ocelot_phylink_mac_config(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) -+void ocelot_adjust_link(struct ocelot *ocelot, int port, -+ struct phy_device *phydev) - { - int speed, mac_speed, mac_mode = DEV_MAC_MODE_CFG_FDX_ENA; - struct ocelot_port *ocelot_port = ocelot->ports[port]; -- u32 mac_fc_cfg; - - if (ocelot->quirks & OCELOT_PCS_PERFORMS_RATE_ADAPTATION) - speed = SPEED_1000; - else -- speed = state->speed; -+ speed = phydev->speed; - - switch (speed) { -- case SPEED_UNKNOWN: -- return; - case SPEED_10: - mac_speed = OCELOT_SPEED_10; - break; -@@ -481,11 +433,16 @@ void ocelot_phylink_mac_config(struct oc - mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA; - break; - default: -- dev_err(ocelot->dev, "Unsupported speed on port %d: %d\n", -+ dev_err(ocelot->dev, "Unsupported PHY speed on port %d: %d\n", - port, speed); - return; - } - -+ phy_print_status(phydev); -+ -+ if (!phydev->link) -+ return; -+ - /* Only full duplex supported for now */ - ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG); - -@@ -512,36 +469,27 @@ void ocelot_phylink_mac_config(struct oc - QSYS_SWITCH_PORT_MODE, port); - - /* Flow control */ -- mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed); -- if (state->pause & MLO_PAUSE_RX) -- mac_fc_cfg |= SYS_MAC_FC_CFG_RX_FC_ENA; -- if (state->pause & MLO_PAUSE_TX) -- mac_fc_cfg |= SYS_MAC_FC_CFG_TX_FC_ENA | -- SYS_MAC_FC_CFG_PAUSE_VAL_CFG(0xffff) | -- SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) | -- SYS_MAC_FC_CFG_ZERO_PAUSE_ENA; -- ocelot_write_rix(ocelot, mac_fc_cfg, SYS_MAC_FC_CFG, port); -- -+ ocelot_write_rix(ocelot, SYS_MAC_FC_CFG_PAUSE_VAL_CFG(0xffff) | -+ SYS_MAC_FC_CFG_RX_FC_ENA | SYS_MAC_FC_CFG_TX_FC_ENA | -+ SYS_MAC_FC_CFG_ZERO_PAUSE_ENA | -+ SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) | -+ SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed), -+ SYS_MAC_FC_CFG, port); - ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); - } --EXPORT_SYMBOL(ocelot_phylink_mac_config); -+EXPORT_SYMBOL(ocelot_adjust_link); - --void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- phy_interface_t interface) -+static void ocelot_port_adjust_link(struct net_device *dev) - { -- struct ocelot_port *ocelot_port = ocelot->ports[port]; -+ struct ocelot_port_private *priv = netdev_priv(dev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; - -- ocelot_port_writel(ocelot_port, 0, DEV_MAC_ENA_CFG); -- ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA, -- QSYS_SWITCH_PORT_MODE, port); -+ ocelot_adjust_link(ocelot, port, dev->phydev); - } --EXPORT_SYMBOL(ocelot_phylink_mac_link_down); - --void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- phy_interface_t interface, -- struct phy_device *phy) -+void ocelot_port_enable(struct ocelot *ocelot, int port, -+ struct phy_device *phy) - { - /* Enable receiving frames on the port, and activate auto-learning of - * MAC addresses. -@@ -551,22 +499,62 @@ void ocelot_phylink_mac_link_up(struct o - ANA_PORT_PORT_CFG_PORTID_VAL(port), - ANA_PORT_PORT_CFG, port); - } --EXPORT_SYMBOL(ocelot_phylink_mac_link_up); -+EXPORT_SYMBOL(ocelot_port_enable); - - static int ocelot_port_open(struct net_device *dev) - { - struct ocelot_port_private *priv = netdev_priv(dev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ int err; -+ -+ if (priv->serdes) { -+ err = phy_set_mode_ext(priv->serdes, PHY_MODE_ETHERNET, -+ priv->phy_mode); -+ if (err) { -+ netdev_err(dev, "Could not set mode of SerDes\n"); -+ return err; -+ } -+ } -+ -+ err = phy_connect_direct(dev, priv->phy, &ocelot_port_adjust_link, -+ priv->phy_mode); -+ if (err) { -+ netdev_err(dev, "Could not attach to PHY\n"); -+ return err; -+ } - -- phylink_start(priv->phylink); -+ dev->phydev = priv->phy; -+ -+ phy_attached_info(priv->phy); -+ phy_start(priv->phy); -+ -+ ocelot_port_enable(ocelot, port, priv->phy); - - return 0; - } - -+void ocelot_port_disable(struct ocelot *ocelot, int port) -+{ -+ struct ocelot_port *ocelot_port = ocelot->ports[port]; -+ -+ ocelot_port_writel(ocelot_port, 0, DEV_MAC_ENA_CFG); -+ ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA, -+ QSYS_SWITCH_PORT_MODE, port); -+} -+EXPORT_SYMBOL(ocelot_port_disable); -+ - static int ocelot_port_stop(struct net_device *dev) - { - struct ocelot_port_private *priv = netdev_priv(dev); -+ struct ocelot *ocelot = priv->port.ocelot; -+ int port = priv->chip_port; -+ -+ phy_disconnect(priv->phy); -+ -+ dev->phydev = NULL; - -- phylink_stop(priv->phylink); -+ ocelot_port_disable(ocelot, port); - - return 0; - } -@@ -2263,7 +2251,8 @@ void ocelot_init_port(struct ocelot *oce - EXPORT_SYMBOL(ocelot_init_port); - - int ocelot_probe_port(struct ocelot *ocelot, u8 port, -- void __iomem *regs) -+ void __iomem *regs, -+ struct phy_device *phy) - { - struct ocelot_port_private *priv; - struct ocelot_port *ocelot_port; -@@ -2276,6 +2265,7 @@ int ocelot_probe_port(struct ocelot *oce - SET_NETDEV_DEV(dev, ocelot->dev); - priv = netdev_priv(dev); - priv->dev = dev; -+ priv->phy = phy; - priv->chip_port = port; - ocelot_port = &priv->port; - ocelot_port->ocelot = ocelot; ---- a/drivers/net/ethernet/mscc/ocelot.h -+++ b/drivers/net/ethernet/mscc/ocelot.h -@@ -12,7 +12,8 @@ - #include - #include - #include --#include -+#include -+#include - #include - #include - #include -@@ -64,12 +65,14 @@ struct ocelot_multicast { - struct ocelot_port_private { - struct ocelot_port port; - struct net_device *dev; -- struct phylink *phylink; -- struct phylink_config phylink_config; -+ struct phy_device *phy; - u8 chip_port; - - u8 vlan_aware; - -+ phy_interface_t phy_mode; -+ struct phy *serdes; -+ - struct ocelot_port_tc tc; - }; - -@@ -80,7 +83,9 @@ void ocelot_port_writel(struct ocelot_po - #define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val)) - - int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops); --int ocelot_probe_port(struct ocelot *ocelot, u8 port, void __iomem *regs); -+int ocelot_probe_port(struct ocelot *ocelot, u8 port, -+ void __iomem *regs, -+ struct phy_device *phy); - - void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu, - enum ocelot_tag_prefix injection, ---- a/drivers/net/ethernet/mscc/ocelot_board.c -+++ b/drivers/net/ethernet/mscc/ocelot_board.c -@@ -13,7 +13,6 @@ - #include - #include - #include --#include - - #include "ocelot.h" - -@@ -263,91 +262,6 @@ static const struct ocelot_ops ocelot_op - .reset = ocelot_reset, - }; - --static void ocelot_port_phylink_validate(struct phylink_config *config, -- unsigned long *supported, -- struct phylink_link_state *state) --{ -- struct net_device *ndev = to_net_dev(config->dev); -- struct ocelot_port_private *priv = netdev_priv(ndev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- ocelot_phylink_validate(ocelot, port, supported, state); --} -- --static int --ocelot_port_phylink_mac_pcs_get_state(struct phylink_config *config, -- struct phylink_link_state *state) --{ -- struct net_device *ndev = to_net_dev(config->dev); -- struct ocelot_port_private *priv = netdev_priv(ndev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- ocelot_phylink_mac_pcs_get_state(ocelot, port, state); -- -- return 0; --} -- --static void ocelot_port_phylink_mac_an_restart(struct phylink_config *config) --{ -- struct net_device *ndev = to_net_dev(config->dev); -- struct ocelot_port_private *priv = netdev_priv(ndev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- ocelot_phylink_mac_an_restart(ocelot, port); --} -- --static void --ocelot_port_phylink_mac_config(struct phylink_config *config, -- unsigned int link_an_mode, -- const struct phylink_link_state *state) --{ -- struct net_device *ndev = to_net_dev(config->dev); -- struct ocelot_port_private *priv = netdev_priv(ndev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- ocelot_phylink_mac_config(ocelot, port, link_an_mode, state); --} -- --static void ocelot_port_phylink_mac_link_down(struct phylink_config *config, -- unsigned int link_an_mode, -- phy_interface_t interface) --{ -- struct net_device *ndev = to_net_dev(config->dev); -- struct ocelot_port_private *priv = netdev_priv(ndev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- return ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, -- interface); --} -- --static void ocelot_port_phylink_mac_link_up(struct phylink_config *config, -- unsigned int link_an_mode, -- phy_interface_t interface, -- struct phy_device *phy) --{ -- struct net_device *ndev = to_net_dev(config->dev); -- struct ocelot_port_private *priv = netdev_priv(ndev); -- struct ocelot *ocelot = priv->port.ocelot; -- int port = priv->chip_port; -- -- return ocelot_phylink_mac_link_up(ocelot, port, link_an_mode, -- interface, phy); --} -- --static const struct phylink_mac_ops ocelot_phylink_ops = { -- .validate = ocelot_port_phylink_validate, -- .mac_link_state = ocelot_port_phylink_mac_pcs_get_state, -- .mac_an_restart = ocelot_port_phylink_mac_an_restart, -- .mac_config = ocelot_port_phylink_mac_config, -- .mac_link_down = ocelot_port_phylink_mac_link_down, -- .mac_link_up = ocelot_port_phylink_mac_link_up, --}; -- - static int mscc_ocelot_probe(struct platform_device *pdev) - { - struct device_node *np = pdev->dev.of_node; -@@ -455,6 +369,8 @@ static int mscc_ocelot_probe(struct plat - for_each_available_child_of_node(ports, portnp) { - struct ocelot_port_private *priv; - struct ocelot_port *ocelot_port; -+ struct device_node *phy_node; -+ struct phy_device *phy; - struct resource *res; - struct phy *serdes; - void __iomem *regs; -@@ -473,7 +389,16 @@ static int mscc_ocelot_probe(struct plat - if (IS_ERR(regs)) - continue; - -- err = ocelot_probe_port(ocelot, port, regs); -+ phy_node = of_parse_phandle(portnp, "phy-handle", 0); -+ if (!phy_node) -+ continue; -+ -+ phy = of_phy_find_device(phy_node); -+ of_node_put(phy_node); -+ if (!phy) -+ continue; -+ -+ err = ocelot_probe_port(ocelot, port, regs, phy); - if (err) { - of_node_put(portnp); - goto out_put_ports; -@@ -487,7 +412,9 @@ static int mscc_ocelot_probe(struct plat - if (phy_mode < 0) - phy_mode = PHY_INTERFACE_MODE_NA; - -- switch (phy_mode) { -+ priv->phy_mode = phy_mode; -+ -+ switch (priv->phy_mode) { - case PHY_INTERFACE_MODE_NA: - continue; - case PHY_INTERFACE_MODE_SGMII: -@@ -524,41 +451,7 @@ static int mscc_ocelot_probe(struct plat - goto out_put_ports; - } - -- if (serdes) { -- err = phy_set_mode_ext(serdes, PHY_MODE_ETHERNET, -- phy_mode); -- if (err) { -- dev_err(ocelot->dev, -- "Could not set mode of SerDes\n"); -- of_node_put(portnp); -- goto out_put_ports; -- } -- } -- -- priv->phylink_config.dev = &priv->dev->dev; -- priv->phylink_config.type = PHYLINK_NETDEV; -- -- priv->phylink = phylink_create(&priv->phylink_config, -- of_fwnode_handle(portnp), -- phy_mode, &ocelot_phylink_ops); -- if (IS_ERR(priv->phylink)) { -- dev_err(ocelot->dev, -- "Could not create a phylink instance (%ld)\n", -- PTR_ERR(priv->phylink)); -- err = PTR_ERR(priv->phylink); -- priv->phylink = NULL; -- of_node_put(portnp); -- goto out_put_ports; -- } -- -- err = phylink_of_phy_connect(priv->phylink, portnp, 0); -- if (err) { -- dev_err(ocelot->dev, "Could not connect to PHY: %d\n", -- err); -- phylink_destroy(priv->phylink); -- of_node_put(portnp); -- goto out_put_ports; -- } -+ priv->serdes = serdes; - } - - register_netdevice_notifier(&ocelot_netdevice_nb); -@@ -575,27 +468,12 @@ out_put_ports: - static int mscc_ocelot_remove(struct platform_device *pdev) - { - struct ocelot *ocelot = platform_get_drvdata(pdev); -- int port; - - ocelot_deinit(ocelot); - unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); - unregister_switchdev_notifier(&ocelot_switchdev_nb); - unregister_netdevice_notifier(&ocelot_netdevice_nb); - -- for (port = 0; port < ocelot->num_phys_ports; port++) { -- struct ocelot_port_private *priv; -- -- priv = container_of(ocelot->ports[port], -- struct ocelot_port_private, -- port); -- -- if (priv->phylink) { -- rtnl_lock(); -- phylink_destroy(priv->phylink); -- rtnl_unlock(); -- } -- } -- - return 0; - } - ---- a/include/soc/mscc/ocelot.h -+++ b/include/soc/mscc/ocelot.h -@@ -518,12 +518,17 @@ void ocelot_deinit(struct ocelot *ocelot - void ocelot_init_port(struct ocelot *ocelot, int port); - - /* DSA callbacks */ -+void ocelot_port_enable(struct ocelot *ocelot, int port, -+ struct phy_device *phy); -+void ocelot_port_disable(struct ocelot *ocelot, int port); - void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); - void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data); - int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset); - int ocelot_get_ts_info(struct ocelot *ocelot, int port, - struct ethtool_ts_info *info); - void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs); -+void ocelot_adjust_link(struct ocelot *ocelot, int port, -+ struct phy_device *phydev); - void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, - bool vlan_aware); - void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state); -@@ -592,21 +597,4 @@ int ocelot_rtag_parse_enable(struct ocel - int ocelot_dscp_set(struct ocelot *ocelot, int port, - bool enable, const u8 dscp_ix, - struct tsn_qos_switch_dscp_conf *c); --void ocelot_phylink_validate(struct ocelot *ocelot, int port, -- unsigned long *supported, -- struct phylink_link_state *state); --void ocelot_phylink_mac_pcs_get_state(struct ocelot *ocelot, int port, -- struct phylink_link_state *state); --void ocelot_phylink_mac_an_restart(struct ocelot *ocelot, int port); --void ocelot_phylink_mac_config(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- const struct phylink_link_state *state); --void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- phy_interface_t interface); --void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, -- unsigned int link_an_mode, -- phy_interface_t interface, -- struct phy_device *phy); -- - #endif diff --git a/target/linux/layerscape/patches-5.4/701-net-0371-Revert-net-mscc-ocelot-do-not-force-Felix-MACs-at-lo.patch b/target/linux/layerscape/patches-5.4/701-net-0371-Revert-net-mscc-ocelot-do-not-force-Felix-MACs-at-lo.patch deleted file mode 100644 index 4859d17463..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0371-Revert-net-mscc-ocelot-do-not-force-Felix-MACs-at-lo.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 6864e50946bf92f96b8452d1e47765230a276bb0 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:30:58 +0200 -Subject: [PATCH] Revert "net: mscc: ocelot: do not force Felix MACs at lower - speeds than gigabit" - -This reverts commit f3ebad1269aad8a04710e84dc1cd5de485e5fec4. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/dsa/ocelot/felix.c | 1 - - drivers/net/dsa/ocelot/felix.h | 1 - - drivers/net/dsa/ocelot/felix_vsc9959.c | 1 - - drivers/net/ethernet/mscc/ocelot.c | 32 ++++++++++++++------------------ - include/soc/mscc/ocelot.h | 7 ------- - 5 files changed, 14 insertions(+), 28 deletions(-) - ---- a/drivers/net/dsa/ocelot/felix.c -+++ b/drivers/net/dsa/ocelot/felix.c -@@ -249,7 +249,6 @@ static int felix_init_structs(struct fel - ocelot->num_stats = felix->info->num_stats; - ocelot->shared_queue_sz = felix->info->shared_queue_sz; - ocelot->ops = felix->info->ops; -- ocelot->quirks = felix->info->quirks; - - base = pci_resource_start(felix->pdev, felix->info->pci_bar); - ---- a/drivers/net/dsa/ocelot/felix.h -+++ b/drivers/net/dsa/ocelot/felix.h -@@ -18,7 +18,6 @@ struct felix_info { - unsigned int num_stats; - int num_ports; - int pci_bar; -- unsigned long quirks; - }; - - extern struct felix_info felix_info_vsc9959; ---- a/drivers/net/dsa/ocelot/felix_vsc9959.c -+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c -@@ -584,5 +584,4 @@ struct felix_info felix_info_vsc9959 = { - .shared_queue_sz = 128 * 1024, - .num_ports = 6, - .pci_bar = 4, -- .quirks = OCELOT_PCS_PERFORMS_RATE_ADAPTATION, - }; ---- a/drivers/net/ethernet/mscc/ocelot.c -+++ b/drivers/net/ethernet/mscc/ocelot.c -@@ -409,32 +409,27 @@ static u16 ocelot_wm_enc(u16 value) - void ocelot_adjust_link(struct ocelot *ocelot, int port, - struct phy_device *phydev) - { -- int speed, mac_speed, mac_mode = DEV_MAC_MODE_CFG_FDX_ENA; - struct ocelot_port *ocelot_port = ocelot->ports[port]; -+ int speed, mode = 0; - -- if (ocelot->quirks & OCELOT_PCS_PERFORMS_RATE_ADAPTATION) -- speed = SPEED_1000; -- else -- speed = phydev->speed; -- -- switch (speed) { -+ switch (phydev->speed) { - case SPEED_10: -- mac_speed = OCELOT_SPEED_10; -+ speed = OCELOT_SPEED_10; - break; - case SPEED_100: -- mac_speed = OCELOT_SPEED_100; -+ speed = OCELOT_SPEED_100; - break; - case SPEED_1000: -- mac_speed = OCELOT_SPEED_1000; -- mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA; -+ speed = OCELOT_SPEED_1000; -+ mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA; - break; - case SPEED_2500: -- mac_speed = OCELOT_SPEED_2500; -- mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA; -+ speed = OCELOT_SPEED_2500; -+ mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA; - break; - default: - dev_err(ocelot->dev, "Unsupported PHY speed on port %d: %d\n", -- port, speed); -+ port, phydev->speed); - return; - } - -@@ -444,7 +439,8 @@ void ocelot_adjust_link(struct ocelot *o - return; - - /* Only full duplex supported for now */ -- ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG); -+ ocelot_port_writel(ocelot_port, DEV_MAC_MODE_CFG_FDX_ENA | -+ mode, DEV_MAC_MODE_CFG); - - if (ocelot->ops->pcs_init) - ocelot->ops->pcs_init(ocelot, port); -@@ -455,11 +451,11 @@ void ocelot_adjust_link(struct ocelot *o - - /* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of - * reset */ -- ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(mac_speed), -+ ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed), - DEV_CLOCK_CFG); - - /* No PFC */ -- ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(mac_speed), -+ ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed), - ANA_PFC_PFC_CFG, port); - - /* Core: Enable port for frame transfer */ -@@ -473,7 +469,7 @@ void ocelot_adjust_link(struct ocelot *o - SYS_MAC_FC_CFG_RX_FC_ENA | SYS_MAC_FC_CFG_TX_FC_ENA | - SYS_MAC_FC_CFG_ZERO_PAUSE_ENA | - SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) | -- SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed), -+ SYS_MAC_FC_CFG_FC_LINK_SPEED(speed), - SYS_MAC_FC_CFG, port); - ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); - } ---- a/include/soc/mscc/ocelot.h -+++ b/include/soc/mscc/ocelot.h -@@ -404,11 +404,6 @@ enum ocelot_tag_prefix { - OCELOT_TAG_PREFIX_LONG, - }; - --/* Hardware quirks (differences between switch instantiations) */ --enum { -- OCELOT_PCS_PERFORMS_RATE_ADAPTATION = BIT(0), --}; -- - struct ocelot; - - struct ocelot_ops { -@@ -469,8 +464,6 @@ struct ocelot { - struct delayed_work stats_work; - struct workqueue_struct *stats_queue; - -- unsigned long quirks; -- - u8 ptp:1; - struct ptp_clock *ptp_clock; - struct ptp_clock_info ptp_info; diff --git a/target/linux/layerscape/patches-5.4/701-net-0372-Revert-enetc-Set-MDIO_CFG_HOLD-to-the-recommended-va.patch b/target/linux/layerscape/patches-5.4/701-net-0372-Revert-enetc-Set-MDIO_CFG_HOLD-to-the-recommended-va.patch deleted file mode 100644 index fda777ba99..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0372-Revert-enetc-Set-MDIO_CFG_HOLD-to-the-recommended-va.patch +++ /dev/null @@ -1,55 +0,0 @@ -From d93ca8d9c8365cf533f88582c57c83cb50fe598a Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:31:13 +0200 -Subject: [PATCH] Revert "enetc: Set MDIO_CFG_HOLD to the recommended value of - 2" - -This reverts commit 3f643e4af035886cd2ca4bf79967098cfe55b40b. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/ethernet/freescale/enetc/enetc_mdio.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c -+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c -@@ -31,19 +31,15 @@ static inline void _enetc_mdio_wr(struct - _enetc_mdio_wr(mdio_priv, ENETC_##off, val) - #define enetc_mdio_rd_reg(off) enetc_mdio_rd(mdio_priv, off) - -+#define ENETC_MDC_DIV 258 -+ - #define MDIO_CFG_CLKDIV(x) ((((x) >> 1) & 0xff) << 8) - #define MDIO_CFG_BSY BIT(0) - #define MDIO_CFG_RD_ER BIT(1) --#define MDIO_CFG_HOLD(x) (((x) << 2) & GENMASK(4, 2)) - #define MDIO_CFG_ENC45 BIT(6) - /* external MDIO only - driven on neg MDC edge */ - #define MDIO_CFG_NEG BIT(23) - --#define ENETC_EMDIO_CFG \ -- (MDIO_CFG_HOLD(2) | \ -- MDIO_CFG_CLKDIV(258) | \ -- MDIO_CFG_NEG) -- - #define MDIO_CTL_DEV_ADDR(x) ((x) & 0x1f) - #define MDIO_CTL_PORT_ADDR(x) (((x) & 0x1f) << 5) - #define MDIO_CTL_READ BIT(15) -@@ -65,7 +61,7 @@ int enetc_mdio_write(struct mii_bus *bus - u16 dev_addr; - int ret; - -- mdio_cfg = ENETC_EMDIO_CFG; -+ mdio_cfg = MDIO_CFG_CLKDIV(ENETC_MDC_DIV) | MDIO_CFG_NEG; - if (regnum & MII_ADDR_C45) { - dev_addr = (regnum >> 16) & 0x1f; - mdio_cfg |= MDIO_CFG_ENC45; -@@ -112,7 +108,7 @@ int enetc_mdio_read(struct mii_bus *bus, - u16 dev_addr, value; - int ret; - -- mdio_cfg = ENETC_EMDIO_CFG; -+ mdio_cfg = MDIO_CFG_CLKDIV(ENETC_MDC_DIV) | MDIO_CFG_NEG; - if (regnum & MII_ADDR_C45) { - dev_addr = (regnum >> 16) & 0x1f; - mdio_cfg |= MDIO_CFG_ENC45; diff --git a/target/linux/layerscape/patches-5.4/701-net-0373-Revert-enetc-export-enetc_mdio-definitionns-to-inclu.patch b/target/linux/layerscape/patches-5.4/701-net-0373-Revert-enetc-export-enetc_mdio-definitionns-to-inclu.patch deleted file mode 100644 index 5e934c69d1..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0373-Revert-enetc-export-enetc_mdio-definitionns-to-inclu.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 78378454e7978ea3b4128822880677e6efa9ddef Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:31:22 +0200 -Subject: [PATCH] Revert "enetc: export enetc_mdio definitionns to - include/linux/fsl" - -This reverts commit f8d80c003b76f397696bf887ebbd37a78781c050. - -Signed-off-by: Vladimir Oltean ---- - 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, 30 insertions(+), 62 deletions(-) - create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_mdio.h - delete 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 - #include - #include - #include - #include - - #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,7 +99,6 @@ 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) - { -@@ -155,21 +154,6 @@ 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) - { ---- /dev/null -+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.h -@@ -0,0 +1,12 @@ -+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ -+/* Copyright 2019 NXP */ -+ -+#include -+ -+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 - #include - #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,29 +14,17 @@ 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; - -- 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; -- } -+ hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); -+ if (!hw) -+ return -ENOMEM; - - bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); -- if (!bus) { -- err = -ENOMEM; -- goto err_mdiobus_alloc; -- } -+ if (!bus) -+ return -ENOMEM; - - bus->name = ENETC_MDIO_BUS_NAME; - bus->read = enetc_mdio_read; -@@ -51,7 +39,7 @@ static int enetc_pci_mdio_probe(struct p - err = pci_enable_device_mem(pdev); - if (err) { - dev_err(dev, "device enable failed\n"); -- goto err_pci_enable; -+ return err; - } - - err = pci_request_region(pdev, 0, KBUILD_MODNAME); -@@ -60,6 +48,13 @@ 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; -@@ -69,14 +64,12 @@ 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; - } - ---- a/include/linux/fsl/enetc_mdio.h -+++ /dev/null -@@ -1,21 +0,0 @@ --/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ --/* Copyright 2019 NXP */ -- --#include -- --/* 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); diff --git a/target/linux/layerscape/patches-5.4/701-net-0374-Revert-net-phylink-call-mac_an_restart-for-SGMII-QSG.patch b/target/linux/layerscape/patches-5.4/701-net-0374-Revert-net-phylink-call-mac_an_restart-for-SGMII-QSG.patch deleted file mode 100644 index 4b2cee677a..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0374-Revert-net-phylink-call-mac_an_restart-for-SGMII-QSG.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d3a532021976d98bfc9e3dac18a17abccf6eb567 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:31:42 +0200 -Subject: [PATCH] Revert "net: phylink: call mac_an_restart for SGMII/QSGMII - inband interfaces too" - -This reverts commit 57fe15baac62dad00817e3359cefc123e24f10a2. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/phy/phylink.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - ---- a/drivers/net/phy/phylink.c -+++ b/drivers/net/phy/phylink.c -@@ -360,9 +360,7 @@ static void phylink_mac_config_up(struct - static void phylink_mac_an_restart(struct phylink *pl) - { - if (pl->link_config.an_enabled && -- (phy_interface_mode_is_8023z(pl->link_config.interface) || -- pl->link_config.interface == PHY_INTERFACE_MODE_SGMII || -- pl->link_config.interface == PHY_INTERFACE_MODE_QSGMII)) -+ phy_interface_mode_is_8023z(pl->link_config.interface)) - pl->ops->mac_an_restart(pl->config); - } - diff --git a/target/linux/layerscape/patches-5.4/701-net-0375-Revert-net-phylink-make-QSGMII-a-valid-PHY-mode-for-.patch b/target/linux/layerscape/patches-5.4/701-net-0375-Revert-net-phylink-make-QSGMII-a-valid-PHY-mode-for-.patch deleted file mode 100644 index e2bce2f6a1..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0375-Revert-net-phylink-make-QSGMII-a-valid-PHY-mode-for-.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e53b64cab45ea4d01226840efd963a6bec8ad2f9 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:31:58 +0200 -Subject: [PATCH] Revert "net: phylink: make QSGMII a valid PHY mode for - in-band AN" - -This reverts commit fe7fd9f6afce50c0fc09fd3d56cd59eda44d8dd0. - -Signed-off-by: Vladimir Oltean ---- - drivers/net/phy/phylink.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/phy/phylink.c -+++ b/drivers/net/phy/phylink.c -@@ -283,7 +283,6 @@ static int phylink_parse_mode(struct phy - - switch (pl->link_config.interface) { - case PHY_INTERFACE_MODE_SGMII: -- case PHY_INTERFACE_MODE_QSGMII: - phylink_set(pl->supported, 10baseT_Half); - phylink_set(pl->supported, 10baseT_Full); - phylink_set(pl->supported, 100baseT_Half); diff --git a/target/linux/layerscape/patches-5.4/701-net-0376-Revert-mii-Add-helpers-for-parsing-SGMII-auto-negoti.patch b/target/linux/layerscape/patches-5.4/701-net-0376-Revert-mii-Add-helpers-for-parsing-SGMII-auto-negoti.patch deleted file mode 100644 index 3831cac482..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0376-Revert-mii-Add-helpers-for-parsing-SGMII-auto-negoti.patch +++ /dev/null @@ -1,110 +0,0 @@ -From c6f9fb78b7534392d3be307e566d10c8525c7c9a Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Mon, 6 Jan 2020 14:32:06 +0200 -Subject: [PATCH] Revert "mii: Add helpers for parsing SGMII auto-negotiation" - -This reverts commit de81e3c1ccbf27eda7584e23c713705a221a57da. - -Signed-off-by: Vladimir Oltean ---- - include/linux/mii.h | 50 ------------------------------------------------ - include/uapi/linux/mii.h | 10 ---------- - 2 files changed, 60 deletions(-) - ---- a/include/linux/mii.h -+++ b/include/linux/mii.h -@@ -373,56 +373,6 @@ static inline u32 mii_lpa_to_ethtool_lpa - } - - /** -- * mii_lpa_mod_linkmode_adv_sgmii -- * @lp_advertising: pointer to destination link mode. -- * @lpa: value of the MII_LPA register -- * -- * A small helper function that translates MII_LPA bits to -- * linkmode advertisement settings for SGMII. -- * Leaves other bits unchanged. -- */ --static inline void --mii_lpa_mod_linkmode_lpa_sgmii(unsigned long *lp_advertising, u32 lpa) --{ -- u32 speed_duplex = lpa & LPA_SGMII_DPX_SPD_MASK; -- -- linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, lp_advertising, -- speed_duplex == LPA_SGMII_1000HALF); -- -- linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, lp_advertising, -- speed_duplex == LPA_SGMII_1000FULL); -- -- linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, lp_advertising, -- speed_duplex == LPA_SGMII_100HALF); -- -- linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, lp_advertising, -- speed_duplex == LPA_SGMII_100FULL); -- -- linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, lp_advertising, -- speed_duplex == LPA_SGMII_10HALF); -- -- linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, lp_advertising, -- speed_duplex == LPA_SGMII_10FULL); --} -- --/** -- * mii_lpa_to_linkmode_adv_sgmii -- * @advertising: pointer to destination link mode. -- * @lpa: value of the MII_LPA register -- * -- * A small helper function that translates MII_ADVERTISE bits -- * to linkmode advertisement settings when in SGMII mode. -- * Clears the old value of advertising. -- */ --static inline void mii_lpa_to_linkmode_lpa_sgmii(unsigned long *lp_advertising, -- u32 lpa) --{ -- linkmode_zero(lp_advertising); -- -- mii_lpa_mod_linkmode_lpa_sgmii(lp_advertising, lpa); --} -- --/** - * mii_adv_mod_linkmode_adv_t - * @advertising:pointer to destination link mode. - * @adv: value of the MII_ADVERTISE register ---- a/include/uapi/linux/mii.h -+++ b/include/uapi/linux/mii.h -@@ -71,7 +71,6 @@ - /* Advertisement control register. */ - #define ADVERTISE_SLCT 0x001f /* Selector bits */ - #define ADVERTISE_CSMA 0x0001 /* Only selector supported */ --#define ADVERTISE_SGMII 0x0001 /* Can do SGMII */ - #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ - #define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ - #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ -@@ -95,7 +94,6 @@ - - /* Link partner ability register. */ - #define LPA_SLCT 0x001f /* Same as advertise selector */ --#define LPA_SGMII 0x0001 /* Can do SGMII */ - #define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ - #define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */ - #define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ -@@ -106,19 +104,11 @@ - #define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/ - #define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ - #define LPA_PAUSE_CAP 0x0400 /* Can pause */ --#define LPA_SGMII_DPX_SPD_MASK 0x1C00 /* SGMII duplex and speed bits */ --#define LPA_SGMII_10HALF 0x0000 /* Can do SGMII 10mbps half-duplex */ --#define LPA_SGMII_10FULL 0x1000 /* Can do SGMII 10mbps full-duplex */ --#define LPA_SGMII_100HALF 0x0400 /* Can do SGMII 100mbps half-duplex */ --#define LPA_SGMII_100FULL 0x1400 /* Can do SGMII 100mbps full-duplex */ - #define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ --#define LPA_SGMII_1000HALF 0x0800 /* Can do SGMII 1000mbps half-duplex */ --#define LPA_SGMII_1000FULL 0x1800 /* Can do SGMII 1000mbps full-duplex */ - #define LPA_RESV 0x1000 /* Unused... */ - #define LPA_RFAULT 0x2000 /* Link partner faulted */ - #define LPA_LPACK 0x4000 /* Link partner acked us */ - #define LPA_NPAGE 0x8000 /* Next page bit */ --#define LPA_SGMII_LINK 0x8000 /* Link partner has link */ - - #define LPA_DUPLEX (LPA_10FULL | LPA_100FULL) - #define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4) diff --git a/target/linux/layerscape/patches-5.4/801-audio-0023-ASoC-fsl-add-imx-pcm-dma-v2-platform-driver-part-2.patch b/target/linux/layerscape/patches-5.4/801-audio-0023-ASoC-fsl-add-imx-pcm-dma-v2-platform-driver-part-2.patch deleted file mode 100644 index d09dd9b415..0000000000 --- a/target/linux/layerscape/patches-5.4/801-audio-0023-ASoC-fsl-add-imx-pcm-dma-v2-platform-driver-part-2.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 5d816f1a5cac458a7fff9ecf896c85eb351a7352 Mon Sep 17 00:00:00 2001 -From: Viorel Suman -Date: Mon, 30 Mar 2020 16:24:59 +0800 -Subject: [PATCH] ASoC: fsl: add imx-pcm-dma v2 platform driver (part 2) - -which don't request the dma channel in the probe, but request -dma channel when needed. for the dma channel of cpu dai in BE -can be reused by the FE. - -Signed-off-by: Shengjiu Wang -[ Aisheng: split PCM changes ] -Signed-off-by: Dong Aisheng -[rebase] -Signed-off-by: Yangbo Lu ---- - sound/soc/fsl/fsl_sai.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/sound/soc/fsl/fsl_sai.c -+++ b/sound/soc/fsl/fsl_sai.c -@@ -1046,6 +1046,8 @@ static int fsl_sai_probe(struct platform - MCLK_DIR(index)); - } - -+ sai->dma_params_rx.filter_data = "rx"; -+ sai->dma_params_tx.filter_data = "tx"; - sai->dma_params_rx.addr = res->start + FSL_SAI_RDR0; - sai->dma_params_tx.addr = res->start + FSL_SAI_TDR0; - sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; -@@ -1061,7 +1063,7 @@ static int fsl_sai_probe(struct platform - goto err_pm_disable; - - if (sai->soc->imx) -- ret = imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE); -+ ret = imx_pcm_platform_register(&pdev->dev); - if (ret) - goto err_pm_disable; - } else { diff --git a/target/linux/layerscape/patches-5.4/801-audio-0027-MLK-15140-1-ASoC-fsl_sai-support-latest-sai-module.patch b/target/linux/layerscape/patches-5.4/801-audio-0027-MLK-15140-1-ASoC-fsl_sai-support-latest-sai-module.patch index 38d3041bae..7f234a27cc 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0027-MLK-15140-1-ASoC-fsl_sai-support-latest-sai-module.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0027-MLK-15140-1-ASoC-fsl_sai-support-latest-sai-module.patch @@ -590,7 +590,7 @@ Signed-off-by: Shengjiu Wang if (ret) { dev_err(&pdev->dev, "failed to claim irq %u\n", irq); return ret; -@@ -1090,6 +1134,7 @@ static int fsl_sai_runtime_suspend(struc +@@ -1088,6 +1132,7 @@ static int fsl_sai_runtime_suspend(struc static int fsl_sai_runtime_resume(struct device *dev) { struct fsl_sai *sai = dev_get_drvdata(dev); @@ -598,7 +598,7 @@ Signed-off-by: Shengjiu Wang int ret; ret = clk_prepare_enable(sai->bus_clk); -@@ -1115,11 +1160,11 @@ static int fsl_sai_runtime_resume(struct +@@ -1113,11 +1158,11 @@ static int fsl_sai_runtime_resume(struct PM_QOS_CPU_DMA_LATENCY, 0); regcache_cache_only(sai->regmap, false); diff --git a/target/linux/layerscape/patches-5.4/801-audio-0030-MLK-15960-2-ASoC-fsl_sai-refine-the-pm-runtime-funct.patch b/target/linux/layerscape/patches-5.4/801-audio-0030-MLK-15960-2-ASoC-fsl_sai-refine-the-pm-runtime-funct.patch index 5232a69894..9f9db86f64 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0030-MLK-15960-2-ASoC-fsl_sai-refine-the-pm-runtime-funct.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0030-MLK-15960-2-ASoC-fsl_sai-refine-the-pm-runtime-funct.patch @@ -16,7 +16,7 @@ Signed-off-by: Shengjiu Wang --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c -@@ -1096,6 +1096,8 @@ static int fsl_sai_probe(struct platform +@@ -1094,6 +1094,8 @@ static int fsl_sai_probe(struct platform pm_runtime_enable(&pdev->dev); @@ -25,7 +25,7 @@ Signed-off-by: Shengjiu Wang ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component, &fsl_sai_dai, 1); if (ret) -@@ -1139,6 +1141,8 @@ static int fsl_sai_runtime_suspend(struc +@@ -1137,6 +1139,8 @@ static int fsl_sai_runtime_suspend(struc { struct fsl_sai *sai = dev_get_drvdata(dev); diff --git a/target/linux/layerscape/patches-5.4/801-audio-0036-MLK-17442-ASoC-fsl-fix-wrong-usage-of-filter_data-pa.patch b/target/linux/layerscape/patches-5.4/801-audio-0036-MLK-17442-ASoC-fsl-fix-wrong-usage-of-filter_data-pa.patch deleted file mode 100644 index 5cc427496a..0000000000 --- a/target/linux/layerscape/patches-5.4/801-audio-0036-MLK-17442-ASoC-fsl-fix-wrong-usage-of-filter_data-pa.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8d4837f146cd14cf7041050ddec77b2a5c3f2f27 Mon Sep 17 00:00:00 2001 -From: Shengjiu Wang -Date: Tue, 23 Jan 2018 13:25:40 +0800 -Subject: [PATCH] MLK-17442: ASoC: fsl: fix wrong usage of filter_data (part 1) - -The filter_data should be used for dma_filter_fn function, -but we used the filter_data wrongly for dma channel name. -This patch is to fix the issue. - -Signed-off-by: Shengjiu Wang -Reviwed-by: Daniel Baluta -[ Aisheng: split out esai and pcm changes ] -Signed-off-by: Dong Aisheng ---- - sound/soc/fsl/fsl_sai.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/sound/soc/fsl/fsl_sai.c -+++ b/sound/soc/fsl/fsl_sai.c -@@ -1136,8 +1136,8 @@ static int fsl_sai_probe(struct platform - MCLK_DIR(index)); - } - -- sai->dma_params_rx.filter_data = "rx"; -- sai->dma_params_tx.filter_data = "tx"; -+ sai->dma_params_rx.chan_name = "rx"; -+ sai->dma_params_tx.chan_name = "tx"; - sai->dma_params_rx.addr = res->start + FSL_SAI_RDR0; - sai->dma_params_tx.addr = res->start + FSL_SAI_TDR0; - sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; diff --git a/target/linux/layerscape/patches-5.4/801-audio-0037-MLK-16224-4-ASoC-fsl_sai-support-multi-fifo-and-DSD.patch b/target/linux/layerscape/patches-5.4/801-audio-0037-MLK-16224-4-ASoC-fsl_sai-support-multi-fifo-and-DSD.patch index 033ab0d06b..b5802d3250 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0037-MLK-16224-4-ASoC-fsl_sai-support-multi-fifo-and-DSD.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0037-MLK-16224-4-ASoC-fsl_sai-support-multi-fifo-and-DSD.patch @@ -274,7 +274,7 @@ Reviewed-by: Viorel Suman if ((of_find_property(np, "fsl,i2s-xtor", NULL) != NULL) || (of_find_property(np, "fsl,txm-rxs", NULL) != NULL)) { -@@ -1143,6 +1282,11 @@ static int fsl_sai_probe(struct platform +@@ -1141,6 +1280,11 @@ static int fsl_sai_probe(struct platform sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; sai->dma_params_tx.maxburst = FSL_SAI_MAXBURST_TX; diff --git a/target/linux/layerscape/patches-5.4/801-audio-0048-MLK-17580-ASoC-fsl-sai-Use-DSD-helper.patch b/target/linux/layerscape/patches-5.4/801-audio-0048-MLK-17580-ASoC-fsl-sai-Use-DSD-helper.patch index ffd74f81d1..856f2bb6d7 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0048-MLK-17580-ASoC-fsl-sai-Use-DSD-helper.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0048-MLK-17580-ASoC-fsl-sai-Use-DSD-helper.patch @@ -73,7 +73,7 @@ Reviewed-by: Shengjiu Wang dev, "failed to set proper pins state: %d\n", ret); -@@ -1356,9 +1347,6 @@ static int fsl_sai_probe(struct platform +@@ -1354,9 +1345,6 @@ static int fsl_sai_probe(struct platform sai->pinctrl = devm_pinctrl_get(&pdev->dev); diff --git a/target/linux/layerscape/patches-5.4/801-audio-0049-MLK-17580-ASoC-fsl-sai-check-for-pinctrl-status.patch b/target/linux/layerscape/patches-5.4/801-audio-0049-MLK-17580-ASoC-fsl-sai-check-for-pinctrl-status.patch index 5f69c1daae..ebd71672b2 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0049-MLK-17580-ASoC-fsl-sai-check-for-pinctrl-status.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0049-MLK-17580-ASoC-fsl-sai-check-for-pinctrl-status.patch @@ -49,7 +49,7 @@ Signed-off-by: Viorel Suman ret = pinctrl_select_state(sai->pinctrl, sai->pins_state); if (ret) { dev_err(cpu_dai->dev, -@@ -1345,7 +1348,7 @@ static int fsl_sai_probe(struct platform +@@ -1343,7 +1346,7 @@ static int fsl_sai_probe(struct platform sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; sai->dma_params_tx.maxburst = FSL_SAI_MAXBURST_TX; diff --git a/target/linux/layerscape/patches-5.4/801-audio-0062-ASoC-fsl-sai-fix-build-failture-due-to-5.1-RC7-upgra.patch b/target/linux/layerscape/patches-5.4/801-audio-0062-ASoC-fsl-sai-fix-build-failture-due-to-5.1-RC7-upgra.patch index 7cce9d45a0..3f92c2185c 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0062-ASoC-fsl-sai-fix-build-failture-due-to-5.1-RC7-upgra.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0062-ASoC-fsl-sai-fix-build-failture-due-to-5.1-RC7-upgra.patch @@ -25,7 +25,7 @@ Signed-off-by: Dong Aisheng break; case SND_SOC_DAIFMT_CBM_CFS: val_cr4 |= FSL_SAI_CR4_FSD_MSTR; -@@ -1574,14 +1572,6 @@ static int fsl_sai_remove(struct platfor +@@ -1572,14 +1570,6 @@ static int fsl_sai_remove(struct platfor return 0; } diff --git a/target/linux/layerscape/patches-5.4/801-audio-0064-ASoC-fsl_sai-Mark-cache-dirty-at-resume.patch b/target/linux/layerscape/patches-5.4/801-audio-0064-ASoC-fsl_sai-Mark-cache-dirty-at-resume.patch index 1f74ff235a..3fd3554985 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0064-ASoC-fsl_sai-Mark-cache-dirty-at-resume.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0064-ASoC-fsl_sai-Mark-cache-dirty-at-resume.patch @@ -17,7 +17,7 @@ Signed-off-by: Daniel Baluta --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c -@@ -1616,6 +1616,8 @@ static int fsl_sai_runtime_resume(struct +@@ -1614,6 +1614,8 @@ static int fsl_sai_runtime_resume(struct PM_QOS_CPU_DMA_LATENCY, 0); regcache_cache_only(sai->regmap, false); diff --git a/target/linux/layerscape/patches-5.4/801-audio-0065-LF-106-ASoC-fsl_sai-request-BUS_FREQ_AUDIO.patch b/target/linux/layerscape/patches-5.4/801-audio-0065-LF-106-ASoC-fsl_sai-request-BUS_FREQ_AUDIO.patch index 25c65f17dd..ed0afdbac8 100644 --- a/target/linux/layerscape/patches-5.4/801-audio-0065-LF-106-ASoC-fsl_sai-request-BUS_FREQ_AUDIO.patch +++ b/target/linux/layerscape/patches-5.4/801-audio-0065-LF-106-ASoC-fsl_sai-request-BUS_FREQ_AUDIO.patch @@ -20,7 +20,7 @@ Signed-off-by: Shengjiu Wang #include "fsl_dsd.h" #include "fsl_sai.h" -@@ -1570,6 +1571,8 @@ static int fsl_sai_runtime_suspend(struc +@@ -1568,6 +1569,8 @@ static int fsl_sai_runtime_suspend(struc regcache_cache_only(sai->regmap, true); @@ -29,7 +29,7 @@ Signed-off-by: Shengjiu Wang if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_CAPTURE)) clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[0]]); -@@ -1611,6 +1614,8 @@ static int fsl_sai_runtime_resume(struct +@@ -1609,6 +1612,8 @@ static int fsl_sai_runtime_resume(struct goto disable_tx_clk; } diff --git a/target/linux/layerscape/patches-5.4/801-audio-0067-Revert-MLK-17442-ASoC-fsl-fix-wrong-usage-of-filter_.patch b/target/linux/layerscape/patches-5.4/801-audio-0067-Revert-MLK-17442-ASoC-fsl-fix-wrong-usage-of-filter_.patch deleted file mode 100644 index d36101e09a..0000000000 --- a/target/linux/layerscape/patches-5.4/801-audio-0067-Revert-MLK-17442-ASoC-fsl-fix-wrong-usage-of-filter_.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 912323e5d1290cbee651270f65de338663012c9b Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Mon, 30 Mar 2020 16:30:03 +0800 -Subject: [PATCH] Revert "MLK-17442: ASoC: fsl: fix wrong usage of filter_data - (part 1)" - -This reverts commit 8d4837f146cd14cf7041050ddec77b2a5c3f2f27. ---- - sound/soc/fsl/fsl_sai.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/sound/soc/fsl/fsl_sai.c -+++ b/sound/soc/fsl/fsl_sai.c -@@ -1519,8 +1519,8 @@ static int fsl_sai_probe(struct platform - MCLK_DIR(index)); - } - -- sai->dma_params_rx.chan_name = "rx"; -- sai->dma_params_tx.chan_name = "tx"; -+ sai->dma_params_rx.filter_data = "rx"; -+ sai->dma_params_tx.filter_data = "tx"; - sai->dma_params_rx.addr = res->start + FSL_SAI_RDR0; - sai->dma_params_tx.addr = res->start + FSL_SAI_TDR0; - sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; diff --git a/target/linux/layerscape/patches-5.4/801-audio-0068-Revert-ASoC-fsl-add-imx-pcm-dma-v2-platform-driver-p.patch b/target/linux/layerscape/patches-5.4/801-audio-0068-Revert-ASoC-fsl-add-imx-pcm-dma-v2-platform-driver-p.patch deleted file mode 100644 index 1045b90494..0000000000 --- a/target/linux/layerscape/patches-5.4/801-audio-0068-Revert-ASoC-fsl-add-imx-pcm-dma-v2-platform-driver-p.patch +++ /dev/null @@ -1,31 +0,0 @@ -From d8715f02b84c1a210b6fd84badc41eced6272424 Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Mon, 30 Mar 2020 16:30:26 +0800 -Subject: [PATCH] Revert "ASoC: fsl: add imx-pcm-dma v2 platform driver (part - 2)" - -This reverts commit 5d816f1a5cac458a7fff9ecf896c85eb351a7352. ---- - sound/soc/fsl/fsl_sai.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - ---- a/sound/soc/fsl/fsl_sai.c -+++ b/sound/soc/fsl/fsl_sai.c -@@ -1519,8 +1519,6 @@ static int fsl_sai_probe(struct platform - MCLK_DIR(index)); - } - -- sai->dma_params_rx.filter_data = "rx"; -- sai->dma_params_tx.filter_data = "tx"; - sai->dma_params_rx.addr = res->start + FSL_SAI_RDR0; - sai->dma_params_tx.addr = res->start + FSL_SAI_TDR0; - sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; -@@ -1540,7 +1538,7 @@ static int fsl_sai_probe(struct platform - goto err_pm_disable; - - if (sai->soc->imx) -- ret = imx_pcm_platform_register(&pdev->dev); -+ ret = imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE); - if (ret) - goto err_pm_disable; - } else { diff --git a/target/linux/layerscape/patches-5.4/805-display-0030-drm-imx-hdp-fix-issue-with-non-SCDC-HDMI-sinks.patch b/target/linux/layerscape/patches-5.4/805-display-0030-drm-imx-hdp-fix-issue-with-non-SCDC-HDMI-sinks.patch deleted file mode 100644 index be72d1fd38..0000000000 --- a/target/linux/layerscape/patches-5.4/805-display-0030-drm-imx-hdp-fix-issue-with-non-SCDC-HDMI-sinks.patch +++ /dev/null @@ -1,60 +0,0 @@ -From d9440f7cb8fa5853b9dcc6e2b165725ac3e8b70c Mon Sep 17 00:00:00 2001 -From: Laurentiu Palcu -Date: Wed, 27 Nov 2019 13:34:51 +0200 -Subject: [PATCH] drm/imx/hdp: fix issue with non-SCDC HDMI sinks - -Currently, if sink does not support SCDC, even if the sink is HDMI 1.4 or 2.0, -the hdmi_type is left to default value (MODE_DVI). Hence the HDMI controler is -not properly initialized when cdns_hdmi_ctrl_init() is called. - -Signed-off-by: Laurentiu Palcu -Reported-by: Jared Hu -Reviewed-by: Sandor Yu ---- - drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - ---- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c -+++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c -@@ -29,11 +29,17 @@ - static void hdmi_sink_config(struct cdns_mhdp_device *mhdp) - { - struct drm_scdc *scdc = &mhdp->connector.base.display_info.hdmi.scdc; -- u8 buff; -+ struct drm_display_info *di = &mhdp->connector.base.display_info; -+ u8 buff = 0; -+ -+ if (scdc->supported || di->color_formats & DRM_COLOR_FORMAT_YCRCB420) -+ mhdp->hdmi.hdmi_type = MODE_HDMI_2_0; -+ else -+ mhdp->hdmi.hdmi_type = MODE_HDMI_1_4; - - /* check sink support SCDC or not */ -- if (scdc->supported != true) { -- DRM_INFO("Sink Not Support SCDC\n"); -+ if (!scdc->supported) { -+ DRM_INFO("Sink does not support SCDC\n"); - return; - } - -@@ -43,19 +49,13 @@ static void hdmi_sink_config(struct cdns - * Enable scrambling and TMDS_Bit_Clock_Ratio - */ - buff = SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 | SCDC_SCRAMBLING_ENABLE; -- mhdp->hdmi.hdmi_type = MODE_HDMI_2_0; - } else if (scdc->scrambling.low_rates) { - /* - * Enable scrambling and HDMI2.0 when scrambling capability of sink - * be indicated in the HF-VSDB LTE_340Mcsc_scramble bit - */ - buff = SCDC_SCRAMBLING_ENABLE; -- mhdp->hdmi.hdmi_type = MODE_HDMI_2_0; -- } else { -- /* Default work in HDMI1.4 */ -- buff = 0; -- mhdp->hdmi.hdmi_type = MODE_HDMI_1_4; -- } -+ } - - /* TMDS config */ - cdns_hdmi_scdc_write(mhdp, 0x20, buff); diff --git a/target/linux/layerscape/patches-5.4/805-display-0031-Revert-drm-imx-hdp-fix-issue-with-non-SCDC-HDMI-sink.patch b/target/linux/layerscape/patches-5.4/805-display-0031-Revert-drm-imx-hdp-fix-issue-with-non-SCDC-HDMI-sink.patch deleted file mode 100644 index e906be4604..0000000000 --- a/target/linux/layerscape/patches-5.4/805-display-0031-Revert-drm-imx-hdp-fix-issue-with-non-SCDC-HDMI-sink.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 575fc16e92287349f0ffd8399dd9d7e408954cd4 Mon Sep 17 00:00:00 2001 -From: Sandor Yu -Date: Fri, 29 Nov 2019 15:05:03 +0800 -Subject: [PATCH] Revert "drm/imx/hdp: fix issue with non-SCDC HDMI sinks" - -For HDMI sinks that support HDMI2.0, those video modes have -listed in hdmi1.4 specification should work in hdmi 1.4. -Remove the patch, make sure all video modes can work well -in HDMI2.0 sinks. -For non-SCDC HDMI sinks issue, -it will be fixed with another patch. - -This reverts commit 4b6617643f9e3a6f61d42eae39034ddc8d4825af. - -Signed-off-by: Sandor Yu ---- - drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - ---- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c -+++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c -@@ -29,17 +29,11 @@ - static void hdmi_sink_config(struct cdns_mhdp_device *mhdp) - { - struct drm_scdc *scdc = &mhdp->connector.base.display_info.hdmi.scdc; -- struct drm_display_info *di = &mhdp->connector.base.display_info; -- u8 buff = 0; -- -- if (scdc->supported || di->color_formats & DRM_COLOR_FORMAT_YCRCB420) -- mhdp->hdmi.hdmi_type = MODE_HDMI_2_0; -- else -- mhdp->hdmi.hdmi_type = MODE_HDMI_1_4; -+ u8 buff; - - /* check sink support SCDC or not */ -- if (!scdc->supported) { -- DRM_INFO("Sink does not support SCDC\n"); -+ if (scdc->supported != true) { -+ DRM_INFO("Sink Not Support SCDC\n"); - return; - } - -@@ -49,13 +43,19 @@ static void hdmi_sink_config(struct cdns - * Enable scrambling and TMDS_Bit_Clock_Ratio - */ - buff = SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 | SCDC_SCRAMBLING_ENABLE; -+ mhdp->hdmi.hdmi_type = MODE_HDMI_2_0; - } else if (scdc->scrambling.low_rates) { - /* - * Enable scrambling and HDMI2.0 when scrambling capability of sink - * be indicated in the HF-VSDB LTE_340Mcsc_scramble bit - */ - buff = SCDC_SCRAMBLING_ENABLE; -- } -+ mhdp->hdmi.hdmi_type = MODE_HDMI_2_0; -+ } else { -+ /* Default work in HDMI1.4 */ -+ buff = 0; -+ mhdp->hdmi.hdmi_type = MODE_HDMI_1_4; -+ } - - /* TMDS config */ - cdns_hdmi_scdc_write(mhdp, 0x20, buff); diff --git a/target/linux/layerscape/patches-5.4/805-display-0042-drm-imx-Revert-a-patch-which-merges-imx-drm-core-and.patch b/target/linux/layerscape/patches-5.4/805-display-0042-drm-imx-Revert-a-patch-which-merges-imx-drm-core-and.patch deleted file mode 100644 index 017f0e347c..0000000000 --- a/target/linux/layerscape/patches-5.4/805-display-0042-drm-imx-Revert-a-patch-which-merges-imx-drm-core-and.patch +++ /dev/null @@ -1,116 +0,0 @@ -From d27d7c25c946776c015a39f1a9eb0c6d4e724a70 Mon Sep 17 00:00:00 2001 -From: Liu Ying -Date: Fri, 25 Jan 2019 11:23:39 +0800 -Subject: [PATCH] drm/imx: Revert a patch which merges imx-drm-core and - ipuv3-crtc in one module - -DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm. -Thus, move ipuv3-crtc out of imx-drm-core. - -Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module" - -This reverts commit 3d1df96ad46856ce850be5ac112eab919cbe1cab. - -Signed-off-by: Liu Ying -[ Aisheng: fix conflicts ] -Signed-off-by: Dong Aisheng ---- - drivers/gpu/drm/imx/Kconfig | 7 +++++++ - drivers/gpu/drm/imx/Makefile | 4 +++- - drivers/gpu/drm/imx/imx-drm-core.c | 18 +----------------- - drivers/gpu/drm/imx/imx-drm.h | 2 -- - drivers/gpu/drm/imx/ipuv3-crtc.c | 8 +++++++- - 5 files changed, 18 insertions(+), 21 deletions(-) - ---- a/drivers/gpu/drm/imx/Kconfig -+++ b/drivers/gpu/drm/imx/Kconfig -@@ -33,6 +33,13 @@ config DRM_IMX_LDB - Choose this to enable the internal LVDS Display Bridge (LDB) - found on i.MX53 and i.MX6 processors. - -+config DRM_IMX_IPUV3 -+ tristate -+ depends on DRM_IMX -+ depends on IMX_IPUV3_CORE -+ default y if DRM_IMX=y -+ default m if DRM_IMX=m -+ - config DRM_IMX_HDMI - tristate "Freescale i.MX DRM HDMI" - select DRM_DW_HDMI ---- a/drivers/gpu/drm/imx/Makefile -+++ b/drivers/gpu/drm/imx/Makefile -@@ -1,6 +1,6 @@ - # SPDX-License-Identifier: GPL-2.0 - --imxdrm-objs := imx-drm-core.o ipuv3-crtc.o ipuv3-plane.o -+imxdrm-objs := imx-drm-core.o - - obj-$(CONFIG_DRM_IMX) += imxdrm.o - -@@ -8,5 +8,7 @@ obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) + - obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o - obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o - -+imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o -+obj-$(CONFIG_DRM_IMX_IPUV3) += imx-ipuv3-crtc.o - obj-$(CONFIG_DRM_IMX_HDMI) += dw_hdmi-imx.o - obj-$(CONFIG_DRM_IMX_CDNS_MHDP) += cdn-mhdp-imxdrv.o cdn-mhdp-dp-phy.o cdn-mhdp-hdmi-phy.o cdn-mhdp-imx8qm.o cdn-mhdp-ls1028a.o ---- a/drivers/gpu/drm/imx/imx-drm-core.c -+++ b/drivers/gpu/drm/imx/imx-drm-core.c -@@ -343,23 +343,7 @@ static struct platform_driver imx_drm_pd - .of_match_table = imx_drm_dt_ids, - }, - }; -- --static struct platform_driver * const drivers[] = { -- &imx_drm_pdrv, -- &ipu_drm_driver, --}; -- --static int __init imx_drm_init(void) --{ -- return platform_register_drivers(drivers, ARRAY_SIZE(drivers)); --} --module_init(imx_drm_init); -- --static void __exit imx_drm_exit(void) --{ -- platform_unregister_drivers(drivers, ARRAY_SIZE(drivers)); --} --module_exit(imx_drm_exit); -+module_platform_driver(imx_drm_pdrv); - - MODULE_AUTHOR("Sascha Hauer "); - MODULE_DESCRIPTION("i.MX drm driver core"); ---- a/drivers/gpu/drm/imx/imx-drm.h -+++ b/drivers/gpu/drm/imx/imx-drm.h -@@ -28,8 +28,6 @@ int imx_drm_init_drm(struct platform_dev - int preferred_bpp); - int imx_drm_exit_drm(void); - --extern struct platform_driver ipu_drm_driver; -- - void imx_drm_mode_config_init(struct drm_device *drm); - - struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb); ---- a/drivers/gpu/drm/imx/ipuv3-crtc.c -+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c -@@ -492,10 +492,16 @@ static int ipu_drm_remove(struct platfor - return 0; - } - --struct platform_driver ipu_drm_driver = { -+static struct platform_driver ipu_drm_driver = { - .driver = { - .name = "imx-ipuv3-crtc", - }, - .probe = ipu_drm_probe, - .remove = ipu_drm_remove, - }; -+module_platform_driver(ipu_drm_driver); -+ -+MODULE_AUTHOR("Sascha Hauer "); -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:imx-ipuv3-crtc"); diff --git a/target/linux/layerscape/patches-5.4/805-display-0043-gpu-Move-ipu-v3-to-imx-folder.patch b/target/linux/layerscape/patches-5.4/805-display-0043-gpu-Move-ipu-v3-to-imx-folder.patch deleted file mode 100644 index 6deb30f885..0000000000 --- a/target/linux/layerscape/patches-5.4/805-display-0043-gpu-Move-ipu-v3-to-imx-folder.patch +++ /dev/null @@ -1,19995 +0,0 @@ -From a7782c6e5e37b2b406221827b177c2bfcc8825cd Mon Sep 17 00:00:00 2001 -From: Liu Ying -Date: Tue, 22 Jan 2019 17:08:01 +0800 -Subject: [PATCH] gpu: Move ipu-v3 to imx folder - -The new imx folder may contain ipu-v3 and dpu common drivers. - -Signed-off-by: Liu Ying -[ Aisheng: fix source path ] -Signed-off-by: Dong Aisheng ---- - drivers/gpu/Makefile | 2 +- - drivers/gpu/imx/Kconfig | 1 + - drivers/gpu/imx/Makefile | 1 + - drivers/gpu/imx/ipu-v3/Kconfig | 11 + - drivers/gpu/imx/ipu-v3/Makefile | 10 + - drivers/gpu/imx/ipu-v3/ipu-common.c | 1565 ++++++++++++++++++ - drivers/gpu/imx/ipu-v3/ipu-cpmem.c | 976 +++++++++++ - drivers/gpu/imx/ipu-v3/ipu-csi.c | 821 +++++++++ - drivers/gpu/imx/ipu-v3/ipu-dc.c | 420 +++++ - drivers/gpu/imx/ipu-v3/ipu-di.c | 745 +++++++++ - drivers/gpu/imx/ipu-v3/ipu-dmfc.c | 214 +++ - drivers/gpu/imx/ipu-v3/ipu-dp.c | 357 ++++ - drivers/gpu/imx/ipu-v3/ipu-ic.c | 761 +++++++++ - drivers/gpu/imx/ipu-v3/ipu-image-convert.c | 2475 ++++++++++++++++++++++++++++ - drivers/gpu/imx/ipu-v3/ipu-pre.c | 346 ++++ - drivers/gpu/imx/ipu-v3/ipu-prg.c | 483 ++++++ - drivers/gpu/imx/ipu-v3/ipu-prv.h | 274 +++ - drivers/gpu/imx/ipu-v3/ipu-smfc.c | 202 +++ - drivers/gpu/imx/ipu-v3/ipu-vdi.c | 234 +++ - drivers/gpu/ipu-v3/Kconfig | 11 - - drivers/gpu/ipu-v3/Makefile | 10 - - drivers/gpu/ipu-v3/ipu-common.c | 1565 ------------------ - drivers/gpu/ipu-v3/ipu-cpmem.c | 976 ----------- - drivers/gpu/ipu-v3/ipu-csi.c | 821 --------- - drivers/gpu/ipu-v3/ipu-dc.c | 420 ----- - drivers/gpu/ipu-v3/ipu-di.c | 745 --------- - drivers/gpu/ipu-v3/ipu-dmfc.c | 214 --- - drivers/gpu/ipu-v3/ipu-dp.c | 357 ---- - drivers/gpu/ipu-v3/ipu-ic.c | 761 --------- - drivers/gpu/ipu-v3/ipu-image-convert.c | 2475 ---------------------------- - drivers/gpu/ipu-v3/ipu-pre.c | 346 ---- - drivers/gpu/ipu-v3/ipu-prg.c | 483 ------ - drivers/gpu/ipu-v3/ipu-prv.h | 274 --- - drivers/gpu/ipu-v3/ipu-smfc.c | 202 --- - drivers/gpu/ipu-v3/ipu-vdi.c | 234 --- - drivers/video/Kconfig | 2 +- - 36 files changed, 9898 insertions(+), 9896 deletions(-) - create mode 100644 drivers/gpu/imx/Kconfig - create mode 100644 drivers/gpu/imx/Makefile - create mode 100644 drivers/gpu/imx/ipu-v3/Kconfig - create mode 100644 drivers/gpu/imx/ipu-v3/Makefile - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-common.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-cpmem.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-csi.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-dc.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-di.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-dmfc.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-dp.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-ic.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-image-convert.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-pre.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-prg.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-prv.h - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-smfc.c - create mode 100644 drivers/gpu/imx/ipu-v3/ipu-vdi.c - delete mode 100644 drivers/gpu/ipu-v3/Kconfig - delete mode 100644 drivers/gpu/ipu-v3/Makefile - delete mode 100644 drivers/gpu/ipu-v3/ipu-common.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-cpmem.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-csi.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-dc.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-di.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-dmfc.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-dp.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-ic.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-pre.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-prg.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-prv.h - delete mode 100644 drivers/gpu/ipu-v3/ipu-smfc.c - delete mode 100644 drivers/gpu/ipu-v3/ipu-vdi.c - ---- a/drivers/gpu/Makefile -+++ b/drivers/gpu/Makefile -@@ -3,5 +3,5 @@ - # taken to initialize them in the correct order. Link order is the only way - # to ensure this currently. - obj-$(CONFIG_TEGRA_HOST1X) += host1x/ -+obj-y += imx/ - obj-y += drm/ vga/ --obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/ ---- /dev/null -+++ b/drivers/gpu/imx/Kconfig -@@ -0,0 +1 @@ -+source "drivers/gpu/imx/ipu-v3/Kconfig" ---- /dev/null -+++ b/drivers/gpu/imx/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/ ---- /dev/null -+++ b/drivers/gpu/imx/ipu-v3/Kconfig -@@ -0,0 +1,11 @@ -+# SPDX-License-Identifier: GPL-2.0-only -+config IMX_IPUV3_CORE -+ tristate "IPUv3 core support" -+ depends on SOC_IMX5 || SOC_IMX6Q || ARCH_MULTIPLATFORM || COMPILE_TEST -+ depends on DRM || !DRM # if DRM=m, this can't be 'y' -+ select BITREVERSE -+ select GENERIC_ALLOCATOR if DRM -+ select GENERIC_IRQ_CHIP -+ help -+ Choose this if you have a i.MX5/6 system and want to use the Image -+ Processing Unit. This option only enables IPU base support. ---- /dev/null -+++ b/drivers/gpu/imx/ipu-v3/Makefile -@@ -0,0 +1,10 @@ -+# SPDX-License-Identifier: GPL-2.0 -+obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o -+ -+imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \ -+ ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-ic-csc.o \ -+ ipu-image-convert.o ipu-smfc.o ipu-vdi.o -+ -+ifdef CONFIG_DRM -+ imx-ipu-v3-objs += ipu-pre.o ipu-prg.o -+endif ---- /dev/null -+++ b/drivers/gpu/imx/ipu-v3/ipu-common.c -@@ -0,0 +1,1565 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later -+/* -+ * Copyright (c) 2010 Sascha Hauer -+ * Copyright (C) 2005-2009 Freescale Semiconductor, Inc. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include