linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Lee Jones <lee.jones@linaro.org>,
	Stephen Warren <swarren@nvidia.com>,
	Wolfram Sang <wsa@the-dreams.de>
Cc: abrestic@chromium.org, dgreid@chromium.org,
	Olof Johansson <olof@lixom.net>, Simon Glass <sjg@chromium.org>,
	linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org,
	Doug Anderson <dianders@chromium.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 4/7] mfd: cros_ec: spi: Increase cros_ec_spi deadline from 5ms to 100ms
Date: Thu, 17 Apr 2014 10:59:27 -0700	[thread overview]
Message-ID: <1397757570-19750-5-git-send-email-dianders@chromium.org> (raw)
In-Reply-To: <1397757570-19750-1-git-send-email-dianders@chromium.org>

We're adding i2c tunneling to the list of things that goes over
cros_ec.  i2c tunneling can be slooooooow, so increase our deadline to
100ms to account for that.

Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 drivers/mfd/cros_ec_spi.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
index 4f863c3..0b8d328 100644
--- a/drivers/mfd/cros_ec_spi.c
+++ b/drivers/mfd/cros_ec_spi.c
@@ -39,14 +39,22 @@
 #define EC_MSG_PREAMBLE_COUNT		32
 
 /*
-  * We must get a response from the EC in 5ms. This is a very long
-  * time, but the flash write command can take 2-3ms. The EC command
-  * processing is currently not very fast (about 500us). We could
-  * look at speeding this up and making the flash write command a
-  * 'slow' command, requiring a GET_STATUS wait loop, like flash
-  * erase.
-  */
-#define EC_MSG_DEADLINE_MS		5
+ * Allow for a long time for the EC to respond.  We support i2c
+ * tunneling and support fairly long messages for the tunnel (249
+ * bytes long at the moment).  If we're talking to a 100 kHz device
+ * on the other end and need to transfer ~256 bytes, then we need:
+ *  10 us/bit * ~10 bits/byte * ~256 bytes = ~25ms
+ *
+ * We'll wait 4 times that to handle clock stretching and other
+ * paranoia.
+ *
+ * It's pretty unlikely that we'll really see a 249 byte tunnel in
+ * anything other than testing.  If this was more common we might
+ * consider having slow commands like this require a GET_STATUS
+ * wait loop.  The 'flash write' command would be another candidate
+ * for this, clocking in at 2-3ms.
+ */
+#define EC_MSG_DEADLINE_MS		100
 
 /*
   * Time between raising the SPI chip select (for the end of a
-- 
1.9.1.423.g4596e3a


  parent reply	other threads:[~2014-04-17 18:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1397757570-19750-1-git-send-email-dianders@chromium.org>
2014-04-17 17:59 ` [PATCH 1/7] mfd: cros_ec: spi: calculate delay between transfers correctly Doug Anderson
2014-04-18 17:27   ` Simon Glass
2014-04-17 17:59 ` [PATCH 2/7] mfd: cros_ec: spi: Add mutex to cros_ec_spi Doug Anderson
2014-04-18 17:28   ` Simon Glass
2014-04-18 21:15     ` Doug Anderson
2014-04-18 21:43       ` Simon Glass
2014-04-17 17:59 ` [PATCH 3/7] mfd: cros_ec: spi: Make the cros_ec_spi timeout more reliable Doug Anderson
2014-04-18 17:26   ` Simon Glass
2014-04-17 17:59 ` Doug Anderson [this message]
2014-04-18 17:30   ` [PATCH 4/7] mfd: cros_ec: spi: Increase cros_ec_spi deadline from 5ms to 100ms Simon Glass
2014-04-17 17:59 ` [PATCH 5/7] mfd: cros_ec: Sync to the latest cros_ec_commands.h from EC sources Doug Anderson
2014-04-18 17:29   ` Simon Glass
2014-04-17 17:59 ` [PATCH 7/7] ARM: tegra: Add the EC i2c tunnel to tegra124-venice2 Doug Anderson
2014-04-21 18:18   ` Stephen Warren
2014-04-21 19:35     ` Doug Anderson
2014-04-21 20:03       ` Stephen Warren
2014-05-15 18:42   ` Stephen Warren
2014-05-15 18:55     ` Doug Anderson
2014-05-15 20:12       ` Olof Johansson
2014-05-19  9:18         ` Lee Jones

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=1397757570-19750-5-git-send-email-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=abrestic@chromium.org \
    --cc=dgreid@chromium.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=sameo@linux.intel.com \
    --cc=sjg@chromium.org \
    --cc=swarren@nvidia.com \
    --cc=wsa@the-dreams.de \
    /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).