Skip to content
Snippets Groups Projects
Commit d2614ea0 authored by Alison Wang's avatar Alison Wang Committed by York Sun
Browse files

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: default avatarAlison Wang <alison.wang@freescale.com>
parent 93f26f13
Branches
Tags
No related merge requests found
...@@ -19,7 +19,8 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr, ...@@ -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->miimadd, (port_addr << 8) | (regnum & 0x1f));
out_be32(&phyregs->miimcon, value); out_be32(&phyregs->miimcon, value);
asm("sync"); /* Memory barrier */
mb();
while ((in_be32(&phyregs->miimind) & MIIMIND_BUSY) && timeout--) 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, ...@@ -37,11 +38,13 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,
/* Clear the command register, and wait */ /* Clear the command register, and wait */
out_be32(&phyregs->miimcom, 0); out_be32(&phyregs->miimcom, 0);
asm("sync"); /* Memory barrier */
mb();
/* Initiate a read command, and wait */ /* Initiate a read command, and wait */
out_be32(&phyregs->miimcom, MIIMCOM_READ_CYCLE); out_be32(&phyregs->miimcom, MIIMCOM_READ_CYCLE);
asm("sync"); /* Memory barrier */
mb();
/* Wait for the the indication that the read is done */ /* Wait for the the indication that the read is done */
while ((in_be32(&phyregs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY)) while ((in_be32(&phyregs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment