* [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG
@ 2025-02-14 20:31 Heiner Kallweit
2025-02-16 16:10 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Heiner Kallweit @ 2025-02-14 20:31 UTC (permalink / raw)
To: Andrew Lunn, Russell King - ARM Linux, Jakub Kicinski,
Paolo Abeni, Eric Dumazet, David Miller
Cc: netdev@vger.kernel.org
C22 register space is mapped to 0xa400 in MMD VEND2 register space.
Add a helper to access mapped C22 registers.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/realtek/realtek_main.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index e137e9942..566261f42 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -79,9 +79,7 @@
/* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45
* is set, they cannot be accessed by C45-over-C22.
*/
-#define RTL822X_VND2_GBCR 0xa412
-
-#define RTL822X_VND2_GANLPAR 0xa414
+#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))
#define RTL8366RB_POWER_SAVE 0x15
#define RTL8366RB_POWER_SAVE_ON BIT(12)
@@ -1026,7 +1024,8 @@ static int rtl822x_c45_config_aneg(struct phy_device *phydev)
val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising);
/* Vendor register as C45 has no standardized support for 1000BaseT */
- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR,
+ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2,
+ RTL822X_VND2_C22_REG(MII_CTRL1000),
ADVERTISE_1000FULL, val);
if (ret < 0)
return ret;
@@ -1043,7 +1042,7 @@ static int rtl822x_c45_read_status(struct phy_device *phydev)
/* Vendor register as C45 has no standardized support for 1000BaseT */
if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
- RTL822X_VND2_GANLPAR);
+ RTL822X_VND2_C22_REG(MII_STAT1000));
if (val < 0)
return val;
} else {
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG
2025-02-14 20:31 [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG Heiner Kallweit
@ 2025-02-16 16:10 ` Andrew Lunn
2025-02-18 0:44 ` Jakub Kicinski
2025-02-20 11:04 ` Simon Horman
2 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2025-02-16 16:10 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Russell King - ARM Linux, Jakub Kicinski, Paolo Abeni,
Eric Dumazet, David Miller, netdev@vger.kernel.org
On Fri, Feb 14, 2025 at 09:31:14PM +0100, Heiner Kallweit wrote:
> C22 register space is mapped to 0xa400 in MMD VEND2 register space.
> Add a helper to access mapped C22 registers.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG
2025-02-14 20:31 [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG Heiner Kallweit
2025-02-16 16:10 ` Andrew Lunn
@ 2025-02-18 0:44 ` Jakub Kicinski
2025-02-18 6:33 ` Heiner Kallweit
2025-02-20 11:04 ` Simon Horman
2 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2025-02-18 0:44 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Andrew Lunn, Russell King - ARM Linux, Paolo Abeni, Eric Dumazet,
David Miller, netdev@vger.kernel.org
On Fri, 14 Feb 2025 21:31:14 +0100 Heiner Kallweit wrote:
> -#define RTL822X_VND2_GANLPAR 0xa414
> +#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))
Just to double check - is the tab between define and RTL intentional?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG
2025-02-18 0:44 ` Jakub Kicinski
@ 2025-02-18 6:33 ` Heiner Kallweit
2025-02-18 14:42 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2025-02-18 6:33 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Andrew Lunn, Russell King - ARM Linux, Paolo Abeni, Eric Dumazet,
David Miller, netdev@vger.kernel.org
On 18.02.2025 01:44, Jakub Kicinski wrote:
> On Fri, 14 Feb 2025 21:31:14 +0100 Heiner Kallweit wrote:
>> -#define RTL822X_VND2_GANLPAR 0xa414
>> +#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))
>
> Just to double check - is the tab between define and RTL intentional?
Yes. In the terminal a space or a tab after #define are the same,
not sure whether there's any preference from your side.
At least checkpatch doesn't complain.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG
2025-02-18 6:33 ` Heiner Kallweit
@ 2025-02-18 14:42 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-02-18 14:42 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Andrew Lunn, Russell King - ARM Linux, Paolo Abeni, Eric Dumazet,
David Miller, netdev@vger.kernel.org
On Tue, 18 Feb 2025 07:33:32 +0100 Heiner Kallweit wrote:
> On 18.02.2025 01:44, Jakub Kicinski wrote:
> > On Fri, 14 Feb 2025 21:31:14 +0100 Heiner Kallweit wrote:
> >> -#define RTL822X_VND2_GANLPAR 0xa414
> >> +#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))
> >
> > Just to double check - is the tab between define and RTL intentional?
>
> Yes. In the terminal a space or a tab after #define are the same,
> not sure whether there's any preference from your side.
> At least checkpatch doesn't complain.
Weak preference for following what the rest of the file does,
so space would be better. I'll change when applying.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG
2025-02-14 20:31 [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG Heiner Kallweit
2025-02-16 16:10 ` Andrew Lunn
2025-02-18 0:44 ` Jakub Kicinski
@ 2025-02-20 11:04 ` Simon Horman
2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-02-20 11:04 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Andrew Lunn, Russell King - ARM Linux, Jakub Kicinski,
Paolo Abeni, Eric Dumazet, David Miller, netdev@vger.kernel.org
On Fri, Feb 14, 2025 at 09:31:14PM +0100, Heiner Kallweit wrote:
> C22 register space is mapped to 0xa400 in MMD VEND2 register space.
> Add a helper to access mapped C22 registers.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
FTR, this is now present in net-next as:
- net: phy: realtek: add helper RTL822X_VND2_C22_REG
https://git.kernel.org/netdev/net-next/c/8af2136e7798
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-20 11:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14 20:31 [PATCH net-next] net: phy: realtek: add helper RTL822X_VND2_C22_REG Heiner Kallweit
2025-02-16 16:10 ` Andrew Lunn
2025-02-18 0:44 ` Jakub Kicinski
2025-02-18 6:33 ` Heiner Kallweit
2025-02-18 14:42 ` Jakub Kicinski
2025-02-20 11:04 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).