linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: Add DP83825I to the DP83822 driver
@ 2019-03-19 18:32 Dan Murphy
  2019-03-19 18:55 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Murphy @ 2019-03-19 18:32 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: hkallweit1, davem, netdev, linux-kernel, Dan Murphy

Add the DP83825I ethernet PHY to the DP83822 driver.
These devices share the same WoL register bits and addresses.

The phy_driver init was made into a macro as there may be future
devices appended to this driver that will share the register space.

http://www.ti.com/lit/gpn/dp83825i

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/net/phy/dp83822.c | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index bbd8c22067f3..02dc05b86326 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -15,6 +15,8 @@
 #include <linux/netdevice.h>
 
 #define DP83822_PHY_ID	        0x2000a240
+#define DP83825I_PHY_ID		0x2000a150
+
 #define DP83822_DEVADDR		0x1f
 
 #define MII_DP83822_PHYSCR	0x11
@@ -304,26 +306,32 @@ static int dp83822_resume(struct phy_device *phydev)
 	return 0;
 }
 
+#define DP83822_PHY_DRIVER(_id, _name)				\
+	{							\
+		.phy_id		= _id,				\
+		.phy_id_mask	= 0xfffffff0,			\
+		.name		= _name,			\
+		.features	= PHY_BASIC_FEATURES,		\
+								\
+		.soft_reset	= dp83822_phy_reset,		\
+		.config_init	= dp83822_config_init,		\
+		.get_wol = dp83822_get_wol,			\
+		.set_wol = dp83822_set_wol,			\
+		.ack_interrupt = dp83822_ack_interrupt,		\
+		.config_intr = dp83822_config_intr,		\
+		.suspend = dp83822_suspend,			\
+		.resume = dp83822_resume,			\
+	}
+
 static struct phy_driver dp83822_driver[] = {
-	{
-		.phy_id = DP83822_PHY_ID,
-		.phy_id_mask = 0xfffffff0,
-		.name = "TI DP83822",
-		.features = PHY_BASIC_FEATURES,
-		.config_init = dp83822_config_init,
-		.soft_reset = dp83822_phy_reset,
-		.get_wol = dp83822_get_wol,
-		.set_wol = dp83822_set_wol,
-		.ack_interrupt = dp83822_ack_interrupt,
-		.config_intr = dp83822_config_intr,
-		.suspend = dp83822_suspend,
-		.resume = dp83822_resume,
-	 },
+	DP83822_PHY_DRIVER(DP83822_PHY_ID, "TI DP83822"),
+	DP83822_PHY_DRIVER(DP83825I_PHY_ID, "TI DP83825I"),
 };
 module_phy_driver(dp83822_driver);
 
 static struct mdio_device_id __maybe_unused dp83822_tbl[] = {
 	{ DP83822_PHY_ID, 0xfffffff0 },
+	{ DP83825I_PHY_ID, 0xfffffff0 },
 	{ },
 };
 MODULE_DEVICE_TABLE(mdio, dp83822_tbl);
-- 
2.20.1.390.gb5101f9297


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: Add DP83825I to the DP83822 driver
  2019-03-19 18:32 [PATCH] net: phy: Add DP83825I to the DP83822 driver Dan Murphy
@ 2019-03-19 18:55 ` Florian Fainelli
  2019-03-19 19:53   ` Dan Murphy
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2019-03-19 18:55 UTC (permalink / raw)
  To: Dan Murphy, andrew; +Cc: hkallweit1, davem, netdev, linux-kernel

On 3/19/19 11:32 AM, Dan Murphy wrote:
> Add the DP83825I ethernet PHY to the DP83822 driver.
> These devices share the same WoL register bits and addresses.
> 
> The phy_driver init was made into a macro as there may be future
> devices appended to this driver that will share the register space.
> 
> http://www.ti.com/lit/gpn/dp83825i
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Looks good, just a few nitpits below:

