driver:net:stmmac: Disable DMA store and forward mode if platform data force_thresh_dma_mode is set.
Subsystems (6)
PATCH v5 1/1 driver:net:stmmac: Disable DMA store and forward mode if platform data force_thresh_dma_mode is set.
From: Sonic Zhang <[email protected]>
Some synopsys ip implementation doesn't support DMA store and forward mode, such as BF60x. So, set force_thresh_dma_mode to use DMA thresholds only. Update document and devicetree as well.
--- Documentation/devicetree/bindings/net/stmmac.txt | 5 +++++ Documentation/networking/stmmac.txt | 3 +++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 +++++ include/linux/stmmac.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/stmmac.txt +5 -0
@@ -22,6 +22,11 @@ Required properties: - snps,pbl Programmable Burst Length - snps,fixed-burst Program the DMA to use the fixed burst mode - snps,mixed-burst Program the DMA to use the mixed burst mode +- snps,force_thresh_dma_mode Force DMA to use the threshold mode for + both tx and rx +- snps,force_sf_dma_mode Force DMA to use the Store and Forward + mode for both tx and rx. This flag is + ignored if force_thresh_dma_mode is set. Optional properties: - mac-address: 6 bytes, mac address
Documentation/networking/stmmac.txt +3 -0
@@ -123,6 +123,7 @@ struct plat_stmmacenet_data { int bugged_jumbo; int pmt; int force_sf_dma_mode; + int force_thresh_dma_mode; int riwt_off; void (*fix_mac_speed)(void *priv, unsigned int speed); void (*bus_setup)(void __iomem *ioaddr);
@@ -159,6 +160,8 @@ Where: o pmt: core has the embedded power module (optional). o force_sf_dma_mode: force DMA to use the Store and Forward mode instead of the Threshold. + o force_thresh_dma_mode: force DMA to use the Shreshold mode other than + the Store and Forward mode. o riwt_off: force to disable the RX watchdog feature and switch to NAPI mode. o fix_mac_speed: this callback is used for modifying some syscfg registers (on ST SoCs) according to the link speed negotiated by the
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -1
@@ -1224,7 +1224,9 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)*/ static void stmmac_dma_operation_mode (struct stmmac_priv *priv) { -if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) { +if (priv->plat->force_thresh_dma_mode) + priv->hw->dma->dma_mode (priv->ioaddr, tc, tc); +else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {/* * In case of GMAC, SF mode can be enabled * to perform the TX COE in HW. This depends on:
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +5 -0
@@ -79,6 +79,11 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,of_property_read_u32 (np,"snps,pbl" , &dma_cfg->pbl); dma_cfg->fixed_burst =of_property_read_bool (np,"snps,fixed-burst" ); dma_cfg->mixed_burst =of_property_read_bool (np,"snps,mixed-burst" ); + plat->force_thresh_dma_mode =of_property_read_bool (np,"snps,force_thresh_dma_mode" ); +if (plat->force_thresh_dma_mode) { + plat->force_sf_dma_mode =0 ; +pr_warn ("force_sf_dma_mode is ignored if force_thresh_dma_mode is set." ); + }return 0 ; }
include/linux/stmmac.h +1 -0
@@ -108,6 +108,7 @@ struct plat_stmmacenet_data {int bugged_jumbo;int pmt;int force_sf_dma_mode; +int force_thresh_dma_mode;int riwt_off;void (*fix_mac_speed)(void *priv,unsigned int speed);void (*bus_setup)(void __iomem *ioaddr);
Signature · 1 line
1.8.2.3
Quoted 7 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
Some synopsys ip implementation doesn't support DMA store and forward mode, such as BF60x. So, set
force_thresh_dma_modeto use DMA thresholds only. Update document and devicetree as well.Signed-off-by Sonic Zhang <[email protected]>
Quoted 89 lines
--- Documentation/devicetree/bindings/net/stmmac.txt | 5 +++++ Documentation/networking/stmmac.txt | 3 +++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 +++++ include/linux/stmmac.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/net/stmmac.txt +5
-0@@ -22,6 +22,11 @@ Required properties: - snps,pbl Programmable Burst Length - snps,fixed-burst Program the DMA to use the fixed burst mode - snps,mixed-burst Program the DMA to use the mixed burst mode +- snps,force_thresh_dma_mode Force DMA to use the threshold mode for + both tx and rx +- snps,force_sf_dma_mode Force DMA to use the Store and Forward + mode for both tx and rx. This flag is + ignored if force_thresh_dma_mode is set. Optional properties: - mac-address: 6 bytes, mac addressDocumentation/networking/stmmac.txt +3
-0@@ -123,6 +123,7 @@ struct plat_stmmacenet_data { int bugged_jumbo; int pmt; int force_sf_dma_mode; + int force_thresh_dma_mode; int riwt_off; void (*fix_mac_speed)(void *priv, unsigned int speed); void (*bus_setup)(void __iomem *ioaddr);@@ -159,6 +160,8 @@ Where: o pmt: core has the embedded power module (optional). o force_sf_dma_mode: force DMA to use the Store and Forward mode instead of the Threshold. + o force_thresh_dma_mode: force DMA to use the Shreshold mode other than + the Store and Forward mode. o riwt_off: force to disable the RX watchdog feature and switch to NAPI mode. o fix_mac_speed: this callback is used for modifying some syscfg registers (on ST SoCs) according to the link speed negotiated by thedrivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3
-1@@ -1224,7 +1224,9 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)*/ static void stmmac_dma_operation_mode (struct stmmac_priv *priv) { -if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) { +if (priv->plat->force_thresh_dma_mode) + priv->hw->dma->dma_mode (priv->ioaddr, tc, tc); +else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {/* * In case of GMAC, SF mode can be enabled * to perform the TX COE in HW. This depends on: drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +5
-0@@ -79,6 +79,11 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,of_property_read_u32 (np,"snps,pbl" , &dma_cfg->pbl); dma_cfg->fixed_burst =of_property_read_bool (np,"snps,fixed-burst" ); dma_cfg->mixed_burst =of_property_read_bool (np,"snps,mixed-burst" ); + plat->force_thresh_dma_mode =of_property_read_bool (np,"snps,force_thresh_dma_mode" ); +if (plat->force_thresh_dma_mode) { + plat->force_sf_dma_mode =0 ; +pr_warn ("force_sf_dma_mode is ignored if force_thresh_dma_mode is set." ); + }return 0 ; }include/linux/stmmac.h +1
-0@@ -108,6 +108,7 @@ struct plat_stmmacenet_data {int bugged_jumbo;int pmt;int force_sf_dma_mode; +int force_thresh_dma_mode;int riwt_off;void (*fix_mac_speed)(void *priv,unsigned int speed);void (*bus_setup)(void __iomem *ioaddr);
Hi Peppe,
When can you send me your fragmented frame patch to solve the tx_coe problem on Blackfin?
Thanks
Sonic
Quoted 118 lines · Giuseppe CAVALLARO
Quoted 9 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
Some synopsys ip implementation doesn't support DMA store and forward mode,
such as BF60x. So, setforce_thresh_dma_modeto use DMA thresholds only. Update document and devicetree as well.Signed-off-by Sonic Zhang <[email protected]>Quoted 102 lines
--- Documentation/devicetree/bindings/net/stmmac.txt | 5 +++++ Documentation/networking/stmmac.txt | 3 +++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 +++++ include/linux/stmmac.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/net/stmmac.txt +5
-0@@ -22,6 +22,11 @@ Required properties: - snps,pbl Programmable Burst Length - snps,fixed-burst Program the DMA to use the fixed burst mode - snps,mixed-burst Program the DMA to use the mixed burst mode +- snps,force_thresh_dma_mode Force DMA to use the threshold mode for + both tx and rx +- snps,force_sf_dma_mode Force DMA to use the Store and Forward + mode for both tx and rx. This flag is + ignored if force_thresh_dma_mode is set. Optional properties: - mac-address: 6 bytes, mac addressDocumentation/networking/stmmac.txt +3
-0@@ -123,6 +123,7 @@ struct plat_stmmacenet_data { int bugged_jumbo; int pmt; int force_sf_dma_mode; + int force_thresh_dma_mode; int riwt_off; void (*fix_mac_speed)(void *priv, unsigned int speed); void (*bus_setup)(void __iomem *ioaddr);@@ -159,6 +160,8 @@ Where: o pmt: core has the embedded power module (optional). o force_sf_dma_mode: force DMA to use the Store and Forward mode instead of the Threshold. + o force_thresh_dma_mode: force DMA to use the Shreshold mode other than + the Store and Forward mode. o riwt_off: force to disable the RX watchdog feature and switch to NAPImode.
ofix_mac_speed: this callback is used for modifying some syscfg
registers
(on ST SoCs) according to the link speed negotiated by
thedrivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3
-1@@ -1224,7 +1224,9 @@ static void free_dma_desc_resources(structstmmac_priv *priv) */ static void stmmac_dma_operation_mode (struct stmmac_priv *priv) { -if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) { +if (priv->plat->force_thresh_dma_mode) + priv->hw->dma->dma_mode (priv->ioaddr, tc, tc); +else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {/* * In case of GMAC, SF mode can be enabled * to perform the TX COE in HW. This depends on:
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1
-0@@ -79,6 +79,11 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,of_property_read_u32 (np,"snps,pbl" , &dma_cfg->pbl); dma_cfg->fixed_burst =of_property_read_bool (np,"snps,fixed-burst" ); dma_cfg->mixed_burst =of_property_read_bool (np,"snps,mixed-burst" ); + plat->force_thresh_dma_mode = of_property_read_bool(np,"snps,force_thresh_dma_mode");
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3
-0+if (plat->force_thresh_dma_mode) { + plat->force_sf_dma_mode =0 ; + pr_warn("force_sf_dma_mode is ignored if
force_thresh_dma_modeis set.");drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1
-0+ }return 0 ; }include/linux/stmmac.h +1
-0@@ -108,6 +108,7 @@ struct plat_stmmacenet_data {int bugged_jumbo;int pmt;int force_sf_dma_mode; +int force_thresh_dma_mode;int riwt_off;void (*fix_mac_speed)(void *priv,unsigned int speed);void (*bus_setup)(void __iomem *ioaddr);
From: Giuseppe CAVALLARO <[email protected]>
Date: Wed, 28 Aug 2013 13:59:51 +0200
Quoted 9 lines · Sonic Zhang
Quoted 8 lines
From: Sonic Zhang <[email protected]>
Some synopsys ip implementation doesn't support DMA store and forward mode,
such as BF60x. So, setforce_thresh_dma_modeto use DMA thresholds only.
Update document and devicetree as well.
Quoted 3 lines
Quoted 1 line
Signed-off-by Sonic Zhang <[email protected]>
Applied, thanks.