Skip to content

Commit d1cf428

Browse files
minimaxwellNipaLocal
authored andcommitted
Documentation: net: phy: Elaborate on RGMII delay handling
As discussed here [1], the RGMII delays may be inserted by either the MAC, the PHY or the Board through the PCB traces. Elaborate more on what the firmware properties represent, and what is the expected role of MAC and PHY in delay insertion, with a preference on PHY-side delay insertion. [1] : https://lore.kernel.org/netdev/[email protected]/ Suggested-by: Andrew Lunn <[email protected]> Signed-off-by: Maxime Chevallier <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 8b213fd commit d1cf428

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

Documentation/networking/phy.rst

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,16 @@ The Reduced Gigabit Medium Independent Interface (RGMII) is a 12-pin
7373
electrical signal interface using a synchronous 125Mhz clock signal and several
7474
data lines. Due to this design decision, a 1.5ns to 2ns delay must be added
7575
between the clock line (RXC or TXC) and the data lines to let the PHY (clock
76-
sink) have a large enough setup and hold time to sample the data lines correctly. The
77-
PHY library offers different types of PHY_INTERFACE_MODE_RGMII* values to let
76+
sink) have a large enough setup and hold time to sample the data lines correctly.
77+
78+
The device tree property phy-mode describes the hardware. When used
79+
with RGMII, its value indicates if the hardware, i.e. the PCB,
80+
provides the 2ns delay required for RGMII. A phy-mode of 'rgmii'
81+
indicates the PCB is adding the 2ns delay. For other values, the
82+
MAC/PHY pair must insert the needed 2ns delay, with the strong
83+
preference the PHY adds the delay.
84+
85+
The PHY library offers different types of PHY_INTERFACE_MODE_RGMII* values to let
7886
the PHY driver and optionally the MAC driver, implement the required delay. The
7987
values of phy_interface_t must be understood from the perspective of the PHY
8088
device itself, leading to the following:
@@ -106,14 +114,22 @@ Whenever possible, use the PHY side RGMII delay for these reasons:
106114
configure correctly a specified delay enables more designs with similar delay
107115
requirements to be operated correctly
108116

109-
For cases where the PHY is not capable of providing this delay, but the
110-
Ethernet MAC driver is capable of doing so, the correct phy_interface_t value
111-
should be PHY_INTERFACE_MODE_RGMII, and the Ethernet MAC driver should be
112-
configured correctly in order to provide the required transmit and/or receive
113-
side delay from the perspective of the PHY device. Conversely, if the Ethernet
114-
MAC driver looks at the phy_interface_t value, for any other mode but
115-
PHY_INTERFACE_MODE_RGMII, it should make sure that the MAC-level delays are
116-
disabled.
117+
The MAC driver may fine tune the delays. This can be configured
118+
based on firmware "rx-internal-delay-ps" and "tx-internal-delay-ps"
119+
properties. These values are expected to be small, not the full 2ns
120+
delay.
121+
122+
A MAC driver inserting these fine tuning delays should always do so
123+
when these properties are present and non-zero, regardless of the
124+
RGMII mode specified.
125+
126+
For cases where the PHY is not capable of providing the 2ns delay,
127+
the MAC must provide it, if the phy-mode indicates the PCB is not
128+
providing the delays. The MAC driver must adjust the
129+
PHY_INTERFACE_MODE_RGMII_* mode it passes to the connected PHY
130+
device (through :c:func:`phy_connect <phy_connect>` for example) to
131+
account for MAC-side delay insertion, so that the PHY device
132+
does not add additional delays.
117133

118134
In case neither the Ethernet MAC, nor the PHY are capable of providing the
119135
required delays, as defined per the RGMII standard, several options may be

0 commit comments

Comments
 (0)