aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShiraz Hashim <shiraz.hashim@st.com>2011-07-17 16:54:08 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-18 13:47:24 -0400
commiteb0dc4bb2e22c04964d6e9545e86f629f117108b (patch)
treec0684b04a86f72d204c8e4e6f28b07ea410e2243
parentbab632d69ee48a106e779b60cc01adfe80a72807 (diff)
stmmac: add memory barriers at appropriate places
This patch, provided by ST SPEAr developers, has fixed a problem raised on ARM CA9 where happened that the dma_transmission was enabled before the dma descriptors were properly filled. To guarantee this data memory barriers have been explicity used in the driver. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/stmmac/stmmac_main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index d4adc806f6f8..c8c9e5bc6608 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1045,6 +1045,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
1045 len, DMA_TO_DEVICE); 1045 len, DMA_TO_DEVICE);
1046 priv->tx_skbuff[entry] = NULL; 1046 priv->tx_skbuff[entry] = NULL;
1047 priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion); 1047 priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion);
1048 wmb();
1048 priv->hw->desc->set_tx_owner(desc); 1049 priv->hw->desc->set_tx_owner(desc);
1049 } 1050 }
1050 1051
@@ -1056,6 +1057,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
1056 if (likely(priv->tm->enable)) 1057 if (likely(priv->tm->enable))
1057 priv->hw->desc->clear_tx_ic(desc); 1058 priv->hw->desc->clear_tx_ic(desc);
1058#endif 1059#endif
1060
1061 wmb();
1062
1059 /* To avoid raise condition */ 1063 /* To avoid raise condition */
1060 priv->hw->desc->set_tx_owner(first); 1064 priv->hw->desc->set_tx_owner(first);
1061 1065
@@ -1118,6 +1122,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
1118 } 1122 }
1119 RX_DBG(KERN_INFO "\trefill entry #%d\n", entry); 1123 RX_DBG(KERN_INFO "\trefill entry #%d\n", entry);
1120 } 1124 }
1125 wmb();
1121 priv->hw->desc->set_rx_owner(p + entry); 1126 priv->hw->desc->set_rx_owner(p + entry);
1122 } 1127 }
1123} 1128}