netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] net: phy: at803x: add ar9331 support
@ 2019-09-30  9:27 Oleksij Rempel
  2019-09-30 13:20 ` Andrew Lunn
  2019-09-30 18:19 ` Heiner Kallweit
  0 siblings, 2 replies; 4+ messages in thread
From: Oleksij Rempel @ 2019-09-30  9:27 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit
  Cc: Oleksij Rempel, Pengutronix Kernel Team, David S. Miller, netdev,
	linux-kernel

Mostly this hardware can work with generic PHY driver, but this change
is needed to provided interrupt handling support.
Tested with dsa ar9331-switch driver.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/at803x.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 6ad8b1c63c34..d62a77adb8e7 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -53,6 +53,7 @@
 #define AT803X_DEBUG_REG_5			0x05
 #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
 
+#define AR9331_PHY_ID 0x004dd041
 #define ATH8030_PHY_ID 0x004dd076
 #define ATH8031_PHY_ID 0x004dd074
 #define ATH8035_PHY_ID 0x004dd072
@@ -406,11 +407,24 @@ static struct phy_driver at803x_driver[] = {
 	.aneg_done		= at803x_aneg_done,
 	.ack_interrupt		= &at803x_ack_interrupt,
 	.config_intr		= &at803x_config_intr,
+}, {
+	/* ATHEROS AR9331 */
+	.phy_id			= AR9331_PHY_ID,
+	.name			= "Atheros AR9331 built-in PHY",
+	.phy_id_mask		= AT803X_PHY_ID_MASK,
+	.probe			= at803x_probe,
+	.config_init		= at803x_config_init,
+	.suspend		= at803x_suspend,
+	.resume			= at803x_resume,
+	/* PHY_BASIC_FEATURES */
+	.ack_interrupt		= &at803x_ack_interrupt,
+	.config_intr		= &at803x_config_intr,
 } };
 
 module_phy_driver(at803x_driver);
 
 static struct mdio_device_id __maybe_unused atheros_tbl[] = {
+	{ AR9331_PHY_ID, AT803X_PHY_ID_MASK },
 	{ ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
 	{ ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
 	{ ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
-- 
2.23.0


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

* Re: [PATCH v1] net: phy: at803x: add ar9331 support
  2019-09-30  9:27 [PATCH v1] net: phy: at803x: add ar9331 support Oleksij Rempel
@ 2019-09-30 13:20 ` Andrew Lunn
  2019-09-30 14:18   ` Oleksij Rempel
  2019-09-30 18:19 ` Heiner Kallweit
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2019-09-30 13:20 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Florian Fainelli, Heiner Kallweit, Pengutronix Kernel Team,
	David S. Miller, netdev, linux-kernel

On Mon, Sep 30, 2019 at 11:27:10AM +0200, Oleksij Rempel wrote:
> Mostly this hardware can work with generic PHY driver, but this change
> is needed to provided interrupt handling support.
> Tested with dsa ar9331-switch driver.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/phy/at803x.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 6ad8b1c63c34..d62a77adb8e7 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -53,6 +53,7 @@
>  #define AT803X_DEBUG_REG_5			0x05
>  #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
>  
> +#define AR9331_PHY_ID 0x004dd041
>  #define ATH8030_PHY_ID 0x004dd076
>  #define ATH8031_PHY_ID 0x004dd074
>  #define ATH8035_PHY_ID 0x004dd072

Hi Oleksij

I wonder if we should call this ATH9331_PHY_ID, to keep with the
naming convention? Why did you choose AR, not ATH?

Thanks
	Andrew

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

* Re: [PATCH v1] net: phy: at803x: add ar9331 support
  2019-09-30 13:20 ` Andrew Lunn
@ 2019-09-30 14:18   ` Oleksij Rempel
  0 siblings, 0 replies; 4+ messages in thread
From: Oleksij Rempel @ 2019-09-30 14:18 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Florian Fainelli, netdev, linux-kernel, Pengutronix Kernel Team,
	David S. Miller, Heiner Kallweit

On Mon, Sep 30, 2019 at 03:20:41PM +0200, Andrew Lunn wrote:
> On Mon, Sep 30, 2019 at 11:27:10AM +0200, Oleksij Rempel wrote:
> > Mostly this hardware can work with generic PHY driver, but this change
> > is needed to provided interrupt handling support.
> > Tested with dsa ar9331-switch driver.
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> >  drivers/net/phy/at803x.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> > index 6ad8b1c63c34..d62a77adb8e7 100644
> > --- a/drivers/net/phy/at803x.c
> > +++ b/drivers/net/phy/at803x.c
> > @@ -53,6 +53,7 @@
> >  #define AT803X_DEBUG_REG_5			0x05
> >  #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
> >  
> > +#define AR9331_PHY_ID 0x004dd041
> >  #define ATH8030_PHY_ID 0x004dd076
> >  #define ATH8031_PHY_ID 0x004dd074
> >  #define ATH8035_PHY_ID 0x004dd072
> 
> Hi Oleksij
> 
> I wonder if we should call this ATH9331_PHY_ID, to keep with the
> naming convention? Why did you choose AR, not ATH?

Hi Andrew,

i have no strong opinion here. Taking what ever name was on the SoC
package, was safe enough for me. If you say, it should be ATH9331, i'll
rename it. Should i?

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH v1] net: phy: at803x: add ar9331 support
  2019-09-30  9:27 [PATCH v1] net: phy: at803x: add ar9331 support Oleksij Rempel
  2019-09-30 13:20 ` Andrew Lunn
@ 2019-09-30 18:19 ` Heiner Kallweit
  1 sibling, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2019-09-30 18:19 UTC (permalink / raw)
  To: Oleksij Rempel, Andrew Lunn, Florian Fainelli
  Cc: Pengutronix Kernel Team, David S. Miller, netdev, linux-kernel

On 30.09.2019 11:27, Oleksij Rempel wrote:
> Mostly this hardware can work with generic PHY driver, but this change
> is needed to provided interrupt handling support.
> Tested with dsa ar9331-switch driver.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/phy/at803x.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 6ad8b1c63c34..d62a77adb8e7 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -53,6 +53,7 @@
>  #define AT803X_DEBUG_REG_5			0x05
>  #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
>  
> +#define AR9331_PHY_ID 0x004dd041
>  #define ATH8030_PHY_ID 0x004dd076
>  #define ATH8031_PHY_ID 0x004dd074
>  #define ATH8035_PHY_ID 0x004dd072
> @@ -406,11 +407,24 @@ static struct phy_driver at803x_driver[] = {
>  	.aneg_done		= at803x_aneg_done,
>  	.ack_interrupt		= &at803x_ack_interrupt,
>  	.config_intr		= &at803x_config_intr,
> +}, {
> +	/* ATHEROS AR9331 */
> +	.phy_id			= AR9331_PHY_ID,
> +	.name			= "Atheros AR9331 built-in PHY",
> +	.phy_id_mask		= AT803X_PHY_ID_MASK,

The ID mask of 0xffffffef is quite strange, it ignores the last
bit of the model number and requires exact match of the revision
number. Unfortunately the original commit doesn't explain why
this mask was chosen. It would only make sense if there are
functionally identical PHY's with e.g. id 0x004dd051.
If in doubt I'd suggest you use macro PHY_ID_MATCH_EXACT.

> +	.probe			= at803x_probe,

After 5c5f626bcace ("net: phy: improve handling link_change_notify
callback") struct at803x_priv isn't used any longer and the probe
callback could be removed. I didn't do that as part of this commit
because I could compile-test the change only.

> +	.config_init		= at803x_config_init,
> +	.suspend		= at803x_suspend,
> +	.resume			= at803x_resume,
> +	/* PHY_BASIC_FEATURES */
> +	.ack_interrupt		= &at803x_ack_interrupt,
> +	.config_intr		= &at803x_config_intr,
>  } };
>  
>  module_phy_driver(at803x_driver);
>  
>  static struct mdio_device_id __maybe_unused atheros_tbl[] = {
> +	{ AR9331_PHY_ID, AT803X_PHY_ID_MASK },

See comment above regarding the id mask.

>  	{ ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
>  	{ ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
>  	{ ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
> 
Heiner

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

end of thread, other threads:[~2019-09-30 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-30  9:27 [PATCH v1] net: phy: at803x: add ar9331 support Oleksij Rempel
2019-09-30 13:20 ` Andrew Lunn
2019-09-30 14:18   ` Oleksij Rempel
2019-09-30 18:19 ` Heiner Kallweit

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