All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 07/13] net: ftgmac100: handle timeouts when transmitting
Date: Tue, 16 Oct 2018 07:47:41 +0200	[thread overview]
Message-ID: <431a1591-b067-77e8-0650-3e39c09c0341@kaod.org> (raw)
In-Reply-To: <CANr=Z=Ydkcx_XKg_mLx2UnsQzUGR2U8VWzmyYQu9NYO2xRVKDA@mail.gmail.com>

On 10/15/18 10:58 PM, Joe Hershberger wrote:
> On Wed, Oct 10, 2018 at 6:48 AM Cédric Le Goater <clg@kaod.org> wrote:
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  drivers/net/ftgmac100.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
>> index b46187b567c6..edf34c601c68 100644
>> --- a/drivers/net/ftgmac100.c
>> +++ b/drivers/net/ftgmac100.c
>> @@ -28,6 +28,9 @@
>>  /* PKTBUFSTX/PKTBUFSRX must both be power of 2 */
>>  #define PKTBUFSTX      4       /* must be power of 2 */
>>
>> +/* Timeout for transmit */
>> +#define FTGMAC100_TX_TIMEOUT_MS                1000
>> +
>>  /* Timeout for a mdio read/write operation */
>>  #define FTGMAC100_MDIO_TIMEOUT_USEC    10000
>>
>> @@ -412,6 +415,7 @@ static int ftgmac100_send(struct udevice *dev, void *packet, int length)
>>                 roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
>>         ulong data_start;
>>         ulong data_end;
>> +       ulong start;
>>
>>         invalidate_dcache_range(des_start, des_end);
>>
>> @@ -444,6 +448,20 @@ static int ftgmac100_send(struct udevice *dev, void *packet, int length)
>>         /* Start transmit */
>>         writel(1, &ftgmac100->txpd);
>>
>> +       /* Wait until packet is transmitted */
>> +       start = get_timer(0);
>> +       while (get_timer(start) < FTGMAC100_TX_TIMEOUT_MS) {
> 
> In general we prefer to use wait_bit.h for such things. Probably just
> define a BUILD_WAIT_FOR_BIT() in your .c to handle your memory access.

OK. I will take a look for v4. 

Thanks for the review.

C.


> 
>> +               invalidate_dcache_range(des_start, des_end);
>> +               if (!(curr_des->txdes0 & FTGMAC100_TXDES0_TXDMA_OWN))
>> +                       break;
>> +               udelay(10);
>> +       }
>> +
>> +       if (get_timer(start) >= FTGMAC100_TX_TIMEOUT_MS) {
>> +               dev_err(dev, "transmit timeout\n");
>> +               return -ETIMEDOUT;
>> +       }
>> +
>>         debug("%s(): packet sent\n", __func__);
>>
>>         /* Move to next descriptor */
>> --
>> 2.17.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot

  reply	other threads:[~2018-10-16  5:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 11:41 [U-Boot] [PATCH v3 00/13] Support for the Faraday ftgmac100 controller Cédric Le Goater
2018-10-10 11:41 ` [U-Boot] [PATCH v3 01/13] net: ftgmac100: use the BIT() macro Cédric Le Goater
2018-10-11 23:13   ` Joel Stanley
2018-10-15 20:29   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 02/13] net: ftgmac100: use the aligned() macro Cédric Le Goater
2018-10-11 23:13   ` Joel Stanley
2018-10-15 20:30   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 03/13] net: ftgmac100: convert to driver model Cédric Le Goater
2018-10-11 23:15   ` Joel Stanley
2018-10-12  6:19     ` Cédric Le Goater
2018-10-15 20:39   ` Joe Hershberger
2018-10-16  5:39     ` Cédric Le Goater
2018-10-10 11:41 ` [U-Boot] [PATCH v3 04/13] net: ftgmac100: use setbits_le32() in the reset method Cédric Le Goater
2018-10-11 23:15   ` Joel Stanley
2018-10-15 20:40   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 05/13] net: ftgmac100: add MDIO bus and phylib support Cédric Le Goater
2018-10-11 23:17   ` Joel Stanley
2018-10-15 20:46   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 06/13] net: ftgmac100: convert the RX/TX descriptor arrays Cédric Le Goater
2018-10-11 23:18   ` Joel Stanley
2018-10-15 20:54   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 07/13] net: ftgmac100: handle timeouts when transmitting Cédric Le Goater
2018-10-11 23:23   ` Joel Stanley
2018-10-15 20:58   ` Joe Hershberger
2018-10-16  5:47     ` Cédric Le Goater [this message]
2018-10-10 11:41 ` [U-Boot] [PATCH v3 08/13] net: ftgmac100: add clock support Cédric Le Goater
2018-10-11 23:24   ` Joel Stanley
2018-10-15 21:00   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 09/13] aspeed: ast2500: fix missing break in D2PLL clock enablement Cédric Le Goater
2018-10-15 21:01   ` Joe Hershberger
2018-10-10 11:41 ` [U-Boot] [PATCH v3 10/13] net: ftgmac100: Add support for the Aspeed SoC Cédric Le Goater
2018-10-11 23:25   ` Joel Stanley
2018-10-15 21:02   ` Joe Hershberger
2018-10-10 11:42 ` [U-Boot] [PATCH v3 11/13] aspeed: Update ast2500 SoC DTS file to Linux v4.17-rc6 level Cédric Le Goater
2018-10-10 11:42 ` [U-Boot] [PATCH v3 12/13] aspeed: Activate ethernet devices on the ast2500 Eval Board Cédric Le Goater
2018-10-11 23:27   ` Joel Stanley
2018-10-15 21:04   ` Joe Hershberger
2018-10-10 11:42 ` [U-Boot] [PATCH v3 13/13] aspeed: ast2500: fix D2-PLL clock setting in RGMII mode Cédric Le Goater
2018-10-11 23:28   ` Joel Stanley
2018-10-15 21:05   ` Joe Hershberger

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=431a1591-b067-77e8-0650-3e39c09c0341@kaod.org \
    --to=clg@kaod.org \
    --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 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.