Netdev List
 help / color / mirror / Atom feed
From: <Nicolas.Ferre@microchip.com>
To: <harini.katakam@xilinx.com>, <davem@davemloft.net>,
	<Claudiu.Beznea@microchip.com>, <brandon.streiff@ni.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<michal.simek@xilinx.com>, <harinikatakamlinux@gmail.com>
Subject: Re: [PATCH] net: macb: Apply RXUBR workaround only to versions with errata
Date: Fri, 25 Jan 2019 10:28:42 +0000	[thread overview]
Message-ID: <e9c3ae69-a0cb-3862-c01d-d8d1fc3c68e8@microchip.com> (raw)
In-Reply-To: <1548337111-31184-1-git-send-email-harini.katakam@xilinx.com>

On 24/01/2019 at 14:38, Harini Katakam wrote:
> The interrupt handler contains a workaround for RX hang applicable
> to Zynq and AT91 only. Subsequent versions do not need this

AT91RM9200 only. It's not the case for other AT91 SoCs (reading errata 
list for them).

That being said I have to add a patch for making this perfectly clear in 
the comment just above the flag's test.

> workaround. This workaround unecessarily resets RX whenever RX used

Typo: unnecessarily

> bit read is observed, which can be often under heavy traffic. Hence
> introduce an CAPS mask and a check to enable this workaround.

Nack for this one, see below...

> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
> ---
> Changes from RFC:
> - Use CAPS mask instead introducing and errata field.
> - Use check only on RX reset part; ISR should still be cleared.
> 
>   drivers/net/ethernet/cadence/macb.h      |  1 +
>   drivers/net/ethernet/cadence/macb_main.c | 16 ++++++++++------
>   2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 3d45f4c..2b412fa 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -643,6 +643,7 @@
>   #define MACB_CAPS_JUMBO				0x00000020
>   #define MACB_CAPS_GEM_HAS_PTP			0x00000040
>   #define MACB_CAPS_BD_RD_PREFETCH		0x00000080
> +#define MACB_CAPS_NEEDS_RSTONUBR		0x00000100
>   #define MACB_CAPS_FIFO_MODE			0x10000000
>   #define MACB_CAPS_GIGABIT_MODE_AVAILABLE	0x20000000
>   #define MACB_CAPS_SG_DISABLED			0x40000000
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 66cc792..0bda1cd 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1416,10 +1416,12 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
>   		 * section 16.7.4 for details.
>   		 */
>   		if (status & MACB_BIT(RXUBR)) {
> -			ctrl = macb_readl(bp, NCR);
> -			macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
> -			wmb();
> -			macb_writel(bp, NCR, ctrl | MACB_BIT(RE));
> +			if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR) {
> +				ctrl = macb_readl(bp, NCR);
> +				macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
> +				wmb();
> +				macb_writel(bp, NCR, ctrl | MACB_BIT(RE));
> +			}

As this interrupt routine is not doing anything else than just being 
called now, what about just removing the use of this status bit for 
platforms which don't need this RX reset?

>   			if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
>   				queue_writel(queue, ISR, MACB_BIT(RXUBR));
> @@ -3864,7 +3866,8 @@ static int at91ether_init(struct platform_device *pdev)
>   }
>   
>   static const struct macb_config at91sam9260_config = {
> -	.caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
> +	.caps = MACB_CAPS_USRIO_HAS_CLKEN |
> +		MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_NEEDS_RSTONUBR,
>   	.clk_init = macb_clk_init,
>   	.init = macb_init,

Actually it seems not the proper configuration structure to modify: You 
must change the emac_config instead.


>   };
> @@ -3928,7 +3931,8 @@ static const struct macb_config zynqmp_config = {
>   };
>   
>   static const struct macb_config zynq_config = {
> -	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF,
> +	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF |
> +		MACB_CAPS_NEEDS_RSTONUBR,
>   	.dma_burst_length = 16,
>   	.clk_init = macb_clk_init,
>   	.init = macb_init,


Best regards,
-- 
Nicolas Ferre

  reply	other threads:[~2019-01-25 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 13:38 [PATCH] net: macb: Apply RXUBR workaround only to versions with errata Harini Katakam
2019-01-25 10:28 ` Nicolas.Ferre [this message]
2019-01-25 11:03   ` Harini Katakam

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=e9c3ae69-a0cb-3862-c01d-d8d1fc3c68e8@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=brandon.streiff@ni.com \
    --cc=davem@davemloft.net \
    --cc=harini.katakam@xilinx.com \
    --cc=harinikatakamlinux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --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