From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <lee.jones@linaro.org>
Cc: <patches@opensource.cirrus.com>, <linux-kernel@vger.kernel.org>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>
Subject: [PATCH v2 1/2] mfd: madera: Increase wait time for silicon reset
Date: Tue, 2 Oct 2018 11:41:33 +0100 [thread overview]
Message-ID: <20181002104134.29003-1-rf@opensource.cirrus.com> (raw)
Based on latest silicon validation, we should allow at least
2 milliseconds after DCVDD enable or hard reset before trying
to communicate with the silicon.
Previously the delay was done as a side-effect of
madera_disable_hard_reset(). As we also need this delay when
enabling DCVDD (with or without hard reset) it is better for it
to be obvious where it happens in every power-up sequence rather
than hidden within another call in some cases. So it has been
moved out into a separate function call.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
drivers/mfd/madera-core.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
index 440030cecbbd..1dedfe68a3dc 100644
--- a/drivers/mfd/madera-core.c
+++ b/drivers/mfd/madera-core.c
@@ -135,6 +135,15 @@ EXPORT_SYMBOL_GPL(madera_name_from_type);
#define MADERA_BOOT_POLL_INTERVAL_USEC 5000
#define MADERA_BOOT_POLL_TIMEOUT_USEC 25000
+static void madera_por_delay(void)
+{
+ /*
+ * Delay after DCVDD enable or hard reset to allow for silicon POR
+ * (power-on reset).
+ */
+ usleep_range(2000, 3000);
+}
+
static int madera_wait_for_boot(struct madera *madera)
{
ktime_t timeout;
@@ -209,7 +218,6 @@ static void madera_disable_hard_reset(struct madera *madera)
return;
gpiod_set_raw_value_cansleep(madera->pdata.reset, 1);
- usleep_range(1000, 2000);
}
static int __maybe_unused madera_runtime_resume(struct device *dev)
@@ -225,6 +233,8 @@ static int __maybe_unused madera_runtime_resume(struct device *dev)
return ret;
}
+ madera_por_delay();
+
regcache_cache_only(madera->regmap, false);
regcache_cache_only(madera->regmap_32bit, false);
@@ -440,6 +450,7 @@ int madera_dev_init(struct madera *madera)
}
madera_disable_hard_reset(madera);
+ madera_por_delay();
regcache_cache_only(madera->regmap, false);
regcache_cache_only(madera->regmap_32bit, false);
--
2.11.0
next reply other threads:[~2018-10-02 10:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 10:41 Richard Fitzgerald [this message]
2018-10-02 10:41 ` [PATCH v2 2/2] mfd: madera: Wait for BOOT_DONE before reading device ID Richard Fitzgerald
2018-10-02 10:56 ` Charles Keepax
2018-10-02 10:55 ` [PATCH v2 1/2] mfd: madera: Increase wait time for silicon reset Charles Keepax
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=20181002104134.29003-1-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).