From 213042bba186b995bc2f25c8c2d06a9652177fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 27 Sep 2022 17:09:49 +0200 Subject: Import Turris OS kernel patches --- ...-phy-mvebu-a3700-comphy-Change-2500base-x.patch | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 nixos/modules/kernel-patches/0095-phy-marvell-phy-mvebu-a3700-comphy-Change-2500base-x.patch (limited to 'nixos/modules/kernel-patches/0095-phy-marvell-phy-mvebu-a3700-comphy-Change-2500base-x.patch') diff --git a/nixos/modules/kernel-patches/0095-phy-marvell-phy-mvebu-a3700-comphy-Change-2500base-x.patch b/nixos/modules/kernel-patches/0095-phy-marvell-phy-mvebu-a3700-comphy-Change-2500base-x.patch new file mode 100644 index 0000000..918e5a1 --- /dev/null +++ b/nixos/modules/kernel-patches/0095-phy-marvell-phy-mvebu-a3700-comphy-Change-2500base-x.patch @@ -0,0 +1,63 @@ +From e5aa46ceca003444bd2e7a5f4fd43d5e61499515 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Wed, 17 Aug 2022 14:35:59 +0200 +Subject: [PATCH 95/96] phy: marvell: phy-mvebu-a3700-comphy: Change 2500base-x + transmit amplitude +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change transmit amplitude to 1025 mV for 2500base-x mode. + +This fixes issue wherein if the 8b/10b encoded packet contains a long +enough alternating sequence of bits (010101... or 101010...), which +happens if the packet contains a sequence of 'J' or '\xb5' bytes, the +packet may be lost due to FCS error. The probability of loss grows with +the number of 'J's with default transmit amplitude setting - with 114 +'J's the probability is about 50%, with 125 'J's almost 100% of packets +are lost. + +Signed-off-by: Marek BehĂșn +--- + drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +index a4d7d9bd100d..4a18f9ca6d25 100644 +--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c ++++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +@@ -68,6 +68,12 @@ + #define SPEED_PLL_MASK GENMASK(7, 2) + #define SPEED_PLL_VALUE_16 FIELD_PREP(SPEED_PLL_MASK, 0x10) + ++#define COMPHY_GEN3_SET0 0x0d ++#define Gx_TX_AMP_MASK GENMASK(5, 1) ++#define Gx_TX_AMP_VALUE(x) FIELD_PREP(Gx_TX_AMP_MASK, x) ++#define Gx_TX_AMP_ADJ BIT(6) ++#define Gx_TX_AMP_1025MV (Gx_TX_AMP_VALUE(0x12) | Gx_TX_AMP_ADJ) ++ + #define COMPHY_DIG_LOOPBACK_EN 0x23 + #define SEL_DATA_WIDTH_MASK GENMASK(11, 10) + #define DATA_WIDTH_10BIT FIELD_PREP(SEL_DATA_WIDTH_MASK, 0x0) +@@ -746,6 +752,18 @@ mvebu_a3700_comphy_ethernet_power_on(struct mvebu_a3700_comphy_lane *lane) + comphy_gbe_phy_init(lane, + lane->submode != PHY_INTERFACE_MODE_2500BASEX); + ++ /* ++ * Fix issue wherein a packet may be lost if it contains a long enough ++ * sequence of 'J' or '\xb5' bytes. ++ * This only happens with 2500base-x mode. Fix this by changing transmit ++ * amplitude to 1025 mV. ++ */ ++ if (lane->submode == PHY_INTERFACE_MODE_2500BASEX) { ++ data = Gx_TX_AMP_1025MV; ++ mask = Gx_TX_AMP_MASK | Gx_TX_AMP_ADJ; ++ comphy_lane_reg_set(lane, COMPHY_GEN3_SET0, data, mask); ++ } ++ + /* + * 14. Check the PHY Polarity invert bit + */ +-- +2.37.2 + -- cgit v1.2.3