diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-01-28 18:03:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-01 03:58:23 -0500 |
commit | 4661e75b9d7bb12bcbe9be8bbf40ebf0845879a9 (patch) | |
tree | 6a94e7e6ff9d3fcf99efb1556692bf3eddffd5d5 /drivers/net/fec.c | |
parent | 6989f5122f84046ba286efe8ce8be2fec42a1b7c (diff) |
fec: use dma_alloc_coherent for descriptor ring
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>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r-- | drivers/net/fec.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 1087c4da84a5..46a441a9c644 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -186,6 +186,7 @@ struct fec_enet_private { | |||
186 | 186 | ||
187 | /* CPM dual port RAM relative addresses. | 187 | /* CPM dual port RAM relative addresses. |
188 | */ | 188 | */ |
189 | dma_addr_t bd_dma; | ||
189 | cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ | 190 | cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ |
190 | cbd_t *tx_bd_base; | 191 | cbd_t *tx_bd_base; |
191 | cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ | 192 | cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ |
@@ -2107,7 +2108,8 @@ int __init fec_enet_init(struct net_device *dev) | |||
2107 | 2108 | ||
2108 | /* Allocate memory for buffer descriptors. | 2109 | /* Allocate memory for buffer descriptors. |
2109 | */ | 2110 | */ |
2110 | mem_addr = __get_free_page(GFP_KERNEL); | 2111 | mem_addr = (unsigned long)dma_alloc_coherent(NULL, PAGE_SIZE, |
2112 | &fep->bd_dma, GFP_KERNEL); | ||
2111 | if (mem_addr == 0) { | 2113 | if (mem_addr == 0) { |
2112 | printk("FEC: allocate descriptor memory failed?\n"); | 2114 | printk("FEC: allocate descriptor memory failed?\n"); |
2113 | return -ENOMEM; | 2115 | return -ENOMEM; |
@@ -2202,8 +2204,9 @@ int __init fec_enet_init(struct net_device *dev) | |||
2202 | 2204 | ||
2203 | /* Set receive and transmit descriptor base. | 2205 | /* Set receive and transmit descriptor base. |
2204 | */ | 2206 | */ |
2205 | fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); | 2207 | fecp->fec_r_des_start = fep->bd_dma; |
2206 | fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base)); | 2208 | fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) |
2209 | * RX_RING_SIZE; | ||
2207 | 2210 | ||
2208 | /* Install our interrupt handlers. This varies depending on | 2211 | /* Install our interrupt handlers. This varies depending on |
2209 | * the architecture. | 2212 | * the architecture. |
@@ -2291,8 +2294,9 @@ fec_restart(struct net_device *dev, int duplex) | |||
2291 | 2294 | ||
2292 | /* Set receive and transmit descriptor base. | 2295 | /* Set receive and transmit descriptor base. |
2293 | */ | 2296 | */ |
2294 | fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); | 2297 | fecp->fec_r_des_start = fep->bd_dma; |
2295 | fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base)); | 2298 | fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) |
2299 | * RX_RING_SIZE; | ||
2296 | 2300 | ||
2297 | fep->dirty_tx = fep->cur_tx = fep->tx_bd_base; | 2301 | fep->dirty_tx = fep->cur_tx = fep->tx_bd_base; |
2298 | fep->cur_rx = fep->rx_bd_base; | 2302 | fep->cur_rx = fep->rx_bd_base; |