From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>,
Tero Kristo <kristo@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kees Cook <kees@kernel.org>, Tony Luck <tony.luck@intel.com>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
Felipe Balbi <balbi@kernel.org>,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
linux-hardening@vger.kernel.org,
Devarsh Thakkar <devarsht@ti.com>, Hari Nagalla <hnagalla@ti.com>,
linux@ew.tq-group.com
Subject: Re: [PATCH v2 5/5] arm64: dts: ti: Add TQ-Systems TQMa62xx SoM and MBa62xx carrier board Device Trees
Date: Tue, 10 Dec 2024 10:56:41 +0100 [thread overview]
Message-ID: <309052f3f69950fe43390505cc7254aee8c8f5c6.camel@ew.tq-group.com> (raw)
In-Reply-To: <a2a2f201-73a4-4a99-baef-0d593a88c872@lunn.ch>
On Mon, 2024-12-09 at 17:14 +0100, Andrew Lunn wrote:
>
> > Not our board, but the AM62 SoC. From the datasheet:
> >
> > "TXC is delayed internally before being driven to the RGMII[x]_TXC pin. This
> > internal delay is always enabled." So enabling the TX delay on the PHY side
> > would result in a double delay.
>
> phy-mode describes the board. If the board does not have extra long
> clock lines, phy-mode should be rgmii-id.
>
> The fact the MAC is doing something which no other MAC does should be
> hidden away in the MAC driver, as much as possible.
Isn't it kind of a philosophical question whether a delay added by the SoC
integration is part of the MAC or not? One could also argue that the MAC IP core
is always the same, with some SoCs adding the delay and others not. (I don't
know if there are actually SoCs with the same IP core that don't add a delay;
I'm just not a big fan of hiding details in the driver that could easily be
described by the Device Tree, thus making the driver more generic)
>
> The MAC driver should return -EINVAL with phy-mode rgmii, or
> rmgii-rxid, because the MAC driver is physically incapable of being
> used on a board which has extra long TX clock lines, which 'rmgii' or
> rgmii-rxid would indicate.
>
> Since the MAC driver is forcing the TX delay, it needs to take the
> value returned from of_get_phy_mode() and mask out the TX bit before
> passing it to the PHY.
Hmm okay, this is what the similar ICSSG/PRUETH driver does. I've always found
that solution to be particularly confusing, but if that's how it's supposed to
work, I'll have to accept that.
In my opinion the documentation Documentation/networking/phy.rst is not very
clear on this matter - the whole section "(RG)MII/electrical interface
considerations" talks about whether the PHY inserts the delay or not, so my
assumption was that phy-mode describes the PHY side of things and only that.
It gets even more confusing when taking into account
Documentation/devicetree/bindings/net/ethernet-controller.yaml, which contains
comments like "RGMII with internal RX delay provided by the PHY, the MAC should
not add an RX delay in this case", which sounds like there are only the cases
"delay is added by the PHY" and "delay is added by the MAC" - the case "delay is
part of the board design, neither MAC nor PHY add it" doesn't even appear.
>
> Now, it could be that history has got in the way. There are boards out
> there which have broken DT but work. Fixing the MAC driver to do the
> correct thing will break those boards. Vendors with low quality code
> which works, but not really.
>
> ~/linux/arch/arm64/boot/dts/ti$ grep rgmii k3-am625-*
> k3-am625-beagleplay.dts: phy-mode = "rgmii-rxid";
> k3-am625-sk.dts: phy-mode = "rgmii-rxid";
>
> Yep, these two have broken DT, they don't describe the board
> correctly.
>
> O.K. Can we fix this for you board? Yes, i think we can. If you take
> rmgii-rxid, aka PHY_INTERFACE_MODE_RGMII_RXID, and mask out the TX,
> you still get PHY_INTERFACE_MODE_RGMII_RXID. If you take rgmii-id,
> a.k.a. PHY_INTERFACE_MODE_RGMII_ID and mask out the TX, you get
> PHY_INTERFACE_MODE_RGMII_RXID, which is what you want.
>
> Please produce a patch to the MAC driver, explaining the horrible mess
> the vendor made, and how this fixes it, but should also not break
> other boards.
I can make this change, but "am65-cpsw-nuss" currently supports 6 different
compatible strings, many of which are used for multiple SoC families.
Maybe someone from TI could chime in and say whether all of these have the fixed
TXC delay, or at least the current compatible strings are already specific
enough to tell whether the SoC adds a delay?
>
> > No such defaults exist in the DP83867 driver. If any rgmii-*id mode is used, the
> > corresponding delays *must* be specified in the DTB:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/phy/dp83867.c#n532
>
> That is bad, different to pretty every other PHY driver :-(
>
> If you want, you could patch this driver as well, make it default to
> 2ns if delays are asked for.
Makes sense, I'll write a patch for that as well.
Best regards,
Matthias
>
> Andrew
>
> ---
> pw-bot: cr
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/
next prev parent reply other threads:[~2024-12-10 9:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 9:51 [PATCH v2 0/5] TQ-Systems TQMa62xx SoM and MBa62xx board Matthias Schiffer
2024-12-09 9:51 ` [PATCH v2 1/5] dt-bindings: usb: dwc3: Allow connector in USB controller node Matthias Schiffer
2024-12-26 17:36 ` Nishanth Menon
2024-12-09 9:51 ` [PATCH v2 2/5] dt-bindings: arm: ti: Add compatible for AM625-based TQMa62xx SOM family and carrier board Matthias Schiffer
2024-12-09 9:51 ` [PATCH v2 3/5] arm64: dts: ti: k3-am62: Add DM R5 ranges in cbass Matthias Schiffer
2024-12-09 9:51 ` [PATCH v2 4/5] arm64: dts: ti: k3-am62-wakeup: Add R5F device node Matthias Schiffer
2024-12-09 9:51 ` [PATCH v2 5/5] arm64: dts: ti: Add TQ-Systems TQMa62xx SoM and MBa62xx carrier board Device Trees Matthias Schiffer
2024-12-09 13:24 ` Andrew Lunn
2024-12-09 13:55 ` Matthias Schiffer
2024-12-09 14:42 ` Andrew Lunn
2024-12-09 15:05 ` Matthias Schiffer
2024-12-09 16:14 ` Andrew Lunn
2024-12-10 9:56 ` Matthias Schiffer [this message]
2024-12-10 19:54 ` Andrew Lunn
2025-03-19 10:45 ` Matthias Schiffer
2025-03-19 13:37 ` Andrew Lunn
2025-03-19 14:38 ` Matthias Schiffer
2025-03-19 15:39 ` Andrew Lunn
2024-12-09 16:35 ` Russell King (Oracle)
2024-12-09 16:43 ` Luck, Tony
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=309052f3f69950fe43390505cc7254aee8c8f5c6.camel@ew.tq-group.com \
--to=matthias.schiffer@ew.tq-group.com \
--cc=andrew@lunn.ch \
--cc=balbi@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devarsht@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=gpiccoli@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=hnagalla@ti.com \
--cc=kees@kernel.org \
--cc=kristo@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@ew.tq-group.com \
--cc=nm@ti.com \
--cc=robh@kernel.org \
--cc=tony.luck@intel.com \
--cc=vigneshr@ti.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®