net: mdio: mdio-bcm-unimac: Delay before first poll
authorJustin Chen <justin.chen@broadcom.com>
Wed, 13 Dec 2023 22:27:43 +0000 (14:27 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 15 Dec 2023 01:58:58 +0000 (17:58 -0800)
With a clock interval of 400 nsec and a 64 bit transactions (32 bit
preamble & 16 bit control & 16 bit data), it is reasonable to assume
the mdio transaction will take 25.6 usec. Add a 30 usec delay before
the first poll to reduce the chance of a 1000-2000 usec sleep.

Reduce the timeout from 1000ms to 100ms as it is unlikely for the bus
to take this long.

Signed-off-by: Justin Chen <justin.chen@broadcom.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20231213222744.2891184-2-justin.chen@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mdio/mdio-bcm-unimac.c

index e8cd8eef319bbc169c5e8d98704bc0e5646384dc..297ea4a58d799607f433c63af3ca73de51f88fb8 100644 (file)
@@ -81,7 +81,13 @@ static inline unsigned int unimac_mdio_busy(struct unimac_mdio_priv *priv)
 static int unimac_mdio_poll(void *wait_func_data)
 {
        struct unimac_mdio_priv *priv = wait_func_data;
-       unsigned int timeout = 1000;
+       unsigned int timeout = 100;
+
+       /*
+        * C22 transactions should take ~25 usec, will need to adjust
+        * if C45 support is added.
+        */
+       udelay(30);
 
        do {
                if (!unimac_mdio_busy(priv))