Thread (7 messages) 7 messages, 3 authors, 2017-12-07

Re: [PATCH net-next v4 1/4] phylib: Add device reset delay support

flat view

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2017-12-07 14:52:22
Also in: linux-devicetree, lkml

Hi Richard,

On Thu, Dec 7, 2017 at 3:43 PM, Richard Leitner [off-list ref] wrote:
quoted hunk ↗ jump to hunk
--- a/drivers/net/phy/mdio_device.c
+++ b/drivers/net/phy/mdio_device.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/unistd.h>
+#include <linux/delay.h>

 void mdio_device_free(struct mdio_device *mdiodev)
 {
@@ -118,8 +119,16 @@ EXPORT_SYMBOL(mdio_device_remove);

 void mdio_device_reset(struct mdio_device *mdiodev, int value)
 {
-       if (mdiodev->reset)
-               gpiod_set_value(mdiodev->reset, value);
+       unsigned int d;
+
+       if (!mdiodev->reset)
+               return;
+
+       gpiod_set_value(mdiodev->reset, value);
+
+       d = value ? mdiodev->reset_delay : mdiodev->reset_post_delay;
+       if (d)
+               usleep_range(d, d + min_t(unsigned int, d / 10, 100));
Oops, I meant "max_t", not "min_t", else the upper limit can be "d + 0",
which is not what we want.

Sorry, my fault.

Gr{oetje,eeting}s,

                        Geert
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help