summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlison Wang <b18965@freescale.com>2014-09-05 13:52:37 +0800
committerYork Sun <yorksun@freescale.com>2014-09-08 10:30:33 -0700
commitd2614ea0ffda9d7c0d049f0fa5b23ce390bcb7a8 (patch)
treefc016e14fff7617735b71a52dd56cbf302ff460a
parent93f26f130eede8db0cb47afcaf66016987b91731 (diff)
downloadu-boot-imx-d2614ea0ffda9d7c0d049f0fa5b23ce390bcb7a8.zip
u-boot-imx-d2614ea0ffda9d7c0d049f0fa5b23ce390bcb7a8.tar.gz
u-boot-imx-d2614ea0ffda9d7c0d049f0fa5b23ce390bcb7a8.tar.bz2
net: mdio: Use mb() to be compatible for both ARM and PowerPC
Use mb() instead of sync assembly instruction to be compatible for both ARM and PowerPC. Signed-off-by: Alison Wang <alison.wang@freescale.com>
-rw-r--r--drivers/net/fsl_mdio.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c
index 8d09f5d..d6b181b 100644
--- a/drivers/net/fsl_mdio.c
+++ b/drivers/net/fsl_mdio.c
@@ -19,7 +19,8 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,
out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f));
out_be32(&phyregs->miimcon, value);
- asm("sync");
+ /* Memory barrier */
+ mb();
while ((in_be32(&phyregs->miimind) & MIIMIND_BUSY) && timeout--)
;
@@ -37,11 +38,13 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,
/* Clear the command register, and wait */
out_be32(&phyregs->miimcom, 0);
- asm("sync");
+ /* Memory barrier */
+ mb();
/* Initiate a read command, and wait */
out_be32(&phyregs->miimcom, MIIMCOM_READ_CYCLE);
- asm("sync");
+ /* Memory barrier */
+ mb();
/* Wait for the the indication that the read is done */
while ((in_be32(&phyregs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))