From: Simon Polack <spolack+git@mailbox.org>
To: Javen <javen_xu@realsil.com.cn>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"hkallweit1@gmail.com" <hkallweit1@gmail.com>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>
Cc: "f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"chad@monroe.io" <chad@monroe.io>,
"vladimir.oltean@nxp.com" <vladimir.oltean@nxp.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH net-next 3/3] net: phy: realtek: add LED support for RTL8261C/D
Date: Mon, 28 Sep 2026 12:05:57 +0200 [thread overview]
Message-ID: <DA7B6920-B0DF-4B27-A3B3-719FFBF86002@mailbox.org> (raw)
In-Reply-To: <ee6ee488e3884540a82cfab11fb36ba3@realsil.com.cn>
Resending text-encoded:
Hi Javen,
Thanks for reviewing.
Could you clarify "configured via firmware"? Neither rtl8261c.bin nor
rtl8261d.bin in linux-firmware writes the LED block (0xd032 + 2 *
index, 0xd040, 0xd044), directly or through the 0xa436/0xa438 window.
The driver already configures LEDs from the kernel on the RTL8211E/F
and RTL8221B, and the RTL8221B uses the same VEND2 block this patch
drives.
The layout was confirmed on an RTL8261CE here, and Chad (CC'd) reports
it working on RTL8261C and RTL8261D boards. If it differs on a variant
the driver binds, which one? I'll restrict the callbacks accordingly.
Simon
Am 28. September 2026 09:23:37 MESZ schrieb Javen <javen_xu@realsil.com.cn>:
>>The RTL8261C/D use the same LED register block as the RTL8221B: one control
>>register per LED at VEND2 0xd032 + 2 * index selecting the link speeds that light
>>it, activity blink bits in LCR6 and per-LED polarity and enable bits in LCR7.
>>Compared to the RTL8221B there are four LEDs instead of three, and two more
>>speed bits for 5G and 10G.
>>
>>Reuse the existing RTL822X_VND2_* definitions and add the two speed bits
>>and the enable bit. The callbacks follow rtl822xb_led_*() closely, with two
>>additions:
>>
>> - led_polarity_set() honours active-low LEDs. The polarity bit in LCR7
>> doubles as the manual on/off level in led_brightness_set(), so the
>> configured polarity is cached in the private data and restored by
>> led_hw_control_set().
>>
>> - led_hw_control_set() and led_brightness_set() set the output enable
>> bit, which firmware normally leaves set already.
>>
>>The callbacks duplicate most of rtl822xb_led_*(), differing only in the LED
>>count, the speed mask and the LCR7 handling. Making the RTL8221B code
>>table-driven and sharing it would be the right end state, but that touches a
>>working driver and wants testing on an RTL8221B, so it is left for a follow-up
>>series.
>>
>>The callbacks are wired to the RTL8261C_CG and RTL8261CE_CG entries, which
>>between them cover the parts this was tested on. RTL8261D_VM is left out for
>>lack of hardware.
>>
>>Tested on a Gemtek W1700K (Airoha AN7581) with an RTL8261CE: index 2
>>drives a yellow and index 3 a green LED on each 10G port. Under hardware
>>control the link speed bits, the activity blink and the combined
>>TRIGGER_NETDEV_LINK all take effect and offloading is confirmed through the
>>netdev trigger. The polarity bit was verified to be active-high when clear on that
>>board. Also tested on AN7581 and MT7988A boards with an RTL8261C and
>>RTL8261D.
>>
>>Signed-off-by: Chad Monroe <chad@monroe.io>
>>Co-developed-by: Simon Polack <spolack+git@mailbox.org>
>>Signed-off-by: Simon Polack <spolack+git@mailbox.org>
>>Assisted-by: LLM
>>---
>> drivers/net/phy/realtek/realtek_main.c | 228
>>+++++++++++++++++++++++++
>> 1 file changed, 228 insertions(+)
>>
>>diff --git a/drivers/net/phy/realtek/realtek_main.c
>>b/drivers/net/phy/realtek/realtek_main.c
>>index 04d397f0a2d8..b1f020aa7760 100644
>>--- a/drivers/net/phy/realtek/realtek_main.c
>>+++ b/drivers/net/phy/realtek/realtek_main.c
>>@@ -183,12 +183,15 @@
>> #define RTL822X_VND2_LCR_LINK_100 BIT(1)
>> #define RTL822X_VND2_LCR_LINK_1000 BIT(2)
>> #define RTL822X_VND2_LCR_LINK_2500 BIT(5)
>>+#define RTL822X_VND2_LCR_LINK_5000 BIT(6)
>>+#define RTL822X_VND2_LCR_LINK_10000 BIT(4)
>>
>> #define RTL822X_VND2_LCR6 0xd040
>> #define RTL822X_VND2_LED_ACT(x) BIT(x)
>>
>> #define RTL822X_VND2_LCR7 0xd044
>> #define RTL822X_VND2_LED_POLAR(x) BIT(x)
>>+#define RTL822X_VND2_LED_EN(x) BIT((x) + 4)
>>
>> #define RTL8224_MII_RTCT 0x11
>> #define RTL8224_MII_RTCT_ENABLE BIT(0)
>>@@ -305,6 +308,7 @@
>> #define FW_SUB_MAGIC_8261D 0x32363144
>> #define RTL8261X_POLL_TIMEOUT_MS 100
>> #define RTL8261X_MAX_MMD_DEV 31
>>+#define RTL8261X_LED_COUNT 4
>
>Hi,
>
>We kindly suggest dropping this patch for the same reason as in Patch 2/3.
>
>LED config is related to HW config and will be configured via firmware.
>
>BRs,
>Javen
prev parent reply other threads:[~2026-09-28 10:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 16:18 [PATCH net-next 0/3] net: phy: realtek: SerDes lane polarity and LEDs " Simon Polack
2026-09-21 16:18 ` [PATCH net-next 1/3] dt-bindings: net: realtek,rtl82xx: Document RTL8261C/D PHYs Simon Polack
2026-09-24 10:21 ` netdev-bot+sashiko
2026-09-21 16:18 ` [PATCH net-next 2/3] net: phy: realtek: apply SerDes lane polarity on RTL8261C/D Simon Polack
2026-09-24 10:21 ` netdev-bot+sashiko
2026-09-28 7:17 ` Javen
2026-09-28 10:02 ` Simon Polack
2026-09-21 16:18 ` [PATCH net-next 3/3] net: phy: realtek: add LED support for RTL8261C/D Simon Polack
2026-09-24 10:21 ` netdev-bot+sashiko
2026-09-28 7:23 ` Javen
2026-09-28 10:05 ` Simon Polack [this message]
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=DA7B6920-B0DF-4B27-A3B3-719FFBF86002@mailbox.org \
--to=spolack+git@mailbox.org \
--cc=andrew+netdev@lunn.ch \
--cc=chad@monroe.io \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=javen_xu@realsil.com.cn \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=vladimir.oltean@nxp.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®