diff mbox series

net: phy: realtek: add support for RTL8366S Gigabit PHY

Message ID 20240725170519.43401-1-mark@mentovai.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: phy: realtek: add support for RTL8366S Gigabit PHY | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 273 this patch: 273
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: andrew@lunn.ch; 6 maintainers not CCed: hkallweit1@gmail.com linux@armlinux.org.uk edumazet@google.com kuba@kernel.org andrew@lunn.ch pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 281 this patch: 281
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 281 this patch: 281
netdev/checkpatch warning WARNING: Unknown link reference 'Fixes:', use 'Link:' or 'Closes:' instead
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-07-25--18-00 (tests: 703)

Commit Message

Mark Mentovai July 25, 2024, 5:05 p.m. UTC
The PHY built in to the Realtek RTL8366S switch controller was
previously supported by genphy_driver. This PHY does not implement MMD
operations. Since 9b01c885be36 (2023-02-13, in 6.3), MMD register reads
have been made during phy_probe to determine EEE support. For
genphy_driver, these reads are transformed into 802.3 annex 22D clause
45-over-clause 22 mmd_phy_indirect operations that perform MII register
writes to MII_MMD_CTRL and MII_MMD_DATA. This overwrites those two MII
registers, which on this PHY are reserved and have another function,
rendering the PHY unusable while so configured.

Proper support for this PHY is restored by providing a phy_driver that
declares MMD operations as unsupported by using the helper functions
provided for that purpose, while remaining otherwise identical to
genphy_driver.

Fixes: 9b01c885be36 ("net: phy: c22: migrate to genphy_c45_write_eee_adv()")
Fixes: https://github.com/openwrt/openwrt/issues/15981
Link: https://github.com/openwrt/openwrt/issues/15739
Reported-by: Russell Senior <russell@personaltelco.net>
Signed-off-by: Mark Mentovai <mark@mentovai.com>
---
 drivers/net/phy/realtek.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Simon Horman July 25, 2024, 8:01 p.m. UTC | #1
On Thu, Jul 25, 2024 at 01:05:19PM -0400, Mark Mentovai wrote:
> The PHY built in to the Realtek RTL8366S switch controller was
> previously supported by genphy_driver. This PHY does not implement MMD
> operations. Since 9b01c885be36 (2023-02-13, in 6.3), MMD register reads
> have been made during phy_probe to determine EEE support. For
> genphy_driver, these reads are transformed into 802.3 annex 22D clause
> 45-over-clause 22 mmd_phy_indirect operations that perform MII register
> writes to MII_MMD_CTRL and MII_MMD_DATA. This overwrites those two MII
> registers, which on this PHY are reserved and have another function,
> rendering the PHY unusable while so configured.
> 
> Proper support for this PHY is restored by providing a phy_driver that
> declares MMD operations as unsupported by using the helper functions
> provided for that purpose, while remaining otherwise identical to
> genphy_driver.
> 
> Fixes: 9b01c885be36 ("net: phy: c22: migrate to genphy_c45_write_eee_adv()")
> Fixes: https://github.com/openwrt/openwrt/issues/15981

nit: AFAIK, the line immediately above is not a correct use of the Fixes
     tag. I think Link or Closes would be appropriate instead.

> Link: https://github.com/openwrt/openwrt/issues/15739
> Reported-by: Russell Senior <russell@personaltelco.net>
> Signed-off-by: Mark Mentovai <mark@mentovai.com>

Also, as a fix, this should be targeted at the net tree.

	Subject: [PATCH net] ...

Please see https://docs.kernel.org/process/maintainer-netdev.html
Mark Mentovai July 25, 2024, 8:47 p.m. UTC | #2
Simon Horman wrote:
> On Thu, Jul 25, 2024 at 01:05:19PM -0400, Mark Mentovai wrote:
>> The PHY built in to the Realtek RTL8366S switch controller was
>> previously supported by genphy_driver. This PHY does not implement MMD
>> operations. Since 9b01c885be36 (2023-02-13, in 6.3), MMD register reads
>> have been made during phy_probe to determine EEE support. For
>> genphy_driver, these reads are transformed into 802.3 annex 22D clause
>> 45-over-clause 22 mmd_phy_indirect operations that perform MII register
>> writes to MII_MMD_CTRL and MII_MMD_DATA. This overwrites those two MII
>> registers, which on this PHY are reserved and have another function,
>> rendering the PHY unusable while so configured.
>>
>> Proper support for this PHY is restored by providing a phy_driver that
>> declares MMD operations as unsupported by using the helper functions
>> provided for that purpose, while remaining otherwise identical to
>> genphy_driver.
>>
>> Fixes: 9b01c885be36 ("net: phy: c22: migrate to genphy_c45_write_eee_adv()")
>> Fixes: https://github.com/openwrt/openwrt/issues/15981
>
> nit: AFAIK, the line immediately above is not a correct use of the Fixes
>     tag. I think Link or Closes would be appropriate instead.
>
>> Link: https://github.com/openwrt/openwrt/issues/15739
>> Reported-by: Russell Senior <russell@personaltelco.net>
>> Signed-off-by: Mark Mentovai <mark@mentovai.com>
>
> Also, as a fix, this should be targeted at the net tree.
>
> 	Subject: [PATCH net] ...
>
> Please see https://docs.kernel.org/process/maintainer-netdev.html

Thanks for your feedback, Simon. I've sent an updated (v2) patch, now at 
https://lore.kernel.org/netdev/20240725204147.69730-1-mark@mentovai.com/.
diff mbox series

Patch

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index bed839237fb5..87865918dab6 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -1465,6 +1465,13 @@  static struct phy_driver realtek_drvs[] = {
 		.handle_interrupt = genphy_handle_interrupt_no_ack,
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
+	}, {
+		PHY_ID_MATCH_EXACT(0x001cc960),
+		.name		= "RTL8366S Gigabit Ethernet",
+		.suspend	= genphy_suspend,
+		.resume		= genphy_resume,
+		.read_mmd	= genphy_read_mmd_unsupported,
+		.write_mmd	= genphy_write_mmd_unsupported,
 	},
 };