[PATCH 3/4] net: designware: reorder execution of write and busy check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of first writing to the MII register and then checking if the
MII operation is finished. Check if there is an ongoing operation and
then write to the MII register.

Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
 drivers/net/designware.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 410658d67b39..104258e21c51 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -92,12 +92,12 @@ static int dwc_ether_mii_write(struct mii_bus *dev, int addr, int reg, u16 val)
 	miiaddr = ((addr << MIIADDRSHIFT) & MII_ADDRMSK) |
 		  ((reg << MIIREGSHIFT) & MII_REGMSK) | MII_WRITE;
 
-	writel(miiaddr | MII_CLKRANGE_150_250M | MII_BUSY, &mac_p->miiaddr);
-
 	ret = dwc_wait_mii_idle(dev);
 	if (ret)
 		return ret;
 
+	writel(miiaddr | MII_CLKRANGE_150_250M | MII_BUSY, &mac_p->miiaddr);
+
 	/* Needed as a fix for ST-Phy */
 	dwc_ether_mii_read(dev, addr, reg);
 	return 0;
-- 
2.19.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux