linux/include/dt-bindings
Vladimir Oltean fceb17ac05 dt-bindings: phy-common-props: RX and TX lane polarity inversion
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>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20260111093940.975359-5-vladimir.oltean@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-01-14 18:16:05 +05:30
..
arm dt-bindings: arm: qcom,ids: Add SoC ID for QCS6490 2025-11-03 18:28:52 -06:00
ata
bus
clock Merge branches 'clk-visconti', 'clk-imx', 'clk-microchip', 'clk-rockchip' and 'clk-qcom' into clk-next 2025-12-03 10:22:37 -08:00
display
dma
firmware
gce
gpio dt-bindings: gpio: Add Tegra256 support 2025-09-01 10:20:42 +02:00
i2c
i3c
iio dt-bindings: iio: adc: mt6359: Add MT6373 PMIC AuxADC 2025-07-13 15:36:26 +01:00
input
interconnect Char/Misc/IIO driver updates for 6.19-rc1 2025-12-06 18:34:24 -08:00
interrupt-controller dt-bindings: interrupt-controller: aspeed: Add AST2700 SCU IC compatibles 2025-09-09 12:23:28 +02:00
leds
mailbox
media media: dt-bindings: video-interfaces: add defines for sampling modes 2025-11-15 12:40:33 +01:00
memory dt-bindings: mediatek: mt8189: Add bindings for MM & APU & INFRA IOMMU 2025-10-27 13:42:48 +01:00
mfd
mips
mux
net dt-bindings: net: pcs: renesas,rzn1-miic: Add RZ/T2H and RZ/N2H support 2025-09-15 17:44:35 -07:00
nvmem
phy dt-bindings: phy-common-props: RX and TX lane polarity inversion 2026-01-14 18:16:05 +05:30
pinctrl dt-bindings: pinctrl: renesas: Document RZ/T2H and RZ/N2H SoCs 2025-08-11 15:47:03 +02:00
pmu
power soc: devicetree updates for 6.19 2025-12-05 17:24:29 -08:00
pwm
regulator soc: dt changes for 6.17 2025-07-29 11:04:52 -07:00
reset This pull request is entirely SoC clk drivers, not for lack of trying to modify 2025-12-08 09:38:52 +09:00
soc dt-bindings: soc: samsung: usi: add USIv1 and samsung,exynos8895-usi 2025-02-05 16:22:48 +01:00
sound USB/Thunderbolt changes for 6.16-rc1 2025-06-06 12:45:35 -07:00
spmi
thermal dt-bindings: thermal: add Tegra114 soctherm header 2025-09-25 22:11:00 +02:00
usb
watchdog dt-bindings: watchdog: aspeed,ast2400-wdt: Add support for AST2700 2025-11-15 15:19:52 +01:00