Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281793
b: refs/heads/master
c: 0116da4
h: refs/heads/master
i:
  281791: 44052fb
v: v3
  • Loading branch information
Jamie Iles committed Nov 22, 2011
1 parent 58d8a25 commit 0069370
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 757a03c6e004fbbdef872cb7ecdc940a891b8e6e
refs/heads/master: 0116da4fcc1ae8a80d9002441e98768f2a6fa2fe
17 changes: 17 additions & 0 deletions trunk/drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,21 @@ static u32 macb_dbw(struct macb *bp)
}
}

/*
* Configure the receive DMA engine to use the correct receive buffer size.
* This is a configurable parameter for GEM.
*/
static void macb_configure_dma(struct macb *bp)
{
u32 dmacfg;

if (macb_is_gem(bp)) {
dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L);
dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64);
gem_writel(bp, DMACFG, dmacfg);
}
}

static void macb_init_hw(struct macb *bp)
{
u32 config;
Expand All @@ -874,6 +889,8 @@ static void macb_init_hw(struct macb *bp)
config |= macb_dbw(bp);
macb_writel(bp, NCFGR, config);

macb_configure_dma(bp);

/* Initialize TX and RX buffers */
macb_writel(bp, RBQP, bp->rx_ring_dma);
macb_writel(bp, TBQP, bp->tx_ring_dma);
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
/* GEM register offsets. */
#define GEM_NCFGR 0x0004
#define GEM_USRIO 0x000c
#define GEM_DMACFG 0x0010
#define GEM_HRB 0x0080
#define GEM_HRT 0x0084
#define GEM_SA1B 0x0088
Expand Down Expand Up @@ -154,6 +155,10 @@
#define GEM_DBW64 1
#define GEM_DBW128 2

/* Bitfields in DMACFG. */
#define GEM_RXBS_OFFSET 16
#define GEM_RXBS_SIZE 8

/* Bitfields in NSR */
#define MACB_NSR_LINK_OFFSET 0
#define MACB_NSR_LINK_SIZE 1
Expand Down

0 comments on commit 0069370

Please sign in to comment.