[U-Boot] [Patch V3 04/16] net/fm/eth: Use mb() to be compatible for both ARM and PowerPC
Gong Qianyu
Qianyu.Gong at freescale.com
Fri Sep 25 14:31:57 CEST 2015
From: Shaohui Xie <Shaohui.Xie at freescale.com>
Use mb() instead of sync() to be compatible for both ARM and PowerPC.
Signed-off-by: Shaohui Xie <Shaohui.Xie at freescale.com>
Signed-off-by: Mingkai Hu <Mingkai.Hu at freescale.com>
Signed-off-by: Gong Qianyu <Qianyu.Gong at freescale.com>
---
V3:
- Separated from patch 'net: Move some header files to include/'
drivers/net/fm/eth.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 946b591..5b860cc 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -371,7 +371,7 @@ static void fmc_tx_port_graceful_stop_enable(struct fm_eth *fm_eth)
pram = fm_eth->tx_pram;
/* graceful stop transmission of frames */
setbits_be32(&pram->mode, PRAM_MODE_GRACEFUL_STOP);
- sync();
+ mb();
}
static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth)
@@ -381,7 +381,7 @@ static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth)
pram = fm_eth->tx_pram;
/* re-enable transmission of frames */
clrbits_be32(&pram->mode, PRAM_MODE_GRACEFUL_STOP);
- sync();
+ mb();
}
static int fm_eth_open(struct eth_device *dev, bd_t *bd)
@@ -483,9 +483,9 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
muram_writew(&txbd->buf_ptr_hi, 0);
out_be32(&txbd->buf_ptr_lo, (u32)buf);
muram_writew(&txbd->len, len);
- sync();
+ mb();
muram_writew(&txbd->status, TxBD_READY | TxBD_LAST);
- sync();
+ mb();
/* update TxQD, let RISC to send the packet */
offset_in = muram_readw(&pram->txqd.offset_in);
@@ -493,7 +493,7 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
if (offset_in >= muram_readw(&pram->txqd.bd_ring_size))
offset_in = 0;
muram_writew(&pram->txqd.offset_in, offset_in);
- sync();
+ mb();
/* wait for buffer to be transmitted */
for (i = 0; muram_readw(&txbd->status) & TxBD_READY; i++) {
@@ -544,7 +544,7 @@ static int fm_eth_recv(struct eth_device *dev)
/* clear the RxBDs */
muram_writew(&rxbd->status, RxBD_EMPTY);
muram_writew(&rxbd->len, 0);
- sync();
+ mb();
/* advance RxBD */
rxbd++;
@@ -560,7 +560,7 @@ static int fm_eth_recv(struct eth_device *dev)
if (offset_out >= muram_readw(&pram->rxqd.bd_ring_size))
offset_out = 0;
muram_writew(&pram->rxqd.offset_out, offset_out);
- sync();
+ mb();
}
fm_eth->cur_rxbd = (void *)rxbd;
--
2.1.0.27.g96db324
More information about the U-Boot
mailing list