netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Woojung.Huh@microchip.com, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] lan78xx: update eee code
Date: Fri, 21 Aug 2015 14:56:35 -0700	[thread overview]
Message-ID: <55D79E93.8040404@gmail.com> (raw)
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D5480D9@CHN-SV-EXMX02.mchp-main.com>

On 21/08/15 14:41, Woojung.Huh@microchip.com wrote:
> Patch to pdate EEE code.

This really deserves a better explanation of what is it that you are
fixing here.

> 
> Signed-off-by: Woojung Huh <woojung.huh@microchip.com>
> ---
>  drivers/net/usb/lan78xx.c | 44 ++++++++++++++++++++++++--------------------
>  drivers/net/usb/lan78xx.h | 22 +++++++++++-----------
>  2 files changed, 35 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 4bcbf28..af102b0 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1296,38 +1296,37 @@ static int lan78xx_get_eee(struct net_device *net, struct ethtool_eee *edata)
>  	if (ret < 0)
>  		return ret;
>  
> +	buf = lan78xx_mmd_read(dev->net, dev->mii.phy_id,
> +			       PHY_MMD_DEV_7, PHY_EEE_ADVERTISEMENT);
> +	adv = mmd_eee_adv_to_ethtool_adv_t(buf);
> +	buf = lan78xx_mmd_read(dev->net, dev->mii.phy_id,
> +			       PHY_MMD_DEV_7, PHY_EEE_LP_ADVERTISEMENT);
> +	lpadv = mmd_eee_adv_to_ethtool_adv_t(buf);

Considering your function signatures, it sounds like you should
implement a libphy driver and you could get things like phy_init_eee()
for free.

[snip]

>  	/* enable PHY interrupts */
>  	ret = lan78xx_read_reg(dev, INT_EP_CTL, &buf);
>  	buf |= INT_ENP_PHY_INT;
> diff --git a/drivers/net/usb/lan78xx.h b/drivers/net/usb/lan78xx.h
> index ae7562e..95e721b 100644
> --- a/drivers/net/usb/lan78xx.h
> +++ b/drivers/net/usb/lan78xx.h
> @@ -1047,23 +1047,23 @@
>  #define PHY_MMD_DEV_3				3
>  
>  #define PHY_EEE_PCS_STATUS			(0x1)
> -#define PHY_EEE_PCS_STATUS_TX_LPI_RCVD_		((WORD)0x0800)
> -#define PHY_EEE_PCS_STATUS_RX_LPI_RCVD_		((WORD)0x0400)
> -#define PHY_EEE_PCS_STATUS_TX_LPI_IND_		((WORD)0x0200)
> -#define PHY_EEE_PCS_STATUS_RX_LPI_IND_		((WORD)0x0100)
> -#define PHY_EEE_PCS_STATUS_PCS_RCV_LNK_STS_	((WORD)0x0004)
> +#define PHY_EEE_PCS_STATUS_TX_LPI_RCVD_		(0x0800)
> +#define PHY_EEE_PCS_STATUS_RX_LPI_RCVD_		(0x0400)
> +#define PHY_EEE_PCS_STATUS_TX_LPI_IND_		(0x0200)
> +#define PHY_EEE_PCS_STATUS_RX_LPI_IND_		(0x0100)
> +#define PHY_EEE_PCS_STATUS_PCS_RCV_LNK_STS_	(0x0004)

Can you look at updating include/uapi/linux/mdio.h with the missing
registers for your use case instead of replicating this in a driver?
-- 
Florian

  reply	other threads:[~2015-08-21 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 21:41 [PATCH net-next 2/2] lan78xx: update eee code Woojung.Huh
2015-08-21 21:56 ` Florian Fainelli [this message]
2015-08-24 20:35   ` Woojung.Huh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D79E93.8040404@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).