Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1537778

[PATCH v3 1/6] net: stmmac: return error if no DMA configuration is found

From Niklas Cassel <niklas.cassel@axis.com>
Newsgroups linux.kernel
Subject [PATCH v3 1/6] net: stmmac: return error if no DMA configuration is found
Date 2016-12-07 15:30 +0100
Message-ID <sLLom-1fC-31@gated-at.bofh.it> (permalink)
References <sLLol-1fC-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Niklas Cassel <niklas.cassel@axis.com>

All drivers except pci glue layer calls stmmac_probe_config_dt.
stmmac_probe_config_dt does a kzalloc dma_cfg.

pci glue layer does kzalloc dma_cfg explicitly, so all current
drivers does a kzalloc dma_cfg.

Return an error if no DMA configuration is found, that way
we can assume that the DMA configuration always exists.

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 982c95213da4..14366800e5e6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1578,16 +1578,12 @@ 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, aal = 0;
-	int mixed_burst = 0;
 	int atds = 0;
 	int ret = 0;
 
-	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;
-		aal = priv->plat->dma_cfg->aal;
+	if (!priv->plat->dma_cfg) {
+		dev_err(priv->device, "DMA configuration not found\n");
+		return -EINVAL;
 	}
 
 	if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE))
@@ -1599,8 +1595,12 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
 		return ret;
 	}
 
-	priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, mixed_burst,
-			    aal, priv->dma_tx_phy, priv->dma_rx_phy, atds);
+	priv->hw->dma->init(priv->ioaddr,
+			    priv->plat->dma_cfg->pbl,
+			    priv->plat->dma_cfg->fixed_burst,
+			    priv->plat->dma_cfg->mixed_burst,
+			    priv->plat->dma_cfg->aal,
+			    priv->dma_tx_phy, priv->dma_rx_phy, atds);
 
 	if (priv->synopsys_id >= DWMAC_CORE_4_00) {
 		priv->rx_tail_addr = priv->dma_rx_phy +
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/6] net: stmmac: make DMA programmable burst length more configurable Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
  [PATCH v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT binding Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
    Re: [PATCH v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT  binding Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 10:10 +0100
      Re: [PATCH v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT  binding Niklas Cassel <niklas.cassel@axis.com> - 2016-12-08 10:50 +0100
        Re: [PATCH v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT  binding Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 11:00 +0100
  [PATCH v3 6/6] net: smmac: allow configuring lower pbl values Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
    Re: [PATCH v3 6/6] net: smmac: allow configuring lower pbl values Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 11:50 +0100
      Re: [PATCH v3 6/6] net: smmac: allow configuring lower pbl values Andreas Färber <afaerber@suse.de> - 2016-12-08 15:10 +0100
      Re: [PATCH v3 6/6] net: smmac: allow configuring lower pbl values David Miller <davem@davemloft.net> - 2016-12-08 16:20 +0100
  [PATCH v3 1/6] net: stmmac: return error if no DMA configuration is found Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
    Re: [PATCH v3 1/6] net: stmmac: return error if no DMA configuration  is found Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 11:50 +0100
      Re: [PATCH v3 1/6] net: stmmac: return error if no DMA  configuration is found David Miller <davem@davemloft.net> - 2016-12-08 16:20 +0100
        Re: [PATCH v3 1/6] net: stmmac: return error if no DMA configuration  is found Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 16:50 +0100
  [PATCH v3 2/6] net: stmmac: simplify the common DMA init API Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
    Re: [PATCH v3 2/6] net: stmmac: simplify the common DMA init API Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 10:00 +0100
  [PATCH v3 5/6] net: stmmac: add support for independent DMA pbl for tx/rx Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
    Re: [PATCH v3 5/6] net: stmmac: add support for independent DMA pbl  for tx/rx Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 11:40 +0100
  [PATCH v3 4/6] net: stmmac: dwmac1000: fix define DMA_BUS_MODE_RPBL_MASK Niklas Cassel <niklas.cassel@axis.com> - 2016-12-07 15:30 +0100
    Re: [PATCH v3 4/6] net: stmmac: dwmac1000: fix define  DMA_BUS_MODE_RPBL_MASK Alexandre Torgue <alexandre.torgue@st.com> - 2016-12-08 10:20 +0100
  Re: [PATCH v3 0/6] net: stmmac: make DMA programmable burst length  more configurable David Miller <davem@davemloft.net> - 2016-12-08 19:10 +0100

csiph-web