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 03/10] net: dsa: realtek: rtl8365mb: set speed for family D
Date: Wed, 4 Nov 2026 13:20:14 +0100 [thread overview]
Message-ID: <ausWDFnyjSgnN0GS@analog.com> (raw)
In-Reply-To: <d7f64039-b629-48eb-a985-dbcb2cc53774@yahoo.com>
On Mon, Nov 02, 2026 at 03:38:53PM +0100, Mieczyslaw Nalewaj wrote:
> On family C hardware, forcing a 2.5 Gbps link speed requires relying
> strictly on the HSGMII SerDes configuration block, while forcing a dummy
> 1 Gbps value inside the standard digital interface register. Family D
> introduces a dedicated hardware link speed value (5) for 2500M. The speed
> bitfield width has been expanded to 3 bits, splitting the most significant
> bit into a new separate register field (FORCE_SPEED2), which maps directly
> to a distinct per-port digital interface force layout.
>
> On family D the forced-mode configuration (link, duplex, pause, speed)
> is written to a per-port register at 0x12c0 + port instead of the
> per-extint register. The bit positions of TXPAUSE, RXPAUSE, LINK, DUPLEX
> and the low two speed bits are the same as on family C; the upper speed
> bits go to bits 13:12 (FORCE_SPEED2), so FORCE_EN (bit 12 on family C)
> is not set. A second per-port register at 0x12c8 + port enables the
> forced mode: the vendor RTL8367D API writes 0xFFFF there when the MAC
> is forced and 0 otherwise. This driver always forces the MAC, as on
> family C, so it writes 0xFFFF on every call, including link down.
>
> The family D branch is not reachable until the chip table entry is
> added in the last patch.
>
> Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
> Reviewed-by: Linus Walleij <linusw@kernel.org>
> ---
> drivers/net/dsa/realtek/rtl8365mb_main.c | 82 ++++++++++++++++++++----
> 1 file changed, 69 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 840db5a..2dabc4d 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
> @@ -344,6 +344,7 @@
> #define RTL8365MB_PORT_SPEED_10M 0
> #define RTL8365MB_PORT_SPEED_100M 1
> #define RTL8365MB_PORT_SPEED_1000M 2
> +#define RTL8365MB_D_PORT_SPEED_2500M 5
I'm starting to doubt the value of these macros now that I see this _D
exception too. Maybe it's more straightforward to inline the values in
the function.
>
> /* External interface force configuration registers 0~2 */
> #define RTL8365MB_DIGITAL_INTERFACE_FORCE_REG0 0x1310 /* EXT0 */
> @@ -361,6 +362,28 @@
> #define RTL8365MB_DIGITAL_INTERFACE_FORCE_LINK_MASK BIT(4)
> #define RTL8365MB_DIGITAL_INTERFACE_FORCE_DUPLEX_MASK BIT(2)
> #define RTL8365MB_DIGITAL_INTERFACE_FORCE_SPEED_MASK GENMASK(1, 0)
> +/* Width of the FORCE_SPEED field, bits[1:0] */
> +#define RTL8365MB_DIGITAL_INTERFACE_FORCE_SPEED_WIDTH 2
We don't have any other _WIDTH macros so my instinct is that you can
dispose of this...
> +
> +/* bits[13:12]; bit 13 reserved, no defined speed value uses it yet */
> +#define RTL8365MB_D_DIGITAL_INTERFACE_FORCE_SPEED2_MASK GENMASK(13, 12)
> +
> +#define RTL8365MB_D_DIGITAL_INTERFACE_FORCE_REG_BASE 0x12c0
> +#define RTL8365MB_D_DIGITAL_INTERFACE_FORCE_REG(_port) \
> + (RTL8365MB_D_DIGITAL_INTERFACE_FORCE_REG_BASE + (_port))
> +
> +#define RTL8365MB_D_DIGITAL_INTERFACE_FORCE_EN_BASE 0x12c8
> +#define RTL8365MB_D_DIGITAL_INTERFACE_FORCE_REG_EN(_port) \
> + (RTL8365MB_D_DIGITAL_INTERFACE_FORCE_EN_BASE + (_port))
> +
> +/* Per-port force-mode enable. The vendor RTL8367D API
> + * (dal_rtl8367d_port_macForceLink_set()) treats it as an on/off switch for
> + * the whole forced configuration: all bits set when the MAC is forced, zero
> + * when it is not. The meaning of the individual bits is not documented.
> + * This driver always forces the MAC, as on family C, so all bits are set
> + * on every call, including link down.
> + */
> +#define RTL8365MB_D_DIGITAL_INTERFACE_FORCE_EN_ALL_MASK GENMASK(15, 0)
Ahh, at this rate, maybe the ext_config_forcemode() should just be split
into two functions per family. Since you're now writing to completely
different registers depending on the family, which are only somewhat
similar. Can you try it and see how it looks?
I'd then also update the "old" C register macros to have the
RTL8365MB_C_ prefix. That way we have an approach in the driver where
non-common registers are labelled by their family.
And as above, you can then just inline the values for r_speed and
r_speed2. It's not pretty but the global macros do not really help IMO.
Again, try it out, if you don't like it, then I guess this is still OK.
Kind regards,
Alvin
next prev parent reply other threads:[~2026-11-04 12:20 UTC|newest]
Thread overview: 22+ 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 [this message]
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-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-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=ausWDFnyjSgnN0GS@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®