]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: smmac: allow configuring lower pbl values
authorNiklas Cassel <niklas.cassel@axis.com>
Wed, 7 Dec 2016 14:20:08 +0000 (15:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Dec 2016 18:07:10 +0000 (13:07 -0500)
The driver currently always sets the PBLx8/PBLx4 bit, which means that
the pbl values configured via the pbl/txpbl/rxpbl DT properties are
always multiplied by 8/4 in the hardware.

In order to allow the DT to configure lower pbl values, while at the
same time not changing behavior of any existing device trees using the
pbl/txpbl/rxpbl settings, add a property to disable the multiplication
of the pbl by 8/4 in the hardware.

Suggested-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
Acked-by: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/devicetree/bindings/net/stmmac.txt
Documentation/networking/stmmac.txt
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
include/linux/stmmac.h

index 8080038ff1b2424edf0544919c8fd48a4628b126..128da752fec95bae1e48a987009a4565a1791562 100644 (file)
@@ -39,6 +39,8 @@ Optional properties:
                        If set, DMA tx will use this value rather than snps,pbl.
 - snps,rxpbl           Rx Programmable Burst Length. Only for GMAC and newer.
                        If set, DMA rx will use this value rather than snps,pbl.
+- snps,no-pbl-x8       Don't multiply the pbl/txpbl/rxpbl values by 8.
+                       For core rev < 3.50, don't multiply the values by 4.
 - snps,aal             Address-Aligned Beats
 - snps,fixed-burst     Program the DMA to use the fixed burst mode
 - snps,mixed-burst     Program the DMA to use the mixed burst mode
index 6add57374f70c57880c1a430a93717e976baeef1..2bb07078f535f623ed06773358d82f3ddd420863 100644 (file)
@@ -152,8 +152,9 @@ Where:
  o dma_cfg: internal DMA parameters
    o pbl: the Programmable Burst Length is maximum number of beats to
        be transferred in one DMA transaction.
-       GMAC also enables the 4xPBL by default.
+       GMAC also enables the 4xPBL by default. (8xPBL for GMAC 3.50 and newer)
    o txpbl/rxpbl: GMAC and newer supports independent DMA pbl for tx/rx.
+   o pblx8: Enable 8xPBL (4xPBL for core rev < 3.50). Enabled by default.
    o fixed_burst/mixed_burst/aal
  o clk_csr: fixed CSR Clock range selection.
  o has_gmac: uses the GMAC core.
@@ -208,6 +209,7 @@ struct stmmac_dma_cfg {
        int pbl;
        int txpbl;
        int rxpbl;
+       bool pblx8;
        int fixed_burst;
        int mixed_burst;
        bool aal;
@@ -219,6 +221,7 @@ Where:
         If set, DMA tx will use this value rather than pbl.
  o rxpbl: Receive Programmable Burst Length. Only for GMAC and newer.
         If set, DMA rx will use this value rather than pbl.
+ o pblx8: Enable 8xPBL (4xPBL for core rev < 3.50). Enabled by default.
  o fixed_burst: program the DMA to use the fixed burst mode
  o mixed_burst: program the DMA to use the mixed burst mode
  o aal: Address-Aligned Beats
index 99b8040af592ef1ac57652ce0fc72707cc2469ce..612d3aaac9a42cc0c2e1a705075a08cfca02abd2 100644 (file)
@@ -98,7 +98,8 @@ static void dwmac1000_dma_init(void __iomem *ioaddr,
         * Note: before stmmac core 3.50 this mode bit was 4xPBL, and
         * post 3.5 mode bit acts as 8*PBL.
         */
-       value |= DMA_BUS_MODE_MAXPBL;
+       if (dma_cfg->pblx8)
+               value |= DMA_BUS_MODE_MAXPBL;
        value |= DMA_BUS_MODE_USP;
        value &= ~(DMA_BUS_MODE_PBL_MASK | DMA_BUS_MODE_RPBL_MASK);
        value |= (txpbl << DMA_BUS_MODE_PBL_SHIFT);
index 2c3b2098f350aecb84e6c79e919a55f20f0cf0d2..8196ab5fc33c0b2bfedea016b3f505fff7e5ba52 100644 (file)
@@ -84,7 +84,8 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr,
         * on each channel
         */
        value = readl(ioaddr + DMA_CHAN_CONTROL(channel));
-       value = value | DMA_BUS_MODE_PBL;
+       if (dma_cfg->pblx8)
+               value = value | DMA_BUS_MODE_PBL;
        writel(value, ioaddr + DMA_CHAN_CONTROL(channel));
 
        value = readl(ioaddr + DMA_CHAN_TX_CONTROL(channel));
index 56c8a2342c14744700940db291772e4ec7e1bb9d..a2831773431a6c19d185b2e82e50897aaf7ef7d8 100644 (file)
@@ -81,6 +81,7 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat)
        plat->mdio_bus_data->phy_mask = 0;
 
        plat->dma_cfg->pbl = 32;
+       plat->dma_cfg->pblx8 = true;
        /* TODO: AXI */
 
        /* Set default value for multicast hash bins */
@@ -115,6 +116,7 @@ static int quark_default_data(struct plat_stmmacenet_data *plat,
        plat->mdio_bus_data->phy_mask = 0;
 
        plat->dma_cfg->pbl = 16;
+       plat->dma_cfg->pblx8 = true;
        plat->dma_cfg->fixed_burst = 1;
        /* AXI (TODO) */
 
index 96afe0561c9993f23d02fcfa24b0447ba90dcc20..082cd48db6a769b43507be7442ca6d9ff0099c5f 100644 (file)
@@ -317,6 +317,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                dma_cfg->pbl = DEFAULT_DMA_PBL;
        of_property_read_u32(np, "snps,txpbl", &dma_cfg->txpbl);
        of_property_read_u32(np, "snps,rxpbl", &dma_cfg->rxpbl);
+       dma_cfg->pblx8 = !of_property_read_bool(np, "snps,no-pbl-x8");
 
        dma_cfg->aal = of_property_read_bool(np, "snps,aal");
        dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
index e6d7a594081993139be8173675e5b855d80077b4..266dab9ad78240efbecaa992dba735a7f82d6981 100644 (file)
@@ -90,6 +90,7 @@ struct stmmac_dma_cfg {
        int pbl;
        int txpbl;
        int rxpbl;
+       bool pblx8;
        int fixed_burst;
        int mixed_burst;
        bool aal;