]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
fec: use dma_alloc_coherent for descriptor ring
authorSascha Hauer <s.hauer@pengutronix.de>
Wed, 28 Jan 2009 23:03:07 +0000 (23:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Feb 2009 08:58:23 +0000 (00:58 -0800)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/fec.c

index 1087c4da84a5257fea7292b2e69e970fcefe0f34..46a441a9c644c885a967ee67aa1a51b3334e4fe7 100644 (file)
@@ -186,6 +186,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 */
@@ -2107,7 +2108,8 @@ 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;
@@ -2202,8 +2204,9 @@ 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.
@@ -2291,8 +2294,9 @@ 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;