netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Doug Berger <opendmb@gmail.com>, "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: bcmgenet: use MAC link status for fixed phy
Date: Tue, 28 Aug 2018 12:40:37 -0700	[thread overview]
Message-ID: <4a2baac2-ee6c-f7e9-1bd6-674c55c5fb2a@gmail.com> (raw)
In-Reply-To: <1535484795-31871-1-git-send-email-opendmb@gmail.com>

On 08/28/2018 12:33 PM, Doug Berger wrote:
> When using the fixed PHY with GENET (e.g. MOCA) the PHY link
> status can be determined from the internal link status captured
> by the MAC. This allows the PHY state machine to use the correct
> link state with the fixed PHY even if MAC link event interrupts
> are missed when the net device is opened.
> 
> Fixes: 8d88c6e ("net: bcmgenet: enable MoCA link state change detection")

The 12-digit sha1 for that commit would be 8d88c6ebb34c

> Signed-off-by: Doug Berger <opendmb@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks Doug!

> ---
>  drivers/net/ethernet/broadcom/genet/bcmgenet.h |  3 +++
>  drivers/net/ethernet/broadcom/genet/bcmmii.c   | 10 ++++++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> index b773bc0..14b49612a 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> @@ -186,6 +186,9 @@ struct bcmgenet_mib_counters {
>  #define UMAC_MAC1			0x010
>  #define UMAC_MAX_FRAME_LEN		0x014
>  
> +#define UMAC_MODE			0x44
> +#define  MODE_LINK_STATUS		(1 << 5)
> +
>  #define UMAC_EEE_CTRL			0x064
>  #define  EN_LPI_RX_PAUSE		(1 << 0)
>  #define  EN_LPI_TX_PFC			(1 << 1)
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> index 5333274..4241ae9 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> @@ -115,8 +115,14 @@ void bcmgenet_mii_setup(struct net_device *dev)
>  static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
>  					  struct fixed_phy_status *status)
>  {
> -	if (dev && dev->phydev && status)
> -		status->link = dev->phydev->link;
> +	struct bcmgenet_priv *priv;
> +	u32 reg;
> +
> +	if (dev && dev->phydev && status) {
> +		priv = netdev_priv(dev);
> +		reg = bcmgenet_umac_readl(priv, UMAC_MODE);
> +		status->link = !!(reg & MODE_LINK_STATUS);
> +	}
>  
>  	return 0;
>  }
> 


-- 
Florian

  reply	other threads:[~2018-08-28 19:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 19:33 [PATCH net] net: bcmgenet: use MAC link status for fixed phy Doug Berger
2018-08-28 19:40 ` Florian Fainelli [this message]
2018-08-30  2:52 ` David Miller

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=4a2baac2-ee6c-f7e9-1bd6-674c55c5fb2a@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    /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).