Skip to content

Commit

Permalink
net: dsa: microchip: Implement recommended reset timing
Browse files Browse the repository at this point in the history
The datasheet for the ksz9893 and ksz9477 switches recommend waiting at
least 100us after the de-assertion of reset before trying to program the
device through any interface.

Also switch the existing msleep() call to usleep_range() as recommended
in Documentation/timers/timers-howto.rst. The 2ms range used here is
somewhat arbitrary, as long as the reset is asserted for at least 10ms
we should be ok.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Paul Barker authored and David S. Miller committed Sep 9, 2020
1 parent ade64eb commit 5b79798
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/dsa/microchip/ksz_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ int ksz_switch_register(struct ksz_device *dev,

if (dev->reset_gpio) {
gpiod_set_value_cansleep(dev->reset_gpio, 1);
mdelay(10);
usleep_range(10000, 12000);
gpiod_set_value_cansleep(dev->reset_gpio, 0);
usleep_range(100, 1000);
}

mutex_init(&dev->dev_mutex);
Expand Down

0 comments on commit 5b79798

Please sign in to comment.