From: Marek Vasut <marex@denx.de>
To: Daniel Golle <daniel@makrotopia.org>
Cc: netdev@vger.kernel.org,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andrew Lunn <andrew@lunn.ch>,
Christophe Roullier <christophe.roullier@foss.st.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
kernel@dh-electronics.com, linux-kernel@vger.kernel.org
Subject: Re: [net-next,PATCH] net: phy: realtek: Add support for PHY LEDs on RTL8211F
Date: Tue, 25 Jun 2024 03:59:06 +0200 [thread overview]
Message-ID: <5e595eaa-3b23-4ad9-aed5-8354eaff0d3e@denx.de> (raw)
In-Reply-To: <ZnjFTSmF3MGX7OuY@makrotopia.org>
On 6/24/24 3:01 AM, Daniel Golle wrote:
> On Mon, Jun 24, 2024 at 01:40:33AM +0200, Marek Vasut wrote:
>> Realtek RTL8211F Ethernet PHY supports 3 LED pins which are used to
>> indicate link status and activity. Add minimal LED controller driver
>> supporting the most common uses with the 'netdev' trigger.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>
>> [...]
>> +static int rtl8211f_led_hw_is_supported(struct phy_device *phydev, u8 index,
>> + unsigned long rules)
>> +{
>> + const unsigned long mask = BIT(TRIGGER_NETDEV_LINK_10) |
>> + BIT(TRIGGER_NETDEV_LINK_100) |
>> + BIT(TRIGGER_NETDEV_LINK_1000) |
>> + BIT(TRIGGER_NETDEV_RX) |
>> + BIT(TRIGGER_NETDEV_TX);
>> +
>> + /* The RTL8211F PHY supports these LED settings on up to three LEDs:
>> + * - Link: Configurable subset of 10/100/1000 link rates
>> + * - Active: Blink on activity, RX or TX is not differentiated
>> + * The Active option has two modes, A and B:
>> + * - A: Link and Active indication at configurable, but matching,
>> + * subset of 10/100/1000 link rates
>> + * - B: Link indication at configurable subset of 10/100/1000 link
>> + * rates and Active indication always at all three 10+100+1000
>> + * link rates.
>> + * This code currently uses mode B only.
>> + */
>> +
>> + if (index >= RTL8211F_LED_COUNT)
>> + return -EINVAL;
>> +
>> + /* Filter out any other unsupported triggers. */
>> + if (rules & ~mask)
>> + return -EOPNOTSUPP;
>
> It looks like it is not possible to let the hardware indicate only either
> RX or TX, it will always have to go together.
>
> Please express this in this function accordingly, so fallback to
> software-driven trigger works as expected.
>
> Example:
> if (!(rules & BIT(TRIGGER_NETDEV_RX)) ^ !(rules & BIT(TRIGGER_NETDEV_TX)))
> return -EOPNOTSUPP;
Added to V2, thank you.
prev parent reply other threads:[~2024-06-25 2:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-23 23:40 Marek Vasut
2024-06-24 1:01 ` Daniel Golle
2024-06-25 1:59 ` Marek Vasut [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=5e595eaa-3b23-4ad9-aed5-8354eaff0d3e@denx.de \
--to=marex@denx.de \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=christophe.roullier@foss.st.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kernel@dh-electronics.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--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®