From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/2] net: designware: fix descriptor layout and warnings on 64-bit archs
Date: Mon, 11 Apr 2016 01:59:59 +0200 [thread overview]
Message-ID: <570AE8FF.5000509@gmail.com> (raw)
In-Reply-To: <1460302242-16420-2-git-send-email-b.galvani@gmail.com>
On 04/10/2016 05:30 PM, Beniamino Galvani wrote:
> All members of the DMA descriptor must be 32-bit, even on 64-bit
> architectures: change the type to u32 to ensure this. Also, fix
> other warnings.
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
> drivers/net/designware.c | 54 ++++++++++++++++++++++++------------------------
> drivers/net/designware.h | 4 ++--
> 2 files changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index ca58f34..78d6901 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -98,8 +98,8 @@ static void tx_descs_init(struct dw_eth_dev *priv)
>
> for (idx = 0; idx < CONFIG_TX_DESCR_NUM; idx++) {
> desc_p = &desc_table_p[idx];
> - desc_p->dmamac_addr = &txbuffs[idx * CONFIG_ETH_BUFSIZE];
> - desc_p->dmamac_next = &desc_table_p[idx + 1];
> + desc_p->dmamac_addr = (ulong)&txbuffs[idx * CONFIG_ETH_BUFSIZE];
> + desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1];
This looks more like silencing the warning by a forced cast.
The pointer should most likely be sanity-checked to make sure it's in
4GiB address space at least. I am worried such forced casts will bite
us in the long run.
> #if defined(CONFIG_DW_ALTDESCRIPTOR)
> desc_p->txrx_status &= ~(DESC_TXSTS_TXINT | DESC_TXSTS_TXLAST |
> @@ -117,11 +117,11 @@ static void tx_descs_init(struct dw_eth_dev *priv)
> }
>
> /* Correcting the last pointer of the chain */
> - desc_p->dmamac_next = &desc_table_p[0];
> + desc_p->dmamac_next = (ulong)&desc_table_p[0];
>
> /* Flush all Tx buffer descriptors at once */
> - flush_dcache_range((unsigned int)priv->tx_mac_descrtable,
> - (unsigned int)priv->tx_mac_descrtable +
> + flush_dcache_range((ulong)priv->tx_mac_descrtable,
> + (ulong)priv->tx_mac_descrtable +
> sizeof(priv->tx_mac_descrtable));
>
> writel((ulong)&desc_table_p[0], &dma_p->txdesclistaddr);
[...]
Best regards,
Marek Vasut
next prev parent reply other threads:[~2016-04-10 23:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-10 15:30 [U-Boot] [PATCH v3 0/2] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-04-10 15:30 ` [U-Boot] [PATCH v3 1/2] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-04-10 23:59 ` Marek Vasut [this message]
2016-04-11 20:46 ` Beniamino Galvani
2016-04-10 15:30 ` [U-Boot] [PATCH v3 2/2] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-04-11 0:08 ` Marek Vasut
2016-04-11 21:02 ` Beniamino Galvani
2016-04-11 21:08 ` Marek Vasut
2016-04-12 21:50 ` Beniamino Galvani
2016-04-12 22:26 ` Marek Vasut
2016-04-13 11:22 ` Beniamino Galvani
2016-04-13 11:52 ` Marek Vasut
2016-04-13 21:38 ` Alexander Graf
2016-04-13 22:34 ` Tom Rini
2016-04-13 22:42 ` Alexander Graf
2016-04-13 22:51 ` Tom Rini
2016-04-13 22:53 ` Alexander Graf
2016-04-13 23:12 ` Marek Vasut
2016-04-14 7:08 ` Alexander Graf
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=570AE8FF.5000509@gmail.com \
--to=marek.vasut@gmail.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 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.