From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] net: convert altera_tse to driver model and phylib
Date: Thu, 22 Oct 2015 11:06:36 +0800 [thread overview]
Message-ID: <562852BC.60107@wytron.com.tw> (raw)
In-Reply-To: <CAPnjgZ1=3ydoikWN9XBA2jL4WZg2_DunaErUAnE1S_32_aXO0w@mail.gmail.com>
Hi Simon,
On 10/22/2015 10:15 AM, Simon Glass wrote:
>> + writel(0, &rx_sgdma->control);
>> + ret = alt_sgdma_wait_transfer(rx_sgdma);
>> + if (ret == -ETIMEDOUT)
>> + writel(ALT_SGDMA_CONTROL_SOFTWARERESET_MSK,
>> + &rx_sgdma->control);
>> +
>> + writel(0, &tx_sgdma->control);
>> + ret = alt_sgdma_wait_transfer(tx_sgdma);
>> + if (ret == -ETIMEDOUT)
>> + writel(ALT_SGDMA_CONTROL_SOFTWARERESET_MSK,
>> + &tx_sgdma->control);
>>
>> - counter = 0;
>> - tx_sgdma->control = 0;
>> - while (tx_sgdma->status & ALT_SGDMA_STATUS_BUSY_MSK) {
>> - if (counter++ > ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR)
>> - break;
>
> It looks like this function can fail in various ways - should it not
> return an error?
We would like to reset sgdma here. But Altera advices that software
reset should be used with care to avoid bus lock up. So we wait the
sgdma transfer to stop before applying a software reset.
If the sgdma stopped successfully, there is no need to do soft reset.
Otherwise, we simply apply a soft reset and go on.
>
> [snip]
>> +static int altera_tse_free_pkt(struct udevice *dev, uchar *packet,
>> + int length)
>> {
>
> These functions seem to just call other functions. Perhaps you might
> consider moving the code here a follow-on patch?
>
I will move the code into net ops for those with a single caller.
>> + /* allocate recv packet buffer */
>> + priv->rx_buf = malloc_cache_aligned(PKTSIZE_ALIGN);
>
> Can you just use
>
> uint8_t rx_buf[PKTSIZE_ALIGN]
>
> in this 'priv' structure? Why do a separate malloc()?
>
The rx dma buffer need to be cache aligned. This is the point that Marek
and I have discussed for a while. Though a __algined() modifier might
work this way,
char rx_buf[PKTSIZE_ALIGN] __aligned(ARCH_DMA_MINALIGN);
I do believe a more explicit and trusted malloc with cache aligned is
better.
Thanks a lot for your review.
Best regards,
Thomas
next prev parent reply other threads:[~2015-10-22 3:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 2:36 [U-Boot] [PATCH] net: convert altera_tse to driver model and phylib Thomas Chou
2015-10-19 12:31 ` Marek Vasut
2015-10-21 13:09 ` Thomas Chou
2015-10-22 1:53 ` Marek Vasut
2015-10-21 13:05 ` [U-Boot] [PATCH v2] " Thomas Chou
2015-10-22 1:59 ` Marek Vasut
2015-10-22 2:15 ` Simon Glass
2015-10-22 3:06 ` Thomas Chou [this message]
2015-10-22 7:35 ` [U-Boot] [PATCH v3] " Thomas Chou
2015-10-23 0:21 ` Thomas Chou
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=562852BC.60107@wytron.com.tw \
--to=thomas@wytron.com.tw \
--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