mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
To: "Alvin Šipraga" <alvin.sipraga@analog.com>
Cc: linusw@kernel.org, andrew@lunn.ch, olteanv@gmail.com,
	kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux@armlinux.org.uk, luizluca@gmail.com,
	maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v7 04/10] net: dsa: realtek: rtl8365mb: set RGMII mode for family D
Date: Thu, 5 Nov 2026 08:56:04 +0100	[thread overview]
Message-ID: <82c96971-be5b-4c11-b20f-c4b074181515@yahoo.com> (raw)
In-Reply-To: <auskP2mSY4sCRa6x@analog.com>

On Wed, Nov 04, 2026 at 01:39:59PM +0100, Alvin Šipraga wrote:
 > On Mon, Nov 02, 2026 at 03:39:47PM +0100, Mieczyslaw Nalewaj wrote:
 > > On family D, RGMII on extension interface 1 needs two things that the
 > > other families do not: the EXT1 RGMII TX clock delay field in
 > > EXT_TXC_DLY (0x13f9, bits [5:3]) must be cleared, and the pin mux in
 > > the top-level configuration register must be set up.
 > >
 > > The vendor RGMII setup for EXT1 clears the RGMII field of EXT_TXC_DLY
 > > (0x13f9, bits [5:3]) in addition to programming TXDELAY in RGMXF.
 > > Do the same. The init jam table writes 0x0090 to this register, which
 > > leaves the field at 2, so without the clear an extra TX delay would be
 > > applied on top of tx-internal-delay-ps. Clearing it makes
 > > tx-internal-delay-ps the only source of TX delay.
 >
 > Should we not just clear it with the jam table then? It would save some
 > code here, which is just undoing what the jam table did anyway. Or am I
 > missing something? If you deviate from the vendor driver's jam table
 > then a comment inline or in its own commit could be appropriate. But
 > either way it seems it would save some code here?

The jam table rtl8365mb_init_jam_8365mb_vc is shared between family C
and D. Changing the 0x13f9 entry from 0x0090 to 0x0080 would also
change family C behaviour, which I cannot test. Duplicating the whole
table for a single word seemed worse than two lines of code. Also, the
vendor code clears this field only when configuring RGMII on EXT1, not
on every init, so doing it in ext_config_rgmii() matches that.

If you would still prefer a separate table for D, family_info->jam_table
already allows it and I can do that in v10.

 > > If the internal MAC4 block occupies extension 1, do not advertise RGMII
 > > for port 7 in phylink_get_caps(), so the configuration is refused 
before
 > > any EXT1 register is touched. [...]
 > >
 > > [...]
 > > +    if (extint->supported_interfaces & 
RTL8365MB_PHY_INTERFACE_MODE_RGMII) {
 > > +        /* On family D the EXT1 pins are shared with MAC4 (UTP 
port 4).
 > > +         * If MAC4 owns them, RGMII on this port cannot work.
 > > +         */
 > > +        if (rtl8365mb_get_family(priv) == RTL8365MB_FAMILY_D &&
 > > +            extint->id == 1) {
 > > +            ret = regmap_read(priv->map, RTL8365MB_D_REG_TOP_CON0, 
&data);
 > > [...]
 >
 > I am a little confused about everything that's going on here, but it's
 > probably just me. Could you perhaps explain the two scenarios and the
 > order in which you expect things to happen? I'm sort of wondering when
 > this warning might be emitted. Part of me also wonders if you can't
 > avoid doing a regmap_read() here in phylink_get_caps.

On family D the EXT1 pins are shared between MAC7 (the port described
in the DT) and the internal MAC4 (UTP port 4). TOP_CON0 bit 12 tells
which of them owns the pins. This comes from the vendor RTL8367D API,
which refuses RGMII on port 7 when UTP port 4 uses the RGMII interface.
The driver never writes bit 12 and I do not know what sets its value
at reset (strap, EEPROM or bootloader); I do not have a board where
it is set, so I could not test that case. That is why get_caps() reads
the bit instead of assuming a value.

1) Bit 12 set (MAC4 owns EXT1):
    - get_caps() does not advertise RGMII for port 7,
    - phylink refuses an RGMII phy-mode for that port,
    - ext_config_rgmii() is never reached, so no EXT1 register is
      touched,
    - the warning is printed from get_caps() when phylink is created
      for the port.

2) Bit 12 clear (MAC4 does not own EXT1):
    - get_caps() advertises RGMII,
    - ext_config_rgmii() clears the EXT1 TX delay field, binds the pins
      to MAC7 (MAC7_SEL_EXT1 in TOP_CON0) and disables SerDes 1, all
      before RGMII is selected, so the shared pins are never driven by
      RGMII and SerDes 1 at the same time.

You are right that the regmap_read() in get_caps() is not nice. It also
means the warning is printed whenever get_caps() runs for that port,
even if the DT does not use RGMII there.

Since the driver never modifies the bit, reading it once in
rtl8365mb_setup() should be sufficient. I could store it in
struct rtl8365mb (e.g. bool ext1_owned_by_mac4) and have get_caps()
only test that flag, so it no longer touches the regmap. The warning
could then be moved to setup and printed only when the DT actually
requests RGMII on port 7. Would you like me to do that in v10?

Kind regards,
Mieczyslaw

  reply	other threads:[~2026-11-05  7:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3bf4dd70-9771-497b-8c27-e925e0ef81eb.ref@yahoo.com>
2026-11-02 14:34 ` [PATCH net-next v7 0/10] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-02 14:36   ` [PATCH net-next v7 01/10] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-02 14:37   ` [PATCH net-next v7 02/10] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-02 14:38   ` [PATCH net-next v7 03/10] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-04 12:20     ` Alvin Šipraga
2026-11-02 14:39   ` [PATCH net-next v7 04/10] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-04 12:39     ` Alvin Šipraga
2026-11-05  7:56       ` Mieczyslaw Nalewaj [this message]
2026-11-05 12:39         ` Alvin Šipraga
2026-11-05 15:27           ` Mieczyslaw Nalewaj
2026-11-02 14:40   ` [PATCH net-next v7 05/10] net: dsa: realtek: rtl8365mb: set and get vlan 4k " Mieczyslaw Nalewaj
2026-11-04 12:45     ` Alvin Šipraga
2026-11-02 14:41   ` [PATCH net-next v7 06/10] net: dsa: realtek: rtl8365mb: use raw VID for PVID on " Mieczyslaw Nalewaj
2026-11-02 14:42   ` [PATCH net-next v7 07/10] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-02 14:43   ` [PATCH net-next v7 08/10] net: dsa: realtek: rtl8365mb: re-latch the family D SerDes Mieczyslaw Nalewaj
2026-11-04 12:57     ` Alvin Šipraga
2026-11-05  7:18       ` Mieczyslaw Nalewaj
2026-11-05  8:52         ` Alvin Šipraga
2026-11-05 10:24           ` Mieczyslaw Nalewaj
2026-11-05 12:09             ` Alvin Šipraga
2026-11-02 14:44   ` [PATCH net-next v7 09/10] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-03 15:36     ` Alvin Šipraga
2026-11-03 16:44       ` Mieczyslaw Nalewaj
2026-11-02 14:45   ` [PATCH net-next v7 10/10] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-03 22:52     ` Alvin Šipraga
2026-11-03 23:41       ` Mieczyslaw Nalewaj
2026-11-04  9:40         ` Mieczyslaw Nalewaj
2026-11-04 13:14           ` Alvin Šipraga
2026-11-04 16:37             ` Mieczyslaw Nalewaj

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=82c96971-be5b-4c11-b20f-c4b074181515@yahoo.com \
    --to=namiltd@yahoo.com \
    --cc=alvin.sipraga@analog.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=luizluca@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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®