Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Paul Barker <pbarker@konsulko.com>
To: Woojung Huh <woojung.huh@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S . Miller" <davem@davemloft.net>
Cc: Paul Barker <pbarker@konsulko.com>, netdev@vger.kernel.org
Subject: [PATCH 4/4] net: dsa: microchip: Implement recommended reset timing
Date: Sat,  5 Sep 2020 15:03:25 +0100	[thread overview]
Message-ID: <20200905140325.108846-5-pbarker@konsulko.com> (raw)
In-Reply-To: <20200905140325.108846-1-pbarker@konsulko.com>

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 mdelay() 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>
---
 drivers/net/dsa/microchip/ksz_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 8d53b12d40a8..a31738662d95 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -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);
-- 
2.28.0


  parent reply	other threads:[~2020-09-05 14:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05 14:03 [PATCH 0/4] ksz9477 dsa switch driver improvements Paul Barker
2020-09-05 14:03 ` [PATCH 1/4] net: dsa: microchip: Make switch detection more informative Paul Barker
2020-09-05 15:28   ` Andrew Lunn
2020-09-05 14:03 ` [PATCH 2/4] net: dsa: microchip: Add debug print for XMII port mode Paul Barker
2020-09-05 15:31   ` Andrew Lunn
2020-09-05 14:03 ` [PATCH 3/4] net: dsa: microchip: Disable RGMII in-band status on KSZ9893 Paul Barker
2020-09-05 15:32   ` Andrew Lunn
2020-09-05 15:53     ` Paul Barker
2020-09-05 16:04       ` Florian Fainelli
2020-09-05 16:06       ` Andrew Lunn
2020-09-05 14:03 ` Paul Barker [this message]
2020-09-05 15:34 ` [PATCH 0/4] ksz9477 dsa switch driver improvements Andrew Lunn
2020-09-05 15:54   ` Paul Barker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200905140325.108846-5-pbarker@konsulko.com \
    --to=pbarker@konsulko.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    --subject='Re: [PATCH 4/4] net: dsa: microchip: Implement recommended reset timing' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).