Re: [PATCH net-next v2 2/3] net: phy: air_en8811h: add Airoha AN8811HB support
From: Bjørn Mork <bjorn@mork.no>
Date: 2026-01-25 11:07:54
Also in:
lkml
Andrew Lunn [off-list ref] writes:
On Sat, Jan 24, 2026 at 05:53:03PM +0100, Bjørn Mork wrote:quoted
Andrew Lunn [off-list ref] writes:quoted
quoted
+#define AN8811HB_GPIO_OUTPUT 0x5cf8b8 +#define AN8811HB_GPIO_OUTPUT_345 (BIT(3) | BIT(4) | BIT(5))quoted
+ /* Configure led gpio pins as output */ + ret = air_buckpbus_reg_modify(phydev, AN8811HB_GPIO_OUTPUT, + AN8811HB_GPIO_OUTPUT_345, + AN8811HB_GPIO_OUTPUT_345);The code/comment probably does not describe what is actually happening here. My _guess_ is you are setting a pinmux, disconnecting the pins from the GPIO controller and connecting them to the LED controller.Possibly. This code is copied from the out-of-tree vendor driver. We already have similar code and comment in the en8811h probe: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/tree/drivers/net/phy/air_en8811h.c#n959 The register addresses and layouts are suspiciously similar: #define EN8811H_GPIO_OUTPUT 0xcf8b8 #define EN8811H_GPIO_OUTPUT_345 (BIT(3) | BIT(4) | BIT(5)) Without any docs, or a way to test this particular feature, I believe the safest option is to assume that the vendor driver is correct. Can't start guessing no matter how tempting it is :-)The writing of the value to the register is likely correct. I just think all the names and comments are wrong. Maybe using magic numbers in this case is actually better?
I agree that it would probably be just as good here. But I really don't want to make unnecessary changes to the existing EN8811H code. Trying hard to modify as little as possible of that in this series. And I believe it's always best to keep the style of similar code blocks inside as single file/driver. So unless this is important, I'd prefer to keep the macros and comment. It is what we have had so far for EN8811H.
And describe the intent of the code in more general terms, allow the pins to be used to driver LEDs.quoted
I have no other docs either. The code is based solely on the vendor driver. But trying to reuse as much as possible of the existing en8811h driver instead of duplicating it like the vendor did.That is typical of vendors, and i agree with your strategy,.quoted
I have two almost identical boards with this phy connected to a Mediatek MT7988D SoC. I can test, and have tested, the features exposed by those boards. But this is obviously a limited test environment. There are for example no port LEDs on any of the boards.So you have no idea if the LEDs actualy blink with traffic, show link state etc?
Correct. I can only test that this code doesn't cause any obvious harm to other functions. The options, as I see them, are either a) dropping this functionality from the driver until someone is able to test and adds it back, or b) keep it in the hope that it works, until someone is able to test and either verifies or fixes the code. Including fixups of the macros and comment if/when we get docs I believe that b) is more likely to succeed, which is why I chose to include it. Bjørn