drivers: net: davinci_mdio: remove busy loop on wait user access
authorMaxim Uvarov <muvarov@gmail.com>
Thu, 10 Aug 2017 07:47:46 +0000 (10:47 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Aug 2017 21:23:59 +0000 (14:23 -0700)
Polling 14 mdio devices on single mdio bus eats 30% of 1Ghz cpu time
due to busy loop in wait(). Add small delay to relax cpu.

Signed-off-by: Max Uvarov <muvarov@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/davinci_mdio.c

index 33df340..611e7cc 100644 (file)
@@ -198,8 +198,10 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data)
                        return 0;
 
                reg = __raw_readl(&regs->control);
-               if ((reg & CONTROL_IDLE) == 0)
+               if ((reg & CONTROL_IDLE) == 0) {
+                       usleep_range(100, 200);
                        continue;
+               }
 
                /*
                 * An emac soft_reset may have clobbered the mdio controller's