public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bo Shen <voice.shen@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Drivers PATCH 14/19] net/macb: workaround for transmission hang issue
Date: Fri, 1 Mar 2013 11:08:45 +0800	[thread overview]
Message-ID: <51301BBD.7050308@atmel.com> (raw)
In-Reply-To: <20130228135915.7f0e8426@lilith>

Hi All,

On 02/28/2013 08:59 PM, Albert ARIBAUD wrote:
> On Sun, 3 Feb 2013 12:19:26 +0100, Albert ARIBAUD
> <albert.u.boot@aribaud.net>  wrote:
>
>> Hi Vipin,
>>
>> On Fri, 2 Nov 2012 23:09:59 +0530, Vipin Kumar<vipin.kumar@st.com>
>> wrote:
>>
>>> From: Shiraz Hashim<shiraz.hashim@st.com>
>>>
>>> It is observed on SPEAr320S RMII#1 interface that on transmitting
>>> packets the MAC dma hangs randomly and constantly showing busy tx-go
>>> state.
>>>
>>> It comes out if this situation only when Transmission is disabled and
>>> enabled again.
>>>
>>> Since it happens randomly and u-boot doesn't require high performance we
>>> disable TE and re-enable it on each transmission. We also change number
>>> of transmit descriptor to 1 as we would not require more than it, further
>>> it would not alter GMAC notion of transmit descriptor start queue as it
>>> always point to same descriptor.
>>>
>>> Signed-off-by: Shiraz Hashim<shiraz.hashim@st.com>
>>> ---
>>>   drivers/net/macb.c | 38 ++++++++++++++++++++++++++++++++++----
>>>   1 file changed, 34 insertions(+), 4 deletions(-)

Tested on Atmel EK board. It works.

Tested-by: Bo Shen <voice.shen@atmel.com>

BTW, would this be implemented as a workaround only for SPEAr320S?

Best Regards,
Bo Shen

