]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
stmmac: add mixed burst for DMA
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Sun, 13 May 2012 22:18:42 +0000 (22:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 May 2012 22:53:19 +0000 (18:53 -0400)
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>
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/linux/stmmac.h

index 7164509e3832d9d6f48b0c2bfdff2d7d6acb291e..bcd54d6e94fda40e57526c96e2bb52eba63328a5 100644 (file)
@@ -247,8 +247,8 @@ struct stmmac_desc_ops {
 
 struct stmmac_dma_ops {
        /* DMA core initialization */
-       int (*init) (void __iomem *ioaddr, int pbl, int fb, int burst_len,
-                       u32 dma_tx, u32 dma_rx);
+       int (*init) (void __iomem *ioaddr, int pbl, int fb, int mb,
+                    int burst_len, u32 dma_tx, u32 dma_rx);
        /* Dump DMA registers */
        void (*dump_regs) (void __iomem *ioaddr);
        /* Set tx/rx threshold in the csr6 register
index 1527f4ecd11acb67caca289263adf97da927dadd..23478bf4ed7ae563e54369ed0b87d53480c8b83e 100644 (file)
@@ -141,6 +141,7 @@ enum rx_tx_priority_ratio {
 };
 
 #define DMA_BUS_MODE_FB                0x00010000      /* Fixed burst */
+#define DMA_BUS_MODE_MB                0x04000000      /* Mixed burst */
 #define DMA_BUS_MODE_RPBL_MASK 0x003e0000      /* Rx-Programmable Burst Len */
 #define DMA_BUS_MODE_RPBL_SHIFT        17
 #define DMA_BUS_MODE_USP       0x00800000
index 3675c573156555560af2f33e8fd95d69037c721b..033500090f552aedbbc7bddb99e6acd77395ef69 100644 (file)
@@ -31,7 +31,7 @@
 #include "dwmac_dma.h"
 
 static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb,
-                             int burst_len, u32 dma_tx, u32 dma_rx)
+                             int mb, int burst_len, u32 dma_tx, u32 dma_rx)
 {
        u32 value = readl(ioaddr + DMA_BUS_MODE);
        int limit;
@@ -66,6 +66,10 @@ static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb,
        if (fb)
                value |= DMA_BUS_MODE_FB;
 
+       /* Mixed Burst has no effect when fb is set */
+       if (mb)
+               value |= DMA_BUS_MODE_MB;
+
 #ifdef CONFIG_STMMAC_DA
        value |= DMA_BUS_MODE_DA;       /* Rx has priority over tx */
 #endif
index 92ed2e07609ef82cba0310565845743b8fa0b553..c2b4d55a79b69431835003d7e5f423177cad7637 100644 (file)
@@ -33,7 +33,7 @@
 #include "dwmac_dma.h"
 
 static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb,
-                            int burst_len, u32 dma_tx, u32 dma_rx)
+                            int mb, int burst_len, u32 dma_tx, u32 dma_rx)
 {
        u32 value = readl(ioaddr + DMA_BUS_MODE);
        int limit;
index a9699ae49add535f95dfe9e1e1202c6c931bdebc..d1d084018877a2c73fed37143f58f1db7f1ba74a 100644 (file)
@@ -925,6 +925,7 @@ static void stmmac_check_ether_addr(struct stmmac_priv *priv)
 static int stmmac_init_dma_engine(struct stmmac_priv *priv)
 {
        int pbl = DEFAULT_DMA_PBL, fixed_burst = 0, burst_len = 0;
+       int mixed_burst = 0;
 
        /* Some DMA parameters can be passed from the platform;
         * 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)
        if (priv->plat->dma_cfg) {
                pbl = priv->plat->dma_cfg->pbl;
                fixed_burst = priv->plat->dma_cfg->fixed_burst;
+               mixed_burst = priv->plat->dma_cfg->mixed_burst;
                burst_len = priv->plat->dma_cfg->burst_len;
        }
 
-       return priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst,
+       return priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, mixed_burst,
                                   burst_len, priv->dma_tx_phy,
                                   priv->dma_rx_phy);
 }
index f85c93d6e6dab25a8fdd8b5810932891bb3370b2..b69bdb1e08b674f81b372a0dcab0ed2b5ec47038 100644 (file)
@@ -86,6 +86,7 @@ struct stmmac_mdio_bus_data {
 struct stmmac_dma_cfg {
        int pbl;
        int fixed_burst;
+       int mixed_burst;
        int burst_len;
 };