aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2012-05-13 18:18:42 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-14 18:53:19 -0400
commitb9cde0a8be876c680cc549daa6246256864473fb (patch)
treef9c3c69c40ecd673a77148ec0712d1f2e3f2309e
parentcffb13f4d6fb5976f907c37e7fc7f6e6acb10d5f (diff)
stmmac: add mixed burst for DMA
In mixed burst (MB) mode, the AHB master always initiates the bursts with fixed-size when the DMA requests transfers of size less than or equal to 16 beats. This patch adds the MB support and the flag that can be passed from the platform to select it. MB mode can also give some benefits in terms of performances on some platforms. v2: fixed Coding Style Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac1000.h1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c4
-rw-r--r--include/linux/stmmac.h1
6 files changed, 13 insertions, 5 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 7164509e3832..bcd54d6e94fd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -247,8 +247,8 @@ struct stmmac_desc_ops {
247 247
248struct stmmac_dma_ops { 248struct stmmac_dma_ops {
249 /* DMA core initialization */ 249 /* DMA core initialization */
250 int (*init) (void __iomem *ioaddr, int pbl, int fb, int burst_len, 250 int (*init) (void __iomem *ioaddr, int pbl, int fb, int mb,
251 u32 dma_tx, u32 dma_rx); 251 int burst_len, u32 dma_tx, u32 dma_rx);
252 /* Dump DMA registers */ 252 /* Dump DMA registers */
253 void (*dump_regs) (void __iomem *ioaddr); 253 void (*dump_regs) (void __iomem *ioaddr);
254 /* Set tx/rx threshold in the csr6 register 254 /* Set tx/rx threshold in the csr6 register
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
index 1527f4ecd11a..23478bf4ed7a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
@@ -141,6 +141,7 @@ enum rx_tx_priority_ratio {
141}; 141};
142 142
143#define DMA_BUS_MODE_FB 0x00010000 /* Fixed burst */ 143#define DMA_BUS_MODE_FB 0x00010000 /* Fixed burst */
144#define DMA_BUS_MODE_MB 0x04000000 /* Mixed burst */
144#define DMA_BUS_MODE_RPBL_MASK 0x003e0000 /* Rx-Programmable Burst Len */ 145#define DMA_BUS_MODE_RPBL_MASK 0x003e0000 /* Rx-Programmable Burst Len */
145#define DMA_BUS_MODE_RPBL_SHIFT 17 146#define DMA_BUS_MODE_RPBL_SHIFT 17
146#define DMA_BUS_MODE_USP 0x00800000 147#define DMA_BUS_MODE_USP 0x00800000
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index 3675c5731565..033500090f55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -31,7 +31,7 @@
31#include "dwmac_dma.h" 31#include "dwmac_dma.h"
32 32
33static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb, 33static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb,
34 int burst_len, u32 dma_tx, u32 dma_rx) 34 int mb, int burst_len, u32 dma_tx, u32 dma_rx)
35{ 35{
36 u32 value = readl(ioaddr + DMA_BUS_MODE); 36 u32 value = readl(ioaddr + DMA_BUS_MODE);
37 int limit; 37 int limit;
@@ -66,6 +66,10 @@ static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb,
66 if (fb) 66 if (fb)
67 value |= DMA_BUS_MODE_FB; 67 value |= DMA_BUS_MODE_FB;
68 68
69 /* Mixed Burst has no effect when fb is set */
70 if (mb)
71 value |= DMA_BUS_MODE_MB;
72
69#ifdef CONFIG_STMMAC_DA 73#ifdef CONFIG_STMMAC_DA
70 value |= DMA_BUS_MODE_DA; /* Rx has priority over tx */ 74 value |= DMA_BUS_MODE_DA; /* Rx has priority over tx */
71#endif 75#endif
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index 92ed2e07609e..c2b4d55a79b6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -33,7 +33,7 @@
33#include "dwmac_dma.h" 33#include "dwmac_dma.h"
34 34
35static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb, 35static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb,
36 int burst_len, u32 dma_tx, u32 dma_rx) 36 int mb, int burst_len, u32 dma_tx, u32 dma_rx)
37{ 37{
38 u32 value = readl(ioaddr + DMA_BUS_MODE); 38 u32 value = readl(ioaddr + DMA_BUS_MODE);
39 int limit; 39 int limit;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a9699ae49add..d1d084018877 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -925,6 +925,7 @@ static void stmmac_check_ether_addr(struct stmmac_priv *priv)
925static int stmmac_init_dma_engine(struct stmmac_priv *priv) 925static int stmmac_init_dma_engine(struct stmmac_priv *priv)
926{ 926{
927 int pbl = DEFAULT_DMA_PBL, fixed_burst = 0, burst_len = 0; 927 int pbl = DEFAULT_DMA_PBL, fixed_burst = 0, burst_len = 0;
928 int mixed_burst = 0;
928 929
929 /* Some DMA parameters can be passed from the platform; 930 /* Some DMA parameters can be passed from the platform;
930 * in case of these are not passed we keep a default 931 * in case of these are not passed we keep a default
@@ -932,10 +933,11 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
932 if (priv->plat->dma_cfg) { 933 if (priv->plat->dma_cfg) {
933 pbl = priv->plat->dma_cfg->pbl; 934 pbl = priv->plat->dma_cfg->pbl;
934 fixed_burst = priv->plat->dma_cfg->fixed_burst; 935 fixed_burst = priv->plat->dma_cfg->fixed_burst;
936 mixed_burst = priv->plat->dma_cfg->mixed_burst;
935 burst_len = priv->plat->dma_cfg->burst_len; 937 burst_len = priv->plat->dma_cfg->burst_len;
936 } 938 }
937 939
938 return priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, 940 return priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, mixed_burst,
939 burst_len, priv->dma_tx_phy, 941 burst_len, priv->dma_tx_phy,
940 priv->dma_rx_phy); 942 priv->dma_rx_phy);
941} 943}
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index f85c93d6e6da..b69bdb1e08b6 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -86,6 +86,7 @@ struct stmmac_mdio_bus_data {
86struct stmmac_dma_cfg { 86struct stmmac_dma_cfg {
87 int pbl; 87 int pbl;
88 int fixed_burst; 88 int fixed_burst;
89 int mixed_burst;
89 int burst_len; 90 int burst_len;
90}; 91};
91 92