>>> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
>>> index ac25b52..17bad33 100644
>>> --- a/drivers/net/macb.c
>>> +++ b/drivers/net/macb.c
>>> @@ -55,7 +55,7 @@
>>>
>>>   #define CONFIG_SYS_MACB_RX_BUFFER_SIZE		4096
>>>   #define CONFIG_SYS_MACB_RX_RING_SIZE		(CONFIG_SYS_MACB_RX_BUFFER_SIZE / 128)
>>> -#define CONFIG_SYS_MACB_TX_RING_SIZE		16
>>> +#define CONFIG_SYS_MACB_TX_RING_SIZE		1
>>>   #define CONFIG_SYS_MACB_TX_TIMEOUT		1000
>>>   #define CONFIG_SYS_MACB_AUTONEG_TIMEOUT	5000000
>>>
>>> @@ -226,7 +226,13 @@ static int macb_send(struct eth_device *netdev, void *packet, int length)
>>>   	macb->tx_ring[tx_head].ctrl = ctrl;
>>>   	macb->tx_ring[tx_head].addr = paddr;
>>>   	barrier();
>>> -	macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART));
>>> +	/*
>>> +	 * Due to issues on SPEAr320 RMII, disable TE first so that
>>> +	 * controller can come out if it is hanged during transmission
>>> +	 */
>>> +	macb_writel(macb, NCR, macb_readl(macb, NCR)&  ~MACB_BIT(TE));
>>> +	macb_writel(macb, NCR, macb_readl(macb, NCR) |
>>> +			MACB_BIT(TE) | MACB_BIT(TSTART));
>>>
>>>   	/*
>>>   	 * I guess this is necessary because the networking core may
>>> @@ -444,6 +450,31 @@ static int macb_phy_init(struct macb_device *macb)
>>>   	}
>>>   }
>>>
>>> +static void macb_reset_hw(struct macb_device *bp)
>>> +{
>>> +	/* Make sure we have the write buffer for ourselves */
>>> +	barrier();
>>> +	/*
>>> +	 * Disable RX and TX (XXX: Should we halt the transmission
>>> +	 * more gracefully?) and we should not close the mdio port
>>> +	 */
>>> +	macb_writel(bp, NCR, 0);
>>> +
>>> +	/* Clear the stats registers (XXX: Update stats first?) */
>>> +	macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
>>> +
>>> +	/* keep the mdio port , otherwise other eth will not work */
>>> +	macb_writel(bp, NCR, MACB_BIT(MPE));
>>> +
>>> +	/* Clear all status flags */
>>> +	macb_writel(bp, TSR, ~0UL);
>>> +	macb_writel(bp, RSR, ~0UL);
>>> +
>>> +	/* Disable all interrupts */
>>> +	macb_writel(bp, IDR, ~0UL);
>>> +	macb_readl(bp, ISR);
>>> +}
>>> +
>>>   static int macb_init(struct eth_device *netdev, bd_t *bd)
>>>   {
>>>   	struct macb_device *macb = to_macb(netdev);
>>> @@ -520,8 +551,7 @@ static void macb_halt(struct eth_device *netdev)
>>>   		tsr = macb_readl(macb, TSR);
>>>   	} while (tsr&  MACB_BIT(TGO));
>>>
>>> -	/* Disable TX and RX, and clear statistics */
>>> -	macb_writel(macb, NCR, MACB_BIT(CLRSTAT));
>>> +	macb_reset_hw(macb);
>>>   }
>>>
>>>   static int macb_write_hwaddr(struct eth_device *dev)
>>
>> This patch did not reappear in later versions of the series, and no
>> other standalone patch seems to match it. Was it dropped?
>
> Ping?
>
> Amicalement,

  reply	other threads:[~2013-03-01  3:08 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1351876757.git.vipin.kumar@st.com>
2012-11-02 17:39 ` [U-Boot] [Drivers PATCH 01/19] mtd/st_smi: Clear error flags while initiating a fresh write Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 02/19] mtd/st_smi: Add support for Micron N25Q128 Flash Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 03/19] mtd/st_smi: Avoid issuing multiple WE commands Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 04/19] mtd/st_smi: Write to flash in a tight loop Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 05/19] mtd/st_smi: Use page sizes respective to flash Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 06/19] usbh/ehci: Increase timeout for enumeration Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 07/19] sdhci: Add sdhci support for spear devices Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 08/19] net/designware: Do not select MIIPORT for RGMII interface Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 10/19] usb/gadget/designware_otg: Add support for designware otg Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 11/19] usb/host/ehci: Add support for EHCI on spear Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 12/19] usbtty: adapt buffers for large packet support Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 13/19] net/macb: Add arch specific routine to get mdio control Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [Drivers PATCH 14/19] net/macb: workaround for transmission hang issue Vipin Kumar
2013-02-03 11:19     ` Albert ARIBAUD
2013-02-28 12:59       ` Albert ARIBAUD
2013-03-01  3:08         ` Bo Shen [this message]
2013-03-01  3:40           ` Vipin Kumar
2013-03-01  3:48             ` Bo Shen
2013-03-01  3:41         ` Vipin Kumar
2013-03-01  7:28           ` Albert ARIBAUD
2013-03-01  7:55             ` Vipin Kumar
2012-11-02 17:40   ` [U-Boot] [Drivers PATCH 15/19] misc/crypto: Add support for C3 Vipin Kumar
2012-11-02 17:40   ` [U-Boot] [Drivers PATCH 16/19] armv7/ltimer: Add support for local timer on armv7 cpus Vipin Kumar
2012-11-02 17:40   ` [U-Boot] [Drivers PATCH 17/19] imls: Add support to list images in NAND device Vipin Kumar
2012-11-06 23:30     ` Scott Wood
2012-11-07  5:15       ` Vipin Kumar
2012-11-07 20:49         ` Scott Wood
2012-11-02 17:40   ` [U-Boot] [Drivers PATCH 18/19] u-boot/spl: Add u-boot-spl.img to u-boot targets Vipin Kumar
2012-11-02 17:40   ` [U-Boot] [Drivers PATCH 19/19] arm/boards: Define a new config option CONFIG_BOOT_PARAMS_P Vipin Kumar
2012-11-02 17:39 ` [U-Boot] [SPEAr13xx PATCH 1/7] spear1340: Add support for spear1340 SoC Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr13xx PATCH 2/7] spear1310: Add support for spear1310 SoC Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr13xx PATCH 3/7] spear1340evb: Add support for evb machine Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr13xx PATCH 4/7] spear1310evb: " Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr13xx PATCH 5/7] spear1340lcad: Add support for LCAD machine Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr13xx PATCH 6/7] spear1340evb: Add SPL support Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr13xx PATCH 7/7] spear1310evb: " Vipin Kumar
2012-11-02 17:39 ` [U-Boot] [SPEAr Enhancement PATCH 1/9] spear: Add cache support Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 2/9] spear3xx: Add pinmux support Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 3/9] spear320plc: Correct the MACB interface Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 4/9] spear/configs: Modify several configurations Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 5/9] spear320: Add support for SD/MMC Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 6/9] spear320-hmi: Add support for hmi machine Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 7/9] spear6xx/spear3xx: Add support to boot via NAND device Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 8/9] spear/spl: Add support to boot from Parallel NOR device Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Enhancement PATCH 9/9] spear300evb: Add SPL support Vipin Kumar
2012-11-02 17:39 ` [U-Boot] [SPEAr Fixes PATCH 01/11] SPEAr: Remove extra spear board configurations Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 02/11] spear/configs: Split config files hierarchically into plat, arch, soc and board Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 03/11] spear/include: Clean up the spear include files Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 04/11] spear/board: Cleanup spear related board files Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 05/11] spear: Append MISC_ as prefix to misc register bitmasks Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 06/11] spear: Read ethaddr from I2C memory Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 07/11] spear: Cleanup SoC area Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 08/11] spear/spl: Cleanup spear SPL Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 09/11] spear: Add POST memory support Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 10/11] spear: Enable ehci support Vipin Kumar
2012-11-02 17:39   ` [U-Boot] [SPEAr Fixes PATCH 11/11] spear3xx: FIX: Enable access to memory for spear310 and spear320 Vipin Kumar
2012-11-07 14:10 ` [U-Boot] [PATCH 00/46] Enhance spear support Stefan Roese
2012-11-08  4:58   ` Vipin Kumar
2012-11-08  4:58   ` Vipin Kumar
     [not found]     ` <509CD19A.2060903@st.com>
2012-11-09 11:56       ` Stefan Roese
2012-11-10  8:48         ` Albert ARIBAUD
2012-11-11  6:11           ` Stefan Roese
2012-11-11  7:50             ` Wolfgang Denk
2012-11-11 17:49               ` Albert ARIBAUD
2012-11-12  9:34                 ` Armando Visconti
2012-11-12 10:35               ` Vipin Kumar
2012-11-21  9:24                 ` Wolfgang Denk
2012-11-30 11:15                   ` Armando Visconti
2012-11-30 12:34                     ` Wolfgang Denk
2012-11-30 14:10                       ` Armando Visconti
2012-12-03  5:51                       ` Vipin Kumar
2012-11-20  9:46 ` Vipin Kumar

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=51301BBD.7050308@atmel.com \
    --to=voice.shen@atmel.com \
    --cc=u-boot@lists.denx.de \
    /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