lkml.org 
[lkml]   [2019]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: phy: at803x: Use helpers to access MMD PHY registers
From
Date
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
>>
> .
>

\
 
 \ /
  Last update: 2019-01-25 19:12    [W:0.098 / U:6.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site