From: "Rob Herring (Arm)" <robh@kernel.org>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: "Eric Woudstra" <ericwouds@gmail.com>,
"Horatiu Vultur" <horatiu.vultur@microchip.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
netdev@vger.kernel.org,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"David S. Miller" <davem@davemloft.net>,
"Russell King" <linux@armlinux.org.uk>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Andrew Lunn" <andrew@lunn.ch>,
linux-arm-kernel@lists.infradead.org,
"Jakub Kicinski" <kuba@kernel.org>,
"Marek Behún" <kabel@kernel.org>, "Lee Jones" <lee@kernel.org>,
linux-phy@lists.infradead.org,
"Eric Dumazet" <edumazet@google.com>,
devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org,
"Paolo Abeni" <pabeni@redhat.com>,
"Daniel Golle" <daniel@makrotopia.org>,
linux-kernel@vger.kernel.org,
"Patrice Chotard" <patrice.chotard@foss.st.com>,
"Vinod Koul" <vkoul@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>
Subject: Re: [PATCH net-next 3/9] dt-bindings: phy-common-props: RX and TX lane polarity inversion
Date: Thu, 4 Dec 2025 10:13:02 -0600 [thread overview]
Message-ID: <176486478133.1579282.8723601049864810210.robh@kernel.org> (raw)
In-Reply-To: <20251122193341.332324-4-vladimir.oltean@nxp.com>
On Sat, 22 Nov 2025 21:33:35 +0200, Vladimir Oltean wrote:
> Differential signaling is a technique for high-speed protocols to be
> more resilient to noise. At the transmit side we have a positive and a
> negative signal which are mirror images of each other. At the receiver,
> if we subtract the negative signal (say of amplitude -A) from the
> positive signal (say +A), we recover the original single-ended signal at
> twice its original amplitude. But any noise, like one coming from EMI
> from outside sources, is supposed to have an almost equal impact upon
> the positive (A + E, E being for "error") and negative signal (-A + E).
> So (A + E) - (-A + E) eliminates this noise, and this is what makes
> differential signaling useful.
>
> Except that in order to work, there must be strict requirements observed
> during PCB design and layout, like the signal traces needing to have the
> same length and be physically close to each other, and many others.
>
> Sometimes it is not easy to fulfill all these requirements, a simple
> case to understand is when on chip A's pins, the positive pin is on the
> left and the negative is on the right, but on the chip B's pins (with
> which A tries to communicate), positive is on the right and negative on
> the left. The signals would need to cross, using vias and other ugly
> stuff that affects signal integrity (introduces impedance
> discontinuities which cause reflections, etc).
>
> So sometimes, board designers intentionally connect differential lanes
> the wrong way, and expect somebody else to invert that signal to recover
> useful data. This is where RX and TX polarity inversion comes in as a
> generic concept that applies to any high-speed serial protocol as long
> as it uses differential signaling.
>
> I've stopped two attempts to introduce more vendor-specific descriptions
> of this only in the past month:
> https://lore.kernel.org/linux-phy/20251110110536.2596490-1-horatiu.vultur@microchip.com/
> https://lore.kernel.org/netdev/20251028000959.3kiac5kwo5pcl4ft@skbuf/
>
> and in the kernel we already have merged:
> - "st,px_rx_pol_inv"
> - "st,pcie-tx-pol-inv"
> - "st,sata-tx-pol-inv"
> - "mediatek,pnswap"
> - "airoha,pnswap-rx"
> - "airoha,pnswap-tx"
>
> and maybe more. So it is pretty general.
>
> One additional element of complexity is introduced by the fact that for
> some protocols, receivers can automatically detect and correct for an
> inverted lane polarity (example: the PCIe LTSSM does this in the
> Polling.Configuration state; the USB 3.1 Link Layer Test Specification
> says that the detection and correction of the lane polarity inversion in
> SuperSpeed operation shall be enabled in Polling.RxEQ.). Whereas for
> other protocols (SGMII, SATA, 10GBase-R, etc etc), the polarity is all
> manual and there is no detection mechanism mandated by their respective
> standards.
>
> So why would one even describe rx-polarity and tx-polarity for protocols
> like PCIe, if it had to always be PHY_POL_AUTO?
>
> Related question: why would we define the polarity as an array per
> protocol? Isn't the physical PCB layout protocol-agnostic, and aren't we
> describing the same physical reality from the lens of different protocols?
>
> The answer to both questions is because multi-protocol PHYs exist
> (supporting e.g. USB2 and USB3, or SATA and PCIe, or PCIe and Ethernet
> over the same lane), one would need to manually set the polarity for
> SATA/Ethernet, while leaving it at auto for PCIe/USB 3.0+.
>
> I also investigated from another angle: what if polarity inversion in
> the PHY is one layer, and then the PCIe/USB3 LTSSM polarity detection is
> another layer on top? Then rx-polarity = <PHY_POL_AUTO> doesn't make
> sense, it can still be rx-polarity = <PHY_POL_NORMAL> or <PHY_POL_INVERT>,
> and the link training state machine figures things out on top of that.
> This would radically simplify the design, as the elimination of
> PHY_POL_AUTO inherently means that the need for a property array per
> protocol also goes away.
>
> I don't know how things are in the general case, but at least in the 10G
> and 28G Lynx SerDes blocks from NXP Layerscape devices, this isn't the
> case, and there's only a single level of RX polarity inversion: in the
> SerDes lane. In the case of PCIe, the controller is in charge of driving
> the RDAT_INV bit autonomously, and it is read-only to software.
>
> So the existence of this kind of SerDes lane proves the need for
> PHY_POL_AUTO to be a third state.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> .../bindings/phy/phy-common-props.yaml | 45 +++++++++++++++++++
> include/dt-bindings/phy/phy.h | 4 ++
> 2 files changed, 49 insertions(+)
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
next prev parent reply other threads:[~2025-12-04 16:13 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 19:33 [PATCH net-next 0/9] XPCS polarity inversion via generic device tree properties Vladimir Oltean
2025-11-22 19:33 ` [PATCH net-next 1/9] dt-bindings: phy: rename transmit-amplitude.yaml to phy-common-props.yaml Vladimir Oltean
2025-11-25 21:19 ` Andrew Lunn
2025-11-25 21:44 ` Vladimir Oltean
2025-11-25 22:33 ` Andrew Lunn
2025-11-26 7:26 ` Vladimir Oltean
2025-11-26 9:32 ` Holger Brunck
2025-11-26 10:33 ` Vladimir Oltean
2025-11-26 10:45 ` Holger Brunck
2025-11-26 10:51 ` Vladimir Oltean
2025-11-26 13:05 ` Holger Brunck
2025-11-26 14:09 ` Andrew Lunn
2025-11-26 14:25 ` Maxime Chevallier
2025-12-04 16:11 ` Rob Herring (Arm)
2025-11-22 19:33 ` [PATCH net-next 2/9] dt-bindings: phy-common-props: create a reusable "protocol-names" definition Vladimir Oltean
2025-12-04 15:52 ` Rob Herring
2025-12-04 16:11 ` Rob Herring
2025-11-22 19:33 ` [PATCH net-next 3/9] dt-bindings: phy-common-props: RX and TX lane polarity inversion Vladimir Oltean
2025-12-04 16:13 ` Rob Herring (Arm) [this message]
2025-11-22 19:33 ` [PATCH net-next 4/9] dt-bindings: net: xpcs: allow properties from phy-common-props.yaml Vladimir Oltean
2025-12-04 16:13 ` Rob Herring (Arm)
2025-11-22 19:33 ` [PATCH net-next 5/9] phy: add phy_get_rx_polarity() and phy_get_tx_polarity() Vladimir Oltean
2025-11-25 4:01 ` Jakub Kicinski
2025-11-25 17:02 ` Vladimir Oltean
2025-12-01 8:37 ` Vinod Koul
2025-12-01 8:41 ` Krzysztof Kozlowski
2025-12-04 15:34 ` Vladimir Oltean
2025-12-04 16:48 ` Krzysztof Kozlowski
2025-12-01 19:03 ` Jakub Kicinski
2025-11-22 19:33 ` [PATCH net-next 6/9] net: pcs: xpcs: promote SJA1105 TX polarity inversion to core Vladimir Oltean
2025-11-22 19:33 ` [PATCH net-next 7/9] net: pcs: xpcs: allow lane polarity inversion Vladimir Oltean
2025-11-26 15:17 ` kernel test robot
2025-11-22 19:33 ` [PATCH net-next 8/9] net: phy: air_en8811h: deprecate "airoha,pnswap-rx" and "airoha,pnswap-tx" Vladimir Oltean
2025-11-22 19:33 ` [PATCH net-next 9/9] dt-bindings: net: airoha,en8811h: " Vladimir Oltean
2025-12-04 16:13 ` Rob Herring (Arm)
2025-11-25 14:36 ` [PATCH net-next 0/9] XPCS polarity inversion via generic device tree properties Daniel Golle
2025-12-27 16:12 ` Bjørn Mork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176486478133.1579282.8723601049864810210.robh@kernel.org \
--to=robh@kernel.org \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=ericwouds@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=horatiu.vultur@microchip.com \
--cc=kabel@kernel.org \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patrice.chotard@foss.st.com \
--cc=vkoul@kernel.org \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®