Skip to contentSkip to conversation

stmmac: if force_thresh_dma_mode is set, pass tc to both txmode and rxmode in tx_hard_error_bump_tc interrupt

PATCH Applied Sonic Zhang 3 participants 8 messages Jan 22, 2015 – Jan 27, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 stmmac: if force_thresh_dma_mode is set, pass tc to both txmode and rxmode in tx_hard_error_bump_tc interrupt

From: Sonic Zhang <[email protected]>

Dont' pass SF_DMA_MODE to rxmode in this case.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -1
index 8c6b7c1..5edfc8a 100644
@@ -1446,7 +1446,11 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv)
 		/* Try to bump up the dma threshold on this failure */
 		if (unlikely(tc != SF_DMA_MODE) && (tc <= 256)) {
 			tc += 64;
-			priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE);
+			if (priv->plat->force_thresh_dma_mode)
+				priv->hw->dma->dma_mode(priv->ioaddr, tc, tc);
+			else
+				priv->hw->dma->dma_mode(priv->ioaddr, tc,
+					SF_DMA_MODE);
 			priv->xstats.threshold = tc;
 		}
 	} else if (unlikely(status == tx_hard_error))
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 stmmac: hardware TX COE doesn't work when force_thresh_dma_mode is set

From: Sonic Zhang <[email protected]>

Clear the TX COE bit when force_thresh_dma_mode is set even hardware dma capability says support.

Tested on BF609.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -1
index 5edfc8a..7a7385a 100644
@@ -2746,7 +2746,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 		priv->plat->enh_desc = priv->dma_cap.enh_desc;
 		priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
 
-		priv->plat->tx_coe = priv->dma_cap.tx_coe;
+		/* TXCOE doesn't work in thresh DMA mode */
+		if (priv->plat->force_thresh_dma_mode)
+			priv->plat->tx_coe = 0;
+		else
+			priv->plat->tx_coe = priv->dma_cap.tx_coe;
 
 		if (priv->dma_cap.rx_coe_type2)
 			priv->plat->rx_coe = STMMAC_RX_COE_TYPE2;
Signature · 1 line
1.7.9.5
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] stmmac: hardware TX COE doesn't work when force_thresh_dma_mode is set

Quoted 8 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

Clear the TX COE bit when force_thresh_dma_mode is set even hardware dma capability says support.

Tested on BF609.

Quoted 22 lines
---
  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -1
index 5edfc8a..7a7385a 100644
@@ -2746,7 +2746,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
  		priv->plat->enh_desc = priv->dma_cap.enh_desc;
  		priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
 
-		priv->plat->tx_coe = priv->dma_cap.tx_coe;
+		/* TXCOE doesn't work in thresh DMA mode */
+		if (priv->plat->force_thresh_dma_mode)
+			priv->plat->tx_coe = 0;
+		else
+			priv->plat->tx_coe = priv->dma_cap.tx_coe;
 
  		if (priv->dma_cap.rx_coe_type2)
  			priv->plat->rx_coe = STMMAC_RX_COE_TYPE2;
#4 lore raw

PATCH 3/3 stmmac: Add an optional device tree property "snps,burst_len"

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

This property define the AXI bug lenth.

---
 Documentation/devicetree/bindings/net/stmmac.txt   |    1 +
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |    3 +++
 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/net/stmmac.txt +1 -0
index c41afd9..8ca65ce 100644
@@ -43,6 +43,7 @@ Optional properties:
   available this clock is used for programming the Timestamp Addend Register.
   If not passed then the system clock will be used and this is fine on some
   platforms.
+- snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register.
 
 Examples:
 
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
index 3039de2..a20cf0d 100644
@@ -234,6 +234,9 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 			of_property_read_bool(np, "snps,fixed-burst");
 		dma_cfg->mixed_burst =
 			of_property_read_bool(np, "snps,mixed-burst");
+		of_property_read_u32(np, "snps,burst_len", &dma_cfg->burst_len);
+		if (dma_cfg->burst_len < 0 || dma_cfg->burst_len > 256)
+			dma_cfg->burst_len = 0;
 	}
 	plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
 	if (plat->force_thresh_dma_mode) {
Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCH 3/3] stmmac: Add an optional device tree property "snps,burst_len"

Quoted 3 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

This property define the AXI bug lenth.

Hello

I can accept this patch for now. So thx :-)

FYI, I will send a set of patches to program the AXI Bus mode register providing more parameters from DT.

Peppe

Quoted 34 lines
---
  Documentation/devicetree/bindings/net/stmmac.txt   |    1 +
  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |    3 +++
  2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/net/stmmac.txt +1 -0
index c41afd9..8ca65ce 100644
@@ -43,6 +43,7 @@ Optional properties:
    available this clock is used for programming the Timestamp Addend Register.
    If not passed then the system clock will be used and this is fine on some
    platforms.
+- snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register.
 
  Examples:
 
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
index 3039de2..a20cf0d 100644
@@ -234,6 +234,9 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
  			of_property_read_bool(np, "snps,fixed-burst");
  		dma_cfg->mixed_burst =
  			of_property_read_bool(np, "snps,mixed-burst");
+		of_property_read_u32(np, "snps,burst_len", &dma_cfg->burst_len);
+		if (dma_cfg->burst_len < 0 || dma_cfg->burst_len > 256)
+			dma_cfg->burst_len = 0;
  	}
  	plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
  	if (plat->force_thresh_dma_mode) {