Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170663
b: refs/heads/master
c: 32c513b
h: refs/heads/master
i:
  170661: 9063d1b
  170659: 50d661e
  170655: f95893d
v: v3
  • Loading branch information
Anton Vorontsov authored and David S. Miller committed Oct 13, 2009
1 parent d28fbeb commit 50dbe97
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 826aa4a05669a46e435f65db901186e42bb43d8d
refs/heads/master: 32c513bca062f6c04b902d09c716fea205671e23
17 changes: 8 additions & 9 deletions trunk/drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,15 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
{
struct txbd8 *txbdp;
struct rxbd8 *rxbdp;
dma_addr_t addr = 0;
void *vaddr;
int i;
struct gfar_private *priv = netdev_priv(ndev);
struct device *dev = &priv->ofdev->dev;
struct gfar __iomem *regs = priv->regs;

/* Allocate memory for the buffer descriptors */
vaddr = dma_alloc_coherent(dev, sizeof(*txbdp) * priv->tx_ring_size +
sizeof(*rxbdp) * priv->rx_ring_size,
&addr, GFP_KERNEL);
&priv->tx_bd_dma_base, GFP_KERNEL);
if (!vaddr) {
if (netif_msg_ifup(priv))
pr_err("%s: Could not allocate buffer descriptors!\n",
Expand All @@ -171,14 +169,9 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)

priv->tx_bd_base = vaddr;

/* enet DMA only understands physical addresses */
gfar_write(&regs->tbase0, addr);

/* Start the rx descriptor ring where the tx ring leaves off */
addr = addr + sizeof(*txbdp) * priv->tx_ring_size;
vaddr = vaddr + sizeof(*txbdp) * priv->tx_ring_size;
priv->rx_bd_base = vaddr;
gfar_write(&regs->rbase0, addr);

/* Setup the skbuff rings */
priv->tx_skbuff = kmalloc(sizeof(*priv->tx_skbuff) *
Expand Down Expand Up @@ -256,6 +249,12 @@ static void gfar_init_mac(struct net_device *ndev)
u32 tctrl = 0;
u32 attrs = 0;

/* enet DMA only understands physical addresses */
gfar_write(&regs->tbase0, priv->tx_bd_dma_base);
gfar_write(&regs->rbase0, priv->tx_bd_dma_base +
sizeof(*priv->tx_bd_base) *
priv->tx_ring_size);

/* Configure the coalescing support */
gfar_write(&regs->txic, 0);
if (priv->txcoalescing)
Expand Down Expand Up @@ -1060,7 +1059,7 @@ static void free_skb_resources(struct gfar_private *priv)

dma_free_coherent(dev, sizeof(*txbdp) * priv->tx_ring_size +
sizeof(*rxbdp) * priv->rx_ring_size,
priv->tx_bd_base, gfar_read(&priv->regs->tbase0));
priv->tx_bd_base, priv->tx_bd_dma_base);
}

void gfar_start(struct net_device *dev)
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/gianfar.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ struct gfar_private {
unsigned long txic;

/* Buffer descriptor pointers */
dma_addr_t tx_bd_dma_base;
struct txbd8 *tx_bd_base; /* First tx buffer descriptor */
struct txbd8 *cur_tx; /* Next free ring entry */
struct txbd8 *dirty_tx; /* First buffer in line
Expand Down

0 comments on commit 50dbe97

Please sign in to comment.