aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJamie Iles <jamie@jamieiles.com>2011-03-14 13:38:30 -0400
committerJamie Iles <jamie@jamieiles.com>2011-11-22 10:21:20 -0500
commit0116da4fcc1ae8a80d9002441e98768f2a6fa2fe (patch)
tree503b19e91670f415fa5edfae95cd8b52170d417a /drivers/net
parent757a03c6e004fbbdef872cb7ecdc940a891b8e6e (diff)
macb: allow GEM to have configurable receive buffer size
GEM has configurable receive buffer sizes so requires this to be programmed up. Any size < 2048 and a multiple of 64 bytes is permitted. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cadence/macb.c17
-rw-r--r--drivers/net/ethernet/cadence/macb.h5
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 38f1932013d1..64d61461bdc7 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -856,6 +856,21 @@ static u32 macb_dbw(struct macb *bp)
856 } 856 }
857} 857}
858 858
859/*
860 * Configure the receive DMA engine to use the correct receive buffer size.
861 * This is a configurable parameter for GEM.
862 */
863static void macb_configure_dma(struct macb *bp)
864{
865 u32 dmacfg;
866
867 if (macb_is_gem(bp)) {
868 dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L);
869 dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64);
870 gem_writel(bp, DMACFG, dmacfg);
871 }
872}
873
859static void macb_init_hw(struct macb *bp) 874static void macb_init_hw(struct macb *bp)
860{ 875{
861 u32 config; 876 u32 config;
@@ -874,6 +889,8 @@ static void macb_init_hw(struct macb *bp)
874 config |= macb_dbw(bp); 889 config |= macb_dbw(bp);
875 macb_writel(bp, NCFGR, config); 890 macb_writel(bp, NCFGR, config);
876 891
892 macb_configure_dma(bp);
893
877 /* Initialize TX and RX buffers */ 894 /* Initialize TX and RX buffers */
878 macb_writel(bp, RBQP, bp->rx_ring_dma); 895 macb_writel(bp, RBQP, bp->rx_ring_dma);
879 macb_writel(bp, TBQP, bp->tx_ring_dma); 896 macb_writel(bp, TBQP, bp->tx_ring_dma);
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 71424aae9c50..193107884a5a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -64,6 +64,7 @@
64/* GEM register offsets. */ 64/* GEM register offsets. */
65#define GEM_NCFGR 0x0004 65#define GEM_NCFGR 0x0004
66#define GEM_USRIO 0x000c 66#define GEM_USRIO 0x000c
67#define GEM_DMACFG 0x0010
67#define GEM_HRB 0x0080 68#define GEM_HRB 0x0080
68#define GEM_HRT 0x0084 69#define GEM_HRT 0x0084
69#define GEM_SA1B 0x0088 70#define GEM_SA1B 0x0088
@@ -154,6 +155,10 @@
154#define GEM_DBW64 1 155#define GEM_DBW64 1
155#define GEM_DBW128 2 156#define GEM_DBW128 2
156 157
158/* Bitfields in DMACFG. */
159#define GEM_RXBS_OFFSET 16
160#define GEM_RXBS_SIZE 8
161
157/* Bitfields in NSR */ 162/* Bitfields in NSR */
158#define MACB_NSR_LINK_OFFSET 0 163#define MACB_NSR_LINK_OFFSET 0
159#define MACB_NSR_LINK_SIZE 1 164#define MACB_NSR_LINK_SIZE 1