mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <alvin.sipraga@analog.com>
To: Mieczyslaw Nalewaj <namiltd@yahoo.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: Fri, 6 Nov 2026 14:50:46 +0100	[thread overview]
Message-ID: <au3WTtBo3qk4nQvf@analog.com> (raw)
In-Reply-To: <e66204e5-ac33-4a35-8d36-6f37372da97f@yahoo.com>

On Thu, Nov 05, 2026 at 04:27:22PM +0100, Mieczyslaw Nalewaj wrote:
> On Thu, Nov 05, 2026 at 01:39:53PM +0100, Alvin Šipraga wrote:
> > During your work on the D family, did you find that the vendor driver
> > is programming the same values?
> >
> > One thing I'm wondering is: for the other C family chips, is some extra
> > RGMII TX delay being silently added by the jam table we already have?
> > [...]
> 
> I did not diff the vendor family D init table against the family C one,
> so I cannot say they are identical. I only know this register: our table
> writes 0x0090 to 0x13f9, which leaves the EXT1 RGMII TX delay field at
> 2, and the vendor RGMII setup for EXT1 on family D clears that field. I
> do not know what the field does on family C.
> 
> > Anyway, if the jam table the vendor driver uses is indeed the same for
> > both families, maybe it's best to keep it explicit like you have
> > done.
> 
> OK, I will keep it as it is.
> 
> > Do you have a datasheet I can look at? I couldn't find one.
> 
> No, I do not have one either. Everything about family D comes from the
> vendor RTL8367D API.
> 
> > I'm also a bit confused by what it means for MAC4 to "own" EXT1. Are we
> > talking about physical pin muxing [...] or is this internal muxing? And
> > since you say MAC4 is a UTP port, I don't understand how it can also be
> > associated with EXT1 [...].
> 
> I cannot answer that. "Owns" was my shorthand for the bit. All I have is
> this check in the vendor RGMII setup for port 7:
> 
>     /* Configure RGMII/MII mux to port 7 if UTP_PORT4 is not RGMII mode */
>     if ((retVal = rtl8367d_getAsicRegBit(RTL8367D_REG_TOP_CON0,
>             RTL8367D_MAC4_SEL_EXT1_OFFSET, &mux)) != RT_ERR_OK)
>         return retVal;
> 
> I did not verify anything beyond it, so I do not know whether this is a
> physical or an internal mux.

Looking at the vendor driver, it seems you can mux what they call MAC4,
to either a copper PHY, a SerDes, or an RGMII interface (EXT1). They
call port it a "combo port" (see RTK_CHK_PORT_IS_COMBO()). The other
port, MAC7, can also use EXT1. Or it can use a SerDes. But not copper.

The vendor driver is predictably quite confusing in its terminology,
calling port 4 a UTP port while also allowing RGMII etc. But whatever.

So if I understood correctly it looks something like this:

     UTP        EXT1 (RMII/RGMII)   SerDes(1?)
      |             ___|___         ___|___
      |            /       \       /       \
      |            |_______|       |_______|
      |              |   |           |   |
      |  .-----------'   |           |   |
      |  |  .------------------------'   |
   ___|__|__|___         |     .---------'
  |             |     ___|_____|___
  \_____________/    |             |
         |           \_____________/
       MAC4                 |
                          MAC7

> 
> > Since MAC7_SEL_EXT1 is writable, I would guess that so is
> > MAC4_SEL_EXT1. Could we not instead keep it configurable, and do some
> > bookkeeping in the driver to see who has requested these pins? [...]
> 
> The vendor code only reads MAC4_SEL_EXT1 in this path, and I have not
> verified that writing it is safe or what it does to UTP port 4. The
> driver has no code path that selects MAC4 for EXT1, so port 7 would be
> the only requester.

If you look at dal_rtl8367d_port_phyComboPortMedia_set(), it actually
writes MAC4_SEL_EXT1 = 1. So this is configurable.

But for the sake of the Linux driver, we don't care about MAC4 being
anything other than connected to the UTP (internal PHY), right?

So maybe just check in the switch registers, when it comes out of reset,
whether the default state of MAC4_SEL_EXT1 is 0. If yes then I think we
can just ignore this problem altogether, advertise RGMII capability on
port 7 (i.e. use EXT1), and be done with it. Maybe add a comment where
you write 1 to MAC7_SEL_EXT1 that a mux is being configured which is
also shared with MAC4 somehow, but that this feature is unsupported.

Does that make sense?

> 
> I can implement the bookkeeping in v9, but I would need to know how you
> want the MAC4 side handled. Alternatively, I can read the bit once in
> rtl8365mb_setup() and refuse RGMII on port 7 when it is set.

Bookkeeping is overkill. Let's just not support MAC4 as anything other
than UTP. If someone wants to add that support later, then it would make
sense to add bookkeeping.

Kind regards,
Alvin

  reply	other threads:[~2026-11-06 13:52 UTC|newest]

Thread overview: 38+ 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
2026-11-05 12:39         ` Alvin Šipraga
2026-11-05 15:27           ` Mieczyslaw Nalewaj
2026-11-06 13:50             ` Alvin Šipraga [this message]
2026-11-06 14:56               ` Mieczyslaw Nalewaj
2026-11-06 15:15                 ` Alvin Šipraga
2026-11-06 16:43                   ` Mieczyslaw Nalewaj
2026-11-06 15:11               ` 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-06 14:28     ` Alvin Šipraga
2026-11-06 14:56       ` Mieczyslaw Nalewaj
2026-11-06 15:46         ` Alvin Šipraga
2026-11-06 15:49       ` Andrew Lunn
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=au3WTtBo3qk4nQvf@analog.com \
    --to=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=namiltd@yahoo.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®