From: Greg Ungerer <gerg@snapgear.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: netdev@vger.kernel.org, Sebastian Siewior <bigeasy@linutronix.de>
Subject: Re: [PATCH] fec: use dma_alloc_coherent for descriptor ring
Date: Thu, 15 Jan 2009 15:20:17 +1000 [thread overview]
Message-ID: <496EC791.10209@snapgear.com> (raw)
In-Reply-To: <1231949353-29630-6-git-send-email-s.hauer@pengutronix.de>
Hi Sascha,
Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
I found a problem in the ColdFire ZONE_DMA setup that was
causing this patch to break. Fixed that now, and it is
working fine.
Acked-by: Greg Ungerer <gerg@uclinux.org>
Regards
Greg
> drivers/net/fec.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 29df0df..81c8e11 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -184,6 +184,7 @@ struct fec_enet_private {
>
> /* CPM dual port RAM relative addresses.
> */
> + dma_addr_t bd_dma;
> cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */
> cbd_t *tx_bd_base;
> cbd_t *cur_rx, *cur_tx; /* The next free ring entry */
> @@ -2105,7 +2106,7 @@ int __init fec_enet_init(struct net_device *dev)
>
> /* Allocate memory for buffer descriptors.
> */
> - mem_addr = __get_free_page(GFP_KERNEL);
> + mem_addr = (unsigned long)dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, GFP_KERNEL);
> if (mem_addr == 0) {
> printk("FEC: allocate descriptor memory failed?\n");
> return -ENOMEM;
> @@ -2200,8 +2201,8 @@ int __init fec_enet_init(struct net_device *dev)
>
> /* Set receive and transmit descriptor base.
> */
> - fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base));
> - fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base));
> + fecp->fec_r_des_start = fep->bd_dma;
> + fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE;
>
> /* Install our interrupt handlers. This varies depending on
> * the architecture.
> @@ -2289,8 +2290,8 @@ fec_restart(struct net_device *dev, int duplex)
>
> /* Set receive and transmit descriptor base.
> */
> - fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base));
> - fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base));
> + fecp->fec_r_des_start = fep->bd_dma;
> + fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE;
>
> fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
> fep->cur_rx = fep->rx_bd_base;
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear, a McAfee Company PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
next prev parent reply other threads:[~2009-01-15 5:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-14 16:09 [RFC] FEC patches Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: Add mx2 support (WIP) Sascha Hauer
2009-01-15 7:22 ` Greg Ungerer
2009-01-15 10:15 ` Sascha Hauer
2009-01-15 5:20 ` Greg Ungerer [this message]
2009-01-15 3:55 ` [PATCH] fec: do not use memcpy on physical addresses Greg Ungerer
2009-01-15 3:55 ` [PATCH] fec: use linux/*.h instead of asm/*.h Greg Ungerer
2009-01-15 3:54 ` [PATCH] fec: remove empty functions Greg Ungerer
2009-01-15 3:43 ` [PATCH] fec: remove unused #else branches Greg Ungerer
2009-01-15 10:17 ` Sascha Hauer
2009-01-15 4:06 ` [RFC] FEC patches Greg Ungerer
2009-01-15 10:24 ` Sascha Hauer
2009-01-16 0:10 ` Greg Ungerer
[not found] <1233051848-5994-1-git-send-email-y>
[not found] ` <1233051848-5994-2-git-send-email-y>
[not found] ` <1233051848-5994-3-git-send-email-y>
[not found] ` <1233051848-5994-4-git-send-email-y>
[not found] ` <1233051848-5994-5-git-send-email-y>
2009-01-27 10:24 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring y
-- strict thread matches above, loose matches on Subject: below --
2009-01-27 10:39 FEC Patches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-27 10:40 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-29 9:03 FEC patches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
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=496EC791.10209@snapgear.com \
--to=gerg@snapgear.com \
--cc=bigeasy@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=s.hauer@pengutronix.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.