diff options
author | Daniel Golle <daniel@makrotopia.org> | 2023-03-27 16:02:44 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2023-03-27 19:07:54 +0100 |
commit | 2f663cab46dd20a3372d206d02876326012904bf (patch) | |
tree | 646a43b16446a67f227a1962229502d1fed72d83 /target/linux/generic/pending-5.15 | |
parent | 027586ae8ecacff49757ed854c020f35d24a599c (diff) | |
download | upstream-2f663cab46dd20a3372d206d02876326012904bf.tar.gz upstream-2f663cab46dd20a3372d206d02876326012904bf.tar.bz2 upstream-2f663cab46dd20a3372d206d02876326012904bf.zip |
generic: replace mtk_sgmii patches with versions accepted upstream
Replace patches for MediaTek Ethernet driver SGMII/SerDes unit with
their corresponding upstream patches. Not all of the patches in our
tree went upstream as-is, some are slightly different implementations,
and they require the phylink_pcs helpers now made available.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/generic/pending-5.15')
7 files changed, 3 insertions, 187 deletions
diff --git a/target/linux/generic/pending-5.15/724-net-mtk_sgmii-implement-mtk_pcs_ops.patch b/target/linux/generic/pending-5.15/724-net-mtk_sgmii-implement-mtk_pcs_ops.patch deleted file mode 100644 index 9a6b228a27..0000000000 --- a/target/linux/generic/pending-5.15/724-net-mtk_sgmii-implement-mtk_pcs_ops.patch +++ /dev/null @@ -1,46 +0,0 @@ -From cbfed00575d15eafd85efd9619b7ecc0836a4aa7 Mon Sep 17 00:00:00 2001 -From: Alexander Couzens <lynxis@fe80.eu> -Date: Sat, 13 Aug 2022 14:42:12 +0200 -Subject: [PATCH 04/10] net: mtk_sgmii: implement mtk_pcs_ops - -Implement mtk_pcs_ops for the SGMII pcs to read the current state -of the hardware. - -Signed-off-by: Alexander Couzens <lynxis@fe80.eu> -[added DUPLEX_FULL] -Signed-off-by: Daniel Golle <daniel@makrotopia.org> ---- - drivers/net/ethernet/mediatek/mtk_sgmii.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/drivers/net/ethernet/mediatek/mtk_sgmii.c -+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c -@@ -139,10 +139,28 @@ static void mtk_pcs_link_up(struct phyli - regmap_write(mpcs->regmap, SGMSYS_SGMII_MODE, val); - } - -+static void mtk_pcs_get_state(struct phylink_pcs *pcs, struct phylink_link_state *state) -+{ -+ struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs); -+ unsigned int val; -+ -+ regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &val); -+ state->an_complete = !!(val & SGMII_AN_COMPLETE); -+ state->link = !!(val & SGMII_LINK_STATYS); -+ if (!state->link) -+ return; -+ -+ regmap_read(mpcs->regmap, mpcs->ana_rgc3, &val); -+ state->speed = val & RG_PHY_SPEED_3_125G ? SPEED_2500 : SPEED_1000; -+ state->duplex = DUPLEX_FULL; -+ state->pause = 0; -+} -+ - static const struct phylink_pcs_ops mtk_pcs_ops = { - .pcs_config = mtk_pcs_config, - .pcs_an_restart = mtk_pcs_restart_an, - .pcs_link_up = mtk_pcs_link_up, -+ .pcs_get_state = mtk_pcs_get_state, - }; - - int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *r, u32 ana_rgc3) diff --git a/target/linux/generic/pending-5.15/727-net-mtk_sgmii-mtk_pcs_setup_mode_an-don-t-rely-on-re.patch b/target/linux/generic/pending-5.15/727-net-mtk_sgmii-mtk_pcs_setup_mode_an-don-t-rely-on-re.patch deleted file mode 100644 index fd68ce22f6..0000000000 --- a/target/linux/generic/pending-5.15/727-net-mtk_sgmii-mtk_pcs_setup_mode_an-don-t-rely-on-re.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e4dca7affb8c03438b63bdb5fddefd6ad2431cfd Mon Sep 17 00:00:00 2001 -From: Alexander Couzens <lynxis@fe80.eu> -Date: Mon, 15 Aug 2022 14:59:29 +0200 -Subject: [PATCH 07/10] net: mtk_sgmii: mtk_pcs_setup_mode_an: don't rely on - register defaults - -Ensure autonegotiation is enabled. - -Signed-off-by: Alexander Couzens <lynxis@fe80.eu> ---- - drivers/net/ethernet/mediatek/mtk_sgmii.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_sgmii.c -+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c -@@ -32,12 +32,13 @@ static int mtk_pcs_setup_mode_an(struct - regmap_write(mpcs->regmap, SGMSYS_PCS_LINK_TIMER, - SGMII_LINK_TIMER_DEFAULT); - -+ /* disable remote fault & enable auto neg */ - regmap_read(mpcs->regmap, SGMSYS_SGMII_MODE, &val); -- val |= SGMII_REMOTE_FAULT_DIS; -+ val |= SGMII_REMOTE_FAULT_DIS | SGMII_SPEED_DUPLEX_AN; - regmap_write(mpcs->regmap, SGMSYS_SGMII_MODE, val); - - regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &val); -- val |= SGMII_AN_RESTART; -+ val |= SGMII_AN_RESTART | SGMII_AN_ENABLE; - regmap_write(mpcs->regmap, SGMSYS_PCS_CONTROL_1, val); - - diff --git a/target/linux/generic/pending-5.15/728-net-mtk_sgmii-set-the-speed-according-to-the-phy-int.patch b/target/linux/generic/pending-5.15/728-net-mtk_sgmii-set-the-speed-according-to-the-phy-int.patch deleted file mode 100644 index 1649a64551..0000000000 --- a/target/linux/generic/pending-5.15/728-net-mtk_sgmii-set-the-speed-according-to-the-phy-int.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 952b64575613d26163a5afa5ff8bfdb57840091b Mon Sep 17 00:00:00 2001 -From: Alexander Couzens <lynxis@fe80.eu> -Date: Mon, 15 Aug 2022 15:00:14 +0200 -Subject: [PATCH 08/10] net: mtk_sgmii: set the speed according to the phy - interface in AN - -The non auto-negotioting code path is setting the correct speed for the -interface. Ensure auto-negotiation code path is doing it as well. - -Signed-off-by: Alexander Couzens <lynxis@fe80.eu> ---- - drivers/net/ethernet/mediatek/mtk_sgmii.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_sgmii.c -+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c -@@ -20,12 +20,14 @@ static struct mtk_pcs *pcs_to_mtk_pcs(st - } - - /* For SGMII interface mode */ --static int mtk_pcs_setup_mode_an(struct mtk_pcs *mpcs) -+static int mtk_pcs_setup_mode_an(struct mtk_pcs *mpcs, phy_interface_t interface) - { - unsigned int val; - - regmap_read(mpcs->regmap, mpcs->ana_rgc3, &val); - val &= ~RG_PHY_SPEED_MASK; -+ if (interface == PHY_INTERFACE_MODE_2500BASEX) -+ val |= RG_PHY_SPEED_3_125G; - regmap_write(mpcs->regmap, mpcs->ana_rgc3, val); - - /* Setup the link timer and QPHY power up inside SGMIISYS */ -@@ -94,7 +96,7 @@ static int mtk_pcs_config(struct phylink - if (interface != PHY_INTERFACE_MODE_SGMII) - err = mtk_pcs_setup_mode_force(mpcs, interface); - else if (phylink_autoneg_inband(mode)) -- err = mtk_pcs_setup_mode_an(mpcs); -+ err = mtk_pcs_setup_mode_an(mpcs, interface); - - /* Release PHYA power down state - * Only removing bit SGMII_PHYA_PWD isn't enough. diff --git a/target/linux/generic/pending-5.15/729-net-mtk_eth_soc-improve-comment.patch b/target/linux/generic/pending-5.15/729-net-mtk_eth_soc-improve-comment.patch deleted file mode 100644 index cd64c6147a..0000000000 --- a/target/linux/generic/pending-5.15/729-net-mtk_eth_soc-improve-comment.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 06773f19cffd6c9d34dcbc8320169afef5ab60ba Mon Sep 17 00:00:00 2001 -From: Alexander Couzens <lynxis@fe80.eu> -Date: Mon, 15 Aug 2022 13:58:07 +0200 -Subject: [PATCH 09/10] net: mtk_eth_soc: improve comment - -Signed-off-by: Alexander Couzens <lynxis@fe80.eu> ---- - drivers/net/ethernet/mediatek/mtk_sgmii.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/mediatek/mtk_sgmii.c -+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c -@@ -67,7 +67,8 @@ static int mtk_pcs_setup_mode_force(stru - val &= ~SGMII_AN_ENABLE; - regmap_write(mpcs->regmap, SGMSYS_PCS_CONTROL_1, val); - -- /* Set the speed etc but leave the duplex unchanged */ -+ /* Set the speed etc but leave the duplex unchanged. -+ * The SGMII mode for 2.5gbit is the same as for 1gbit, expect the speed in ANA_RGC3 */ - regmap_read(mpcs->regmap, SGMSYS_SGMII_MODE, &val); - val &= SGMII_DUPLEX_HALF | ~SGMII_IF_MODE_MASK; - val |= SGMII_SPEED_1000; diff --git a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch index 9268d3e428..67bd504da1 100644 --- a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch +++ b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch @@ -90,7 +90,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .rxd_size = sizeof(struct mtk_rx_dma_v2), --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1026,6 +1026,8 @@ struct mtk_reg_map { +@@ -1037,6 +1037,8 @@ struct mtk_reg_map { * the extra setup for those pins used by GMAC. * @hash_offset Flow table hash offset. * @foe_entry_size Foe table entry size. @@ -99,7 +99,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov * @txd_size Tx DMA descriptor size. * @rxd_size Rx DMA descriptor size. * @rx_irq_done_mask Rx irq done register mask. -@@ -1043,6 +1045,7 @@ struct mtk_soc_data { +@@ -1054,6 +1056,7 @@ struct mtk_soc_data { u8 hash_offset; u16 foe_entry_size; netdev_features_t hw_features; diff --git a/target/linux/generic/pending-5.15/733-01-net-ethernet-mtk_eth_soc-reset-PCS-state.patch b/target/linux/generic/pending-5.15/733-01-net-ethernet-mtk_eth_soc-reset-PCS-state.patch deleted file mode 100644 index 4d52d7be39..0000000000 --- a/target/linux/generic/pending-5.15/733-01-net-ethernet-mtk_eth_soc-reset-PCS-state.patch +++ /dev/null @@ -1,44 +0,0 @@ -From b66105968b8c37c26a75b9da9281cbc1c8f73594 Mon Sep 17 00:00:00 2001 -From: Daniel Golle <daniel@makrotopia.org> -Date: Sun, 22 Jan 2023 23:58:36 +0000 -Subject: [PATCH] net: ethernet: mtk_eth_soc: reset PCS state -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Reset PCS state when changing interface mode. - -Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> -Tested-by: Bjørn Mork <bjorn@mork.no> -Signed-off-by: Daniel Golle <daniel@makrotopia.org> ---- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++++ - drivers/net/ethernet/mediatek/mtk_sgmii.c | 4 ++++ - 2 files changed, 8 insertions(+) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -530,6 +530,10 @@ - #define SGMII_SEND_AN_ERROR_EN BIT(11) - #define SGMII_IF_MODE_MASK GENMASK(5, 1) - -+/* Register to reset SGMII design */ -+#define SGMII_RESERVED_0 0x34 -+#define SGMII_SW_RESET BIT(0) -+ - /* Register to set SGMII speed, ANA RG_ Control Signals III*/ - #define SGMSYS_ANA_RG_CS3 0x2028 - #define RG_PHY_SPEED_MASK (BIT(2) | BIT(3)) ---- a/drivers/net/ethernet/mediatek/mtk_sgmii.c -+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c -@@ -90,6 +90,10 @@ static int mtk_pcs_config(struct phylink - regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, - SGMII_PHYA_PWD, SGMII_PHYA_PWD); - -+ /* Reset SGMII PCS state */ -+ regmap_update_bits(mpcs->regmap, SGMII_RESERVED_0, -+ SGMII_SW_RESET, SGMII_SW_RESET); -+ - mpcs->interface = interface; - } - diff --git a/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch b/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch index 0496752f78..4017e2beac 100644 --- a/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch +++ b/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1319,6 +1319,9 @@ int mtk_gmac_rgmii_path_setup(struct mtk +@@ -1326,6 +1326,9 @@ int mtk_gmac_rgmii_path_setup(struct mtk int mtk_eth_offload_init(struct mtk_eth *eth); int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data); |