All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: Joel Stanley <joel@jms.id.au>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>, openbmc@lists.ozlabs.org
Subject: Re: [PATCH dev-4.7 2/2] net/faraday: Clear stale interrupts
Date: Tue, 2 Aug 2016 16:53:11 +1000	[thread overview]
Message-ID: <20160802065310.GA12378@gwshan> (raw)
In-Reply-To: <1470039961.16990.7.camel@jms.id.au>

On Mon, Aug 01, 2016 at 05:56:01PM +0930, Joel Stanley wrote:
>On Thu, 2016-07-28 at 11:04 +1000, Gavin Shan wrote:
>> There is stale interrupt (PHYSTS_CHG in ISR, bit#6 in 0x0) from
>> the bootloader (uboot) when enabling the MAC. The stale interrupts
>> aren't part of kernel and should be cleared.
>> 
>> This clears the stale interrupts in ISR (0x0) when enabling the MAC.
>
>Thanks Gavin. A question below.
>
>> 
>> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>> ---
>>  drivers/net/ethernet/faraday/ftgmac100.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c
>> b/drivers/net/ethernet/faraday/ftgmac100.c
>> index f00911a..fc2852f 100644
>> --- a/drivers/net/ethernet/faraday/ftgmac100.c
>> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
>> @@ -1119,6 +1119,7 @@ static int ftgmac100_open(struct net_device
>> *netdev)
>>  {
>>  	struct ftgmac100 *priv = netdev_priv(netdev);
>>  	struct phy_device *phydev = netdev->phydev;
>> +	unsigned int status;
>>  	int err;
>>  
>>  	err = ftgmac100_alloc_buffers(priv);
>> @@ -1145,6 +1146,10 @@ static int ftgmac100_open(struct net_device
>> *netdev)
>>  	ftgmac100_init_hw(priv);
>>  	ftgmac100_start_hw(priv, priv->use_ncsi ? 100 : 10);
>>  
>> +	/* Clear stale interrupts */
>> +	status = ioread32(priv->base + FTGMAC100_OFFSET_ISR);
>> +	iowrite32(status, priv->base + FTGMAC100_OFFSET_ISR);
>
>By the time we get down here we've called ftgmac100_reset_hw. This has
>the following:
>
>/* NOTE: reset clears all registers */
>iowrite32(FTGMAC100_MACCR_SW_RST, priv->base + FTGMAC100_OFFSET_MACCR); 
>
>We are seeing that it does not actually clear all the registers?
>

Yep, it clears all registers including ISR/IER/MACCR, meaning MACCR[11]
is cleared. ISR[9] (PHYSTS_CHG) is set right after it even IER is cleared
that time. So ISR[9] cannot be cleared if MACCR[11] isn't set. Note the
MACCR[11] is set in PATCH[1/2] in ftgmac100_start_hw(). It also means
ISR[9] cannot be cleared successfully until ftgmac100_start_hw() sets
MACCR[11].

>Secondly, if we're seeing stale interrupts is there a risk that they
>will fire again between now and the call below where we
>set FTGMAC100_OFFSET_IER?
>
>Should we be masking them all off, clearing the stale ones, and then
>re-enabling them?
>

IER is cleared by reset done in ftgmac100_reset_hw(), meaning all interrupts
are disabled that time. We're clearing the stale interrupts (mainly ISR[9] -
PHYSTS_CHG) before the interrupts are enabled.

Thanks,
Gavin

>Cheers,
>
>Joel
>
>
>> +
>>  	if (phydev)
>>  		phy_start(phydev);
>>  	else if (priv->use_ncsi)
>

  reply	other threads:[~2016-08-02  6:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28  1:04 [PATCH dev-4.7 1/2] net/faraday: Avoid PHYSTS_CHG interrupt Gavin Shan
2016-07-28  1:04 ` [PATCH dev-4.7 2/2] net/faraday: Clear stale interrupts Gavin Shan
2016-08-01  8:26   ` Joel Stanley
2016-08-02  6:53     ` Gavin Shan [this message]
2016-08-01  8:27 ` [PATCH dev-4.7 1/2] net/faraday: Avoid PHYSTS_CHG interrupt Joel Stanley
2016-08-02  4:45   ` Gavin Shan
2016-08-08  8:27     ` Joel Stanley

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=20160802065310.GA12378@gwshan \
    --to=gwshan@linux.vnet.ibm.com \
    --cc=joel@jms.id.au \
    --cc=openbmc@lists.ozlabs.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 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.