diff mbox series

[net-next,v2,3/6] net: phy: microchip_t1s: update LAN867x PHY supported revision number

Message ID 20230522113331.36872-4-Parthiban.Veerasooran@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series microchip_t1s: Update on Microchip 10BASE-T1S PHY driver | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
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: 8 this patch: 8
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
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 success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 81 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Parthiban Veerasooran May 22, 2023, 11:33 a.m. UTC
As per AN1699, the initial configuration in the driver applies to LAN867x
Rev.B1 hardware revision.

Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
---
 drivers/net/phy/microchip_t1s.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Andrew Lunn May 22, 2023, 12:38 p.m. UTC | #1
> -#define PHY_ID_LAN867X 0x0007C160
> +#define PHY_ID_LAN867X_REVB1 0x0007C162

>  static struct phy_driver microchip_t1s_driver[] = {
>  	{
> -		PHY_ID_MATCH_MODEL(PHY_ID_LAN867X),
> -		.name               = "LAN867X",
> +		PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),
> +		.name               = "LAN867X Rev.B1",
>  		.features           = PHY_BASIC_T1S_P2MP_FEATURES,
> -		.config_init        = lan867x_config_init,
> +		.config_init        = lan867x_revb1_config_init,
>  		.read_status        = lan867x_read_status,
>  		.get_plca_cfg	    = genphy_c45_plca_get_cfg,
>  		.set_plca_cfg	    = genphy_c45_plca_set_cfg,
> @@ -124,7 +124,7 @@ static struct phy_driver microchip_t1s_driver[] = {
>  module_phy_driver(microchip_t1s_driver);
>  
>  static struct mdio_device_id __maybe_unused tbl[] = {
> -	{ PHY_ID_MATCH_MODEL(PHY_ID_LAN867X) },
> +	{ PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1) },
>  	{ }
>  };

Maybe i asked this last time...

What versions actually exist? The old entry would match 0x0007C16X, so
0x0007C160 and 0x0007C161, 0x0007C162, if those actually exist. Now
you are narrowing it down to just 0x0007C162.

It would be good to comment on this in the commit message, that
0x0007C160 and 0x0007C161 never escaped the testing facility and hence
don't need to be supported.

	Andrew
Parthiban Veerasooran May 23, 2023, 6:25 a.m. UTC | #2
Hi Andrew,

On 22/05/23 6:08 pm, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
>> -#define PHY_ID_LAN867X 0x0007C160
>> +#define PHY_ID_LAN867X_REVB1 0x0007C162
> 
>>   static struct phy_driver microchip_t1s_driver[] = {
>>        {
>> -             PHY_ID_MATCH_MODEL(PHY_ID_LAN867X),
>> -             .name               = "LAN867X",
>> +             PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),
>> +             .name               = "LAN867X Rev.B1",
>>                .features           = PHY_BASIC_T1S_P2MP_FEATURES,
>> -             .config_init        = lan867x_config_init,
>> +             .config_init        = lan867x_revb1_config_init,
>>                .read_status        = lan867x_read_status,
>>                .get_plca_cfg       = genphy_c45_plca_get_cfg,
>>                .set_plca_cfg       = genphy_c45_plca_set_cfg,
>> @@ -124,7 +124,7 @@ static struct phy_driver microchip_t1s_driver[] = {
>>   module_phy_driver(microchip_t1s_driver);
>>
>>   static struct mdio_device_id __maybe_unused tbl[] = {
>> -     { PHY_ID_MATCH_MODEL(PHY_ID_LAN867X) },
>> +     { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1) },
>>        { }
>>   };
> 
> Maybe i asked this last time...
> 
> What versions actually exist? The old entry would match 0x0007C16X, so
> 0x0007C160 and 0x0007C161, 0x0007C162, if those actually exist. Now
> you are narrowing it down to just 0x0007C162.
> 
> It would be good to comment on this in the commit message, that
> 0x0007C160 and 0x0007C161 never escaped the testing facility and hence
> don't need to be supported.
Ah ok, I will do it in the next version.

Best Regards,
Parthiban V
> 
>          Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/microchip_t1s.c b/drivers/net/phy/microchip_t1s.c
index 534d9faf8475..869c7f403ea1 100644
--- a/drivers/net/phy/microchip_t1s.c
+++ b/drivers/net/phy/microchip_t1s.c
@@ -3,14 +3,14 @@ 
  * Driver for Microchip 10BASE-T1S PHYs
  *
  * Support: Microchip Phys:
- *  lan8670, lan8671, lan8672
+ *  lan8670/1/2 Rev.B1
  */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/phy.h>
 
-#define PHY_ID_LAN867X 0x0007C160
+#define PHY_ID_LAN867X_REVB1 0x0007C162
 
 #define LAN867X_REG_IRQ_1_CTL 0x001C
 #define LAN867X_REG_IRQ_2_CTL 0x001D
@@ -31,25 +31,25 @@ 
  * W   0x1F 0x0099 0x7F80 ------
  */
 
-static const u32 lan867x_fixup_registers[12] = {
+static const u32 lan867x_revb1_fixup_registers[12] = {
 	0x00D0, 0x00D1, 0x0084, 0x0085,
 	0x008A, 0x0087, 0x0088, 0x008B,
 	0x0080, 0x00F1, 0x0096, 0x0099,
 };
 
-static const u16 lan867x_fixup_values[12] = {
+static const u16 lan867x_revb1_fixup_values[12] = {
 	0x0002, 0x0000, 0x3380, 0x0006,
 	0xC000, 0x801C, 0x033F, 0x0404,
 	0x0600, 0x2400, 0x2000, 0x7F80,
 };
 
-static const u16 lan867x_fixup_masks[12] = {
+static const u16 lan867x_revb1_fixup_masks[12] = {
 	0x0E03, 0x0300, 0xFFC0, 0x000F,
 	0xF800, 0x801C, 0x1FFF, 0xFFFF,
 	0x0600, 0x7F00, 0x2000, 0xFFFF,
 };
 
-static int lan867x_config_init(struct phy_device *phydev)
+static int lan867x_revb1_config_init(struct phy_device *phydev)
 {
 	/* HW quirk: Microchip states in the application note (AN1699) for the phy
 	 * that a set of read-modify-write (rmw) operations has to be performed
@@ -71,11 +71,11 @@  static int lan867x_config_init(struct phy_device *phydev)
 	 * new_val = new_val OR value // Set bits
 	 * write_register(mmd, addr, new_val) // Write back updated register value
 	 */
-	for (int i = 0; i < ARRAY_SIZE(lan867x_fixup_registers); i++) {
+	for (int i = 0; i < ARRAY_SIZE(lan867x_revb1_fixup_registers); i++) {
 		err = phy_modify_mmd(phydev, MDIO_MMD_VEND2,
-				     lan867x_fixup_registers[i],
-				     lan867x_fixup_masks[i],
-				     lan867x_fixup_values[i]);
+				     lan867x_revb1_fixup_registers[i],
+				     lan867x_revb1_fixup_masks[i],
+				     lan867x_revb1_fixup_values[i]);
 		if (err)
 			return err;
 	}
@@ -110,10 +110,10 @@  static int lan867x_read_status(struct phy_device *phydev)
 
 static struct phy_driver microchip_t1s_driver[] = {
 	{
-		PHY_ID_MATCH_MODEL(PHY_ID_LAN867X),
-		.name               = "LAN867X",
+		PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),
+		.name               = "LAN867X Rev.B1",
 		.features           = PHY_BASIC_T1S_P2MP_FEATURES,
-		.config_init        = lan867x_config_init,
+		.config_init        = lan867x_revb1_config_init,
 		.read_status        = lan867x_read_status,
 		.get_plca_cfg	    = genphy_c45_plca_get_cfg,
 		.set_plca_cfg	    = genphy_c45_plca_set_cfg,
@@ -124,7 +124,7 @@  static struct phy_driver microchip_t1s_driver[] = {
 module_phy_driver(microchip_t1s_driver);
 
 static struct mdio_device_id __maybe_unused tbl[] = {
-	{ PHY_ID_MATCH_MODEL(PHY_ID_LAN867X) },
+	{ PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1) },
 	{ }
 };