* [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
@ 2019-01-25 12:35 Carlo Caione
2019-01-25 15:00 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Carlo Caione @ 2019-01-25 12:35 UTC (permalink / raw)
To: andrew, f.fainelli, hkallweit1, davem, netdev, linux-kernel; +Cc: Carlo Caione
Libphy provides a standard set of helpers to access the MMD PHY
registers. Use those instead of relying on custom driver-specific
functions.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
drivers/net/phy/at803x.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index f9432d053a22..23ba76f8d950 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -39,9 +39,6 @@
#define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
#define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B
#define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A
-#define AT803X_MMD_ACCESS_CONTROL 0x0D
-#define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E
-#define AT803X_FUNC_DATA 0x4003
#define AT803X_REG_CHIP_CONFIG 0x1f
#define AT803X_BT_BX_REG_SEL 0x8000
@@ -168,16 +165,9 @@ static int at803x_set_wol(struct phy_device *phydev,
if (!is_valid_ether_addr(mac))
return -EINVAL;
- for (i = 0; i < 3; i++) {
- phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
- AT803X_DEVICE_ADDR);
- phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
- offsets[i]);
- phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
- AT803X_FUNC_DATA);
- phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
- mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
- }
+ for (i = 0; i < 3; i++)
+ phy_write_mmd(phydev, AT803X_DEVICE_ADDR, offsets[i],
+ mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
value = phy_read(phydev, AT803X_INTR_ENABLE);
value |= AT803X_INTR_ENABLE_WOL;
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
2019-01-25 12:35 [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers Carlo Caione
@ 2019-01-25 15:00 ` Andrew Lunn
2019-01-25 15:03 ` Carlo Caione
2019-01-25 18:11 ` Heiner Kallweit
2019-01-25 18:40 ` Florian Fainelli
2019-01-27 21:27 ` David Miller
2 siblings, 2 replies; 7+ messages in thread
From: Andrew Lunn @ 2019-01-25 15:00 UTC (permalink / raw)
To: Carlo Caione; +Cc: f.fainelli, hkallweit1, davem, netdev, linux-kernel
On Fri, Jan 25, 2019 at 12:35:10PM +0000, Carlo Caione wrote:
> Libphy provides a standard set of helpers to access the MMD PHY
> registers. Use those instead of relying on custom driver-specific
> functions.
Hi Carlo
Maybe deja vu, but i thought a similar patch went by recently?
Anyway,
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
> ---
> drivers/net/phy/at803x.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index f9432d053a22..23ba76f8d950 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -39,9 +39,6 @@
> #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
> #define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B
> #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A
> -#define AT803X_MMD_ACCESS_CONTROL 0x0D
> -#define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E
> -#define AT803X_FUNC_DATA 0x4003
> #define AT803X_REG_CHIP_CONFIG 0x1f
> #define AT803X_BT_BX_REG_SEL 0x8000
>
> @@ -168,16 +165,9 @@ static int at803x_set_wol(struct phy_device *phydev,
> if (!is_valid_ether_addr(mac))
> return -EINVAL;
>
> - for (i = 0; i < 3; i++) {
> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
> - AT803X_DEVICE_ADDR);
> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
> - offsets[i]);
> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
> - AT803X_FUNC_DATA);
> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
> - mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
> - }
> + for (i = 0; i < 3; i++)
> + phy_write_mmd(phydev, AT803X_DEVICE_ADDR, offsets[i],
> + mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
>
> value = phy_read(phydev, AT803X_INTR_ENABLE);
> value |= AT803X_INTR_ENABLE_WOL;
> --
> 2.19.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
2019-01-25 15:00 ` Andrew Lunn
@ 2019-01-25 15:03 ` Carlo Caione
2019-01-25 18:11 ` Heiner Kallweit
1 sibling, 0 replies; 7+ messages in thread
From: Carlo Caione @ 2019-01-25 15:03 UTC (permalink / raw)
To: Andrew Lunn; +Cc: f.fainelli, hkallweit1, davem, netdev, linux-kernel
On 25/01/2019 15:00, Andrew Lunn wrote:
> On Fri, Jan 25, 2019 at 12:35:10PM +0000, Carlo Caione wrote:
>> Libphy provides a standard set of helpers to access the MMD PHY
>> registers. Use those instead of relying on custom driver-specific
>> functions.
>
> Hi Carlo
Hey Andrew,
> Maybe deja vu, but i thought a similar patch went by recently?
uhm, not from me for sure. There is a discussion going on about similar
stuff on the U-Boot ml, maybe you saw that?
Anyway, feel free to drop this if someone already fixed this.
Thanks,
--
Carlo Caione
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
2019-01-25 15:00 ` Andrew Lunn
2019-01-25 15:03 ` Carlo Caione
@ 2019-01-25 18:11 ` Heiner Kallweit
2019-01-25 18:51 ` Andrew Lunn
1 sibling, 1 reply; 7+ messages in thread
From: Heiner Kallweit @ 2019-01-25 18:11 UTC (permalink / raw)
To: Andrew Lunn, Carlo Caione; +Cc: f.fainelli, davem, netdev, linux-kernel
On 25.01.2019 16:00, Andrew Lunn wrote:
> On Fri, Jan 25, 2019 at 12:35:10PM +0000, Carlo Caione wrote:
>> Libphy provides a standard set of helpers to access the MMD PHY
>> registers. Use those instead of relying on custom driver-specific
>> functions.
>
> Hi Carlo
>
> Maybe deja vu, but i thought a similar patch went by recently?
>
Andrew, maybe you mean this one?
9b420eff9fcf ("net: phy: micrel: use phy_read_mmd and phy_write_mmd")
> Anyway,
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>
> Andrew
>
>>
>> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
>> ---
>> drivers/net/phy/at803x.c | 16 +++-------------
>> 1 file changed, 3 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
>> index f9432d053a22..23ba76f8d950 100644
>> --- a/drivers/net/phy/at803x.c
>> +++ b/drivers/net/phy/at803x.c
>> @@ -39,9 +39,6 @@
>> #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
>> #define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B
>> #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A
>> -#define AT803X_MMD_ACCESS_CONTROL 0x0D
>> -#define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E
>> -#define AT803X_FUNC_DATA 0x4003
>> #define AT803X_REG_CHIP_CONFIG 0x1f
>> #define AT803X_BT_BX_REG_SEL 0x8000
>>
>> @@ -168,16 +165,9 @@ static int at803x_set_wol(struct phy_device *phydev,
>> if (!is_valid_ether_addr(mac))
>> return -EINVAL;
>>
>> - for (i = 0; i < 3; i++) {
>> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
>> - AT803X_DEVICE_ADDR);
>> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
>> - offsets[i]);
>> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
>> - AT803X_FUNC_DATA);
>> - phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
>> - mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
>> - }
>> + for (i = 0; i < 3; i++)
>> + phy_write_mmd(phydev, AT803X_DEVICE_ADDR, offsets[i],
>> + mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
>>
>> value = phy_read(phydev, AT803X_INTR_ENABLE);
>> value |= AT803X_INTR_ENABLE_WOL;
>> --
>> 2.19.1
>>
> .
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
2019-01-25 18:11 ` Heiner Kallweit
@ 2019-01-25 18:51 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2019-01-25 18:51 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Carlo Caione, f.fainelli, davem, netdev, linux-kernel
On Fri, Jan 25, 2019 at 07:11:28PM +0100, Heiner Kallweit wrote:
> On 25.01.2019 16:00, Andrew Lunn wrote:
> > On Fri, Jan 25, 2019 at 12:35:10PM +0000, Carlo Caione wrote:
> >> Libphy provides a standard set of helpers to access the MMD PHY
> >> registers. Use those instead of relying on custom driver-specific
> >> functions.
> >
> > Hi Carlo
> >
> > Maybe deja vu, but i thought a similar patch went by recently?
> >
> Andrew, maybe you mean this one?
>
> 9b420eff9fcf ("net: phy: micrel: use phy_read_mmd and phy_write_mmd")
Yes, probably that one.
Might be worth grepping of 0xd, 0xe, 0x0d, 0x0e, 13, 14, and see if
there are any more instances in PHY drivers.
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
2019-01-25 12:35 [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers Carlo Caione
2019-01-25 15:00 ` Andrew Lunn
@ 2019-01-25 18:40 ` Florian Fainelli
2019-01-27 21:27 ` David Miller
2 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2019-01-25 18:40 UTC (permalink / raw)
To: Carlo Caione, andrew, hkallweit1, davem, netdev, linux-kernel
On 1/25/19 4:35 AM, Carlo Caione wrote:
> Libphy provides a standard set of helpers to access the MMD PHY
> registers. Use those instead of relying on custom driver-specific
> functions.
>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
2019-01-25 12:35 [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers Carlo Caione
2019-01-25 15:00 ` Andrew Lunn
2019-01-25 18:40 ` Florian Fainelli
@ 2019-01-27 21:27 ` David Miller
2 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2019-01-27 21:27 UTC (permalink / raw)
To: ccaione; +Cc: andrew, f.fainelli, hkallweit1, netdev, linux-kernel
From: Carlo Caione <ccaione@baylibre.com>
Date: Fri, 25 Jan 2019 12:35:10 +0000
> Libphy provides a standard set of helpers to access the MMD PHY
> registers. Use those instead of relying on custom driver-specific
> functions.
>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Applied to net-next.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-27 21:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 12:35 [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers Carlo Caione
2019-01-25 15:00 ` Andrew Lunn
2019-01-25 15:03 ` Carlo Caione
2019-01-25 18:11 ` Heiner Kallweit
2019-01-25 18:51 ` Andrew Lunn
2019-01-25 18:40 ` Florian Fainelli
2019-01-27 21:27 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.