public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded•com>
To: Florian Fainelli <f.fainelli@gmail•com>, netdev@vger•kernel.org
Cc: davem@davemloft•net
Subject: Re: [PATCH net 2/2] net: systemport: fix UniMAC reset logic
Date: Sat, 21 Jun 2014 00:14:26 +0400	[thread overview]
Message-ID: <53A49622.80908@cogentembedded.com> (raw)
In-Reply-To: <1403294500-31905-3-git-send-email-f.fainelli@gmail.com>

Hello.

On 06/21/2014 12:01 AM, Florian Fainelli wrote:

> The UniMAC CMD_SW_RESET bit is not a self-clearing bit, so we need to
> assert it, wait a bit and clear it manually. As a result, umac_reset()
> is updated not to return any value.

> By setting CMD_SW_RESET and only that bit, we were also clearing the

    I wonder where you were setting this bit before -- the only umac_writel() 
there was wrote 0 to UMAC_CMD...

> other 31 bits, overriding the hardware reset defaults which are
> correctly set on purpose.

> Signed-off-by: Florian Fainelli <f.fainelli@gmail•com>
> ---
>   drivers/net/ethernet/broadcom/bcmsysport.c | 33 ++++++++----------------------
>   1 file changed, 9 insertions(+), 24 deletions(-)

> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
> index f6bccd847ee6..d31f7d239064 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -1254,28 +1254,17 @@ static inline void umac_enable_set(struct bcm_sysport_priv *priv,
>   		usleep_range(1000, 2000);
>   }
>
> -static inline int umac_reset(struct bcm_sysport_priv *priv)
> +static inline void umac_reset(struct bcm_sysport_priv *priv)
>   {
> -	unsigned int timeout = 0;
>   	u32 reg;
> -	int ret = 0;
> -
> -	umac_writel(priv, 0, UMAC_CMD);
> -	while (timeout++ < 1000) {
> -		reg = umac_readl(priv, UMAC_CMD);
> -		if (!(reg & CMD_SW_RESET))
> -			break;
> -
> -		udelay(1);
> -	}
> -
> -	if (timeout == 1000) {
> -		dev_err(&priv->pdev->dev,
> -			"timeout waiting for MAC to come out of reset\n");
> -		ret = -ETIMEDOUT;
> -	}
>
> -	return ret;
> +	reg = umac_readl(priv, UMAC_CMD);
> +	reg |= CMD_SW_RESET;
> +	umac_writel(priv, reg, UMAC_CMD);
> +	udelay(10);
> +	reg = umac_readl(priv, UMAC_CMD);
> +	reg &= ~CMD_SW_RESET;
> +	umac_writel(priv, reg, UMAC_CMD);
>   }
>
>   static void umac_set_hw_addr(struct bcm_sysport_priv *priv,
[...]

WBR, Sergei

  reply	other threads:[~2014-06-20 20:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 20:01 [PATCH net 0/2] net: systemport: misc fixes Florian Fainelli
2014-06-20 20:01 ` [PATCH net 1/2] net: systemport: do not clear IFF_MULTICAST flag Florian Fainelli
2014-06-20 20:01 ` [PATCH net 2/2] net: systemport: fix UniMAC reset logic Florian Fainelli
2014-06-20 20:14   ` Sergei Shtylyov [this message]
2014-06-24 23:12   ` David Miller
2014-06-24 23:16     ` Florian Fainelli

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=53A49622.80908@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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