2019-10-01 06:10:13

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v2 0/3] net: phy: at803x: add ar9331 support

changes v2:
- use PHY_ID_MATCH_EXACT instead of leaky masking
- remove probe and struct at803x_priv

Oleksij Rempel (3):
net: phy: at803x: use PHY_ID_MATCH_EXACT for IDs
net: phy: at803x: add ar9331 support
net: phy: at803x: remove probe and struct at803x_priv

drivers/net/phy/at803x.c | 45 ++++++++++++++--------------------------
1 file changed, 15 insertions(+), 30 deletions(-)

--
2.23.0


2019-10-01 06:11:43

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v2 1/3] net: phy: at803x: use PHY_ID_MATCH_EXACT for IDs

Use exact match for all IDs. We have no sanity checks, so we can peek
a device with no exact ID and different register layout.

Suggested-by: Heiner Kallweit <[email protected]>
Signed-off-by: Oleksij Rempel <[email protected]>
---
drivers/net/phy/at803x.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 6ad8b1c63c34..7895dbe600ac 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -364,9 +364,8 @@ static int at803x_aneg_done(struct phy_device *phydev)
static struct phy_driver at803x_driver[] = {
{
/* ATHEROS 8035 */
- .phy_id = ATH8035_PHY_ID,
+ PHY_ID_MATCH_EXACT(ATH8035_PHY_ID),
.name = "Atheros 8035 ethernet",
- .phy_id_mask = AT803X_PHY_ID_MASK,
.probe = at803x_probe,
.config_init = at803x_config_init,
.set_wol = at803x_set_wol,
@@ -378,9 +377,8 @@ static struct phy_driver at803x_driver[] = {
.config_intr = at803x_config_intr,
}, {
/* ATHEROS 8030 */
- .phy_id = ATH8030_PHY_ID,
+ PHY_ID_MATCH_EXACT(ATH8030_PHY_ID),
.name = "Atheros 8030 ethernet",
- .phy_id_mask = AT803X_PHY_ID_MASK,
.probe = at803x_probe,
.config_init = at803x_config_init,
.link_change_notify = at803x_link_change_notify,
@@ -393,9 +391,8 @@ static struct phy_driver at803x_driver[] = {
.config_intr = at803x_config_intr,
}, {
/* ATHEROS 8031 */
- .phy_id = ATH8031_PHY_ID,
+ PHY_ID_MATCH_EXACT(ATH8031_PHY_ID),
.name = "Atheros 8031 ethernet",
- .phy_id_mask = AT803X_PHY_ID_MASK,
.probe = at803x_probe,
.config_init = at803x_config_init,
.set_wol = at803x_set_wol,
@@ -411,9 +408,7 @@ static struct phy_driver at803x_driver[] = {
module_phy_driver(at803x_driver);

static struct mdio_device_id __maybe_unused atheros_tbl[] = {
- { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
- { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
- { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
+ { PHY_ID_MATCH_VENDOR(ATH8030_PHY_ID) },
{ }
};

--
2.23.0

2019-10-01 18:42:31

by Heiner Kallweit

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] net: phy: at803x: use PHY_ID_MATCH_EXACT for IDs

On 01.10.2019 08:08, Oleksij Rempel wrote:
> Use exact match for all IDs. We have no sanity checks, so we can peek
> a device with no exact ID and different register layout.
>

I think it would be better to use PHY_ID_MATCH_EXACT for the newly
added AR9331 only. The mask 0xffffffef for the other Atheros PHY's
may be there for a reason. In this case other PHY's matching the
mask would be silently switched to the genphy driver and may
misbehave.

> Suggested-by: Heiner Kallweit <[email protected]>
> Signed-off-by: Oleksij Rempel <[email protected]>
> ---
> drivers/net/phy/at803x.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 6ad8b1c63c34..7895dbe600ac 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -364,9 +364,8 @@ static int at803x_aneg_done(struct phy_device *phydev)
> static struct phy_driver at803x_driver[] = {
> {
> /* ATHEROS 8035 */
> - .phy_id = ATH8035_PHY_ID,
> + PHY_ID_MATCH_EXACT(ATH8035_PHY_ID),
> .name = "Atheros 8035 ethernet",
> - .phy_id_mask = AT803X_PHY_ID_MASK,
> .probe = at803x_probe,
> .config_init = at803x_config_init,
> .set_wol = at803x_set_wol,
> @@ -378,9 +377,8 @@ static struct phy_driver at803x_driver[] = {
> .config_intr = at803x_config_intr,
> }, {
> /* ATHEROS 8030 */
> - .phy_id = ATH8030_PHY_ID,
> + PHY_ID_MATCH_EXACT(ATH8030_PHY_ID),
> .name = "Atheros 8030 ethernet",
> - .phy_id_mask = AT803X_PHY_ID_MASK,
> .probe = at803x_probe,
> .config_init = at803x_config_init,
> .link_change_notify = at803x_link_change_notify,
> @@ -393,9 +391,8 @@ static struct phy_driver at803x_driver[] = {
> .config_intr = at803x_config_intr,
> }, {
> /* ATHEROS 8031 */
> - .phy_id = ATH8031_PHY_ID,
> + PHY_ID_MATCH_EXACT(ATH8031_PHY_ID),
> .name = "Atheros 8031 ethernet",
> - .phy_id_mask = AT803X_PHY_ID_MASK,
> .probe = at803x_probe,
> .config_init = at803x_config_init,
> .set_wol = at803x_set_wol,
> @@ -411,9 +408,7 @@ static struct phy_driver at803x_driver[] = {
> module_phy_driver(at803x_driver);
>
> static struct mdio_device_id __maybe_unused atheros_tbl[] = {
> - { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
> - { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
> - { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
> + { PHY_ID_MATCH_VENDOR(ATH8030_PHY_ID) },
> { }
> };
>
>