> ---
>  drivers/net/phy/dp83822.c | 36 ++++++++++++++++++++++--------------
>  1 file changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> index bbd8c22067f3..02dc05b86326 100644
> --- a/drivers/net/phy/dp83822.c
> +++ b/drivers/net/phy/dp83822.c
> @@ -15,6 +15,8 @@
>  #include <linux/netdevice.h>
>  
>  #define DP83822_PHY_ID	        0x2000a240
> +#define DP83825I_PHY_ID		0x2000a150
> +
>  #define DP83822_DEVADDR		0x1f
>  
>  #define MII_DP83822_PHYSCR	0x11
> @@ -304,26 +306,32 @@ static int dp83822_resume(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +#define DP83822_PHY_DRIVER(_id, _name)				\
> +	{							\
> +		.phy_id		= _id,				\

I would put the _id argument between parenthesis to guarantee evaluation
order in case you need to do smart things about the ID in the future.

> +		.phy_id_mask	= 0xfffffff0,			\

You can replace those two lines with PHY_ID_MATCH_MODEL()

> +		.name		= _name,			\

Likewise

> +		.features	= PHY_BASIC_FEATURES,		\
> +								\

Looks like you have an extra newline here.

With that fixed:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> +		.soft_reset	= dp83822_phy_reset,		\
> +		.config_init	= dp83822_config_init,		\
> +		.get_wol = dp83822_get_wol,			\
> +		.set_wol = dp83822_set_wol,			\
> +		.ack_interrupt = dp83822_ack_interrupt,		\
> +		.config_intr = dp83822_config_intr,		\
> +		.suspend = dp83822_suspend,			\
> +		.resume = dp83822_resume,			\
> +	}
> +
>  static struct phy_driver dp83822_driver[] = {
> -	{
> -		.phy_id = DP83822_PHY_ID,
> -		.phy_id_mask = 0xfffffff0,
> -		.name = "TI DP83822",
> -		.features = PHY_BASIC_FEATURES,
> -		.config_init = dp83822_config_init,
> -		.soft_reset = dp83822_phy_reset,
> -		.get_wol = dp83822_get_wol,
> -		.set_wol = dp83822_set_wol,
> -		.ack_interrupt = dp83822_ack_interrupt,
> -		.config_intr = dp83822_config_intr,
> -		.suspend = dp83822_suspend,
> -		.resume = dp83822_resume,
> -	 },
> +	DP83822_PHY_DRIVER(DP83822_PHY_ID, "TI DP83822"),
> +	DP83822_PHY_DRIVER(DP83825I_PHY_ID, "TI DP83825I"),
>  };
>  module_phy_driver(dp83822_driver);
>  
>  static struct mdio_device_id __maybe_unused dp83822_tbl[] = {
>  	{ DP83822_PHY_ID, 0xfffffff0 },
> +	{ DP83825I_PHY_ID, 0xfffffff0 },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(mdio, dp83822_tbl);
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: Add DP83825I to the DP83822 driver
  2019-03-19 18:55 ` Florian Fainelli
@ 2019-03-19 19:53   ` Dan Murphy
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Murphy @ 2019-03-19 19:53 UTC (permalink / raw)
  To: Florian Fainelli, andrew; +Cc: hkallweit1, davem, netdev, linux-kernel

Florian

Thanks for the quick review

On 3/19/19 1:55 PM, Florian Fainelli wrote:
> On 3/19/19 11:32 AM, Dan Murphy wrote:
>> Add the DP83825I ethernet PHY to the DP83822 driver.
>> These devices share the same WoL register bits and addresses.
>>
>> The phy_driver init was made into a macro as there may be future
>> devices appended to this driver that will share the register space.
>>
>> http://www.ti.com/lit/gpn/dp83825i
>>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> 
> Looks good, just a few nitpits below:
> 
>> ---
>>  drivers/net/phy/dp83822.c | 36 ++++++++++++++++++++++--------------
>>  1 file changed, 22 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
>> index bbd8c22067f3..02dc05b86326 100644
>> --- a/drivers/net/phy/dp83822.c
>> +++ b/drivers/net/phy/dp83822.c
>> @@ -15,6 +15,8 @@
>>  #include <linux/netdevice.h>
>>  
>>  #define DP83822_PHY_ID	        0x2000a240
>> +#define DP83825I_PHY_ID		0x2000a150
>> +
>>  #define DP83822_DEVADDR		0x1f
>>  
>>  #define MII_DP83822_PHYSCR	0x11
>> @@ -304,26 +306,32 @@ static int dp83822_resume(struct phy_device *phydev)
>>  	return 0;
>>  }
>>  
>> +#define DP83822_PHY_DRIVER(_id, _name)				\
>> +	{							\
>> +		.phy_id		= _id,				\
> 
> I would put the _id argument between parenthesis to guarantee evaluation
> order in case you need to do smart things about the ID in the future.
> 
>> +		.phy_id_mask	= 0xfffffff0,			\
> 
> You can replace those two lines with PHY_ID_MATCH_MODEL()
> 

Ack to both above. I will replace this with the macro.  I assume I don't have to wrap
_id in additional parenthesis when using the macro.

>> +		.name		= _name,			\
> 
> Likewise
> 

Ack to adding parenthesis around the _name

>> +		.features	= PHY_BASIC_FEATURES,		\
>> +								\
> 
> Looks like you have an extra newline here.
> 

Ack

> With that fixed:
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> 
>> +		.soft_reset	= dp83822_phy_reset,		\
>> +		.config_init	= dp83822_config_init,		\
>> +		.get_wol = dp83822_get_wol,			\
>> +		.set_wol = dp83822_set_wol,			\
>> +		.ack_interrupt = dp83822_ack_interrupt,		\
>> +		.config_intr = dp83822_config_intr,		\
>> +		.suspend = dp83822_suspend,			\
>> +		.resume = dp83822_resume,			\
>> +	}
>> +
>>  static struct phy_driver dp83822_driver[] = {
>> -	{
>> -		.phy_id = DP83822_PHY_ID,
>> -		.phy_id_mask = 0xfffffff0,
>> -		.name = "TI DP83822",
>> -		.features = PHY_BASIC_FEATURES,
>> -		.config_init = dp83822_config_init,
>> -		.soft_reset = dp83822_phy_reset,
>> -		.get_wol = dp83822_get_wol,
>> -		.set_wol = dp83822_set_wol,
>> -		.ack_interrupt = dp83822_ack_interrupt,
>> -		.config_intr = dp83822_config_intr,
>> -		.suspend = dp83822_suspend,
>> -		.resume = dp83822_resume,
>> -	 },
>> +	DP83822_PHY_DRIVER(DP83822_PHY_ID, "TI DP83822"),
>> +	DP83822_PHY_DRIVER(DP83825I_PHY_ID, "TI DP83825I"),
>>  };
>>  module_phy_driver(dp83822_driver);
>>  
>>  static struct mdio_device_id __maybe_unused dp83822_tbl[] = {
>>  	{ DP83822_PHY_ID, 0xfffffff0 },
>> +	{ DP83825I_PHY_ID, 0xfffffff0 },
>>  	{ },
>>  };
>>  MODULE_DEVICE_TABLE(mdio, dp83822_tbl);
>>
> 
> 


-- 
------------------
Dan Murphy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-19 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 18:32 [PATCH] net: phy: Add DP83825I to the DP83822 driver Dan Murphy
2019-03-19 18:55 ` Florian Fainelli
2019-03-19 19:53   ` Dan Murphy

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).