mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-25 06:14:37 +02:00
ramips: raeth: use device pointer in DMA API calls
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30449 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
5b41176cdc
commit
ad0b8c49bf
@ -129,18 +129,18 @@ ramips_cleanup_dma(struct raeth_priv *re)
|
|||||||
|
|
||||||
for (i = 0; i < NUM_RX_DESC; i++)
|
for (i = 0; i < NUM_RX_DESC; i++)
|
||||||
if (re->rx_skb[i]) {
|
if (re->rx_skb[i]) {
|
||||||
dma_unmap_single(NULL, re->rx_dma[i], MAX_RX_LENGTH,
|
dma_unmap_single(&re->netdev->dev, re->rx_dma[i],
|
||||||
DMA_FROM_DEVICE);
|
MAX_RX_LENGTH, DMA_FROM_DEVICE);
|
||||||
dev_kfree_skb_any(re->rx_skb[i]);
|
dev_kfree_skb_any(re->rx_skb[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (re->rx)
|
if (re->rx)
|
||||||
dma_free_coherent(NULL,
|
dma_free_coherent(&re->netdev->dev,
|
||||||
NUM_RX_DESC * sizeof(struct ramips_rx_dma),
|
NUM_RX_DESC * sizeof(struct ramips_rx_dma),
|
||||||
re->rx, re->rx_desc_dma);
|
re->rx, re->rx_desc_dma);
|
||||||
|
|
||||||
if (re->tx)
|
if (re->tx)
|
||||||
dma_free_coherent(NULL,
|
dma_free_coherent(&re->netdev->dev,
|
||||||
NUM_TX_DESC * sizeof(struct ramips_tx_dma),
|
NUM_TX_DESC * sizeof(struct ramips_tx_dma),
|
||||||
re->tx, re->tx_desc_dma);
|
re->tx, re->tx_desc_dma);
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ ramips_alloc_dma(struct raeth_priv *re)
|
|||||||
re->skb_free_idx = 0;
|
re->skb_free_idx = 0;
|
||||||
|
|
||||||
/* setup tx ring */
|
/* setup tx ring */
|
||||||
re->tx = dma_alloc_coherent(NULL,
|
re->tx = dma_alloc_coherent(&re->netdev->dev,
|
||||||
NUM_TX_DESC * sizeof(struct ramips_tx_dma),
|
NUM_TX_DESC * sizeof(struct ramips_tx_dma),
|
||||||
&re->tx_desc_dma, GFP_ATOMIC);
|
&re->tx_desc_dma, GFP_ATOMIC);
|
||||||
if (!re->tx)
|
if (!re->tx)
|
||||||
@ -167,7 +167,7 @@ ramips_alloc_dma(struct raeth_priv *re)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* setup rx ring */
|
/* setup rx ring */
|
||||||
re->rx = dma_alloc_coherent(NULL,
|
re->rx = dma_alloc_coherent(&re->netdev->dev,
|
||||||
NUM_RX_DESC * sizeof(struct ramips_rx_dma),
|
NUM_RX_DESC * sizeof(struct ramips_rx_dma),
|
||||||
&re->rx_desc_dma, GFP_ATOMIC);
|
&re->rx_desc_dma, GFP_ATOMIC);
|
||||||
if (!re->rx)
|
if (!re->rx)
|
||||||
@ -184,7 +184,7 @@ ramips_alloc_dma(struct raeth_priv *re)
|
|||||||
|
|
||||||
skb_reserve(new_skb, NET_IP_ALIGN);
|
skb_reserve(new_skb, NET_IP_ALIGN);
|
||||||
|
|
||||||
dma_addr = dma_map_single(NULL, new_skb->data,
|
dma_addr = dma_map_single(&re->netdev->dev, new_skb->data,
|
||||||
MAX_RX_LENGTH, DMA_FROM_DEVICE);
|
MAX_RX_LENGTH, DMA_FROM_DEVICE);
|
||||||
re->rx_dma[i] = dma_addr;
|
re->rx_dma[i] = dma_addr;
|
||||||
re->rx[i].rxd1 = (unsigned int) re->rx_dma[i];
|
re->rx[i].rxd1 = (unsigned int) re->rx_dma[i];
|
||||||
@ -234,7 +234,8 @@ ramips_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dev->trans_start = jiffies;
|
dev->trans_start = jiffies;
|
||||||
mapped_addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
|
mapped_addr = dma_map_single(&priv->netdev->dev, skb->data, skb->len,
|
||||||
|
DMA_TO_DEVICE);
|
||||||
|
|
||||||
spin_lock(&priv->page_lock);
|
spin_lock(&priv->page_lock);
|
||||||
tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0);
|
tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0);
|
||||||
@ -288,8 +289,8 @@ ramips_eth_rx_hw(unsigned long ptr)
|
|||||||
if (new_skb) {
|
if (new_skb) {
|
||||||
dma_addr_t dma_addr;
|
dma_addr_t dma_addr;
|
||||||
|
|
||||||
dma_unmap_single(NULL, priv->rx_dma[rx], MAX_RX_LENGTH,
|
dma_unmap_single(&priv->netdev->dev, priv->rx_dma[rx],
|
||||||
DMA_FROM_DEVICE);
|
MAX_RX_LENGTH, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
skb_put(rx_skb, pktlen);
|
skb_put(rx_skb, pktlen);
|
||||||
rx_skb->dev = dev;
|
rx_skb->dev = dev;
|
||||||
@ -302,7 +303,7 @@ ramips_eth_rx_hw(unsigned long ptr)
|
|||||||
priv->rx_skb[rx] = new_skb;
|
priv->rx_skb[rx] = new_skb;
|
||||||
skb_reserve(new_skb, NET_IP_ALIGN);
|
skb_reserve(new_skb, NET_IP_ALIGN);
|
||||||
|
|
||||||
dma_addr = dma_map_single(NULL,
|
dma_addr = dma_map_single(&priv->netdev->dev,
|
||||||
new_skb->data,
|
new_skb->data,
|
||||||
MAX_RX_LENGTH,
|
MAX_RX_LENGTH,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
|
Loading…
Reference in New Issue
Block a user