From patchwork Wed Apr 30 17:44:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4095371 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 739B2BFF02 for ; Wed, 30 Apr 2014 17:45:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4771202E6 for ; Wed, 30 Apr 2014 17:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEC8D201D5 for ; Wed, 30 Apr 2014 17:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759342AbaD3Roi (ORCPT ); Wed, 30 Apr 2014 13:44:38 -0400 Received: from mail-vc0-f201.google.com ([209.85.220.201]:60821 "EHLO mail-vc0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759270AbaD3Rof (ORCPT ); Wed, 30 Apr 2014 13:44:35 -0400 Received: by mail-vc0-f201.google.com with SMTP id ij19so300390vcb.0 for ; Wed, 30 Apr 2014 10:44:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w2IbOvTlYk7yAbUubcbcCdSzknM8lv10fXNYsQoknk4=; b=iVZXKtZ4SVPZWB1qAdDnXsNgHLaz6XeJDJQL6LJ4uFc1zrI9QEra8C9DUhPJJUbe8u JSgoxIbQ2YUTvt9qiI4pxnS31tj/l4bWwN7uGiQRdF1weZJn3pQ1AzsZrTb1nB1Q/66l rPVTOlzwQ5AAk8RfOPCh/qT8WFlXhFFavF/LTolXBxpWIW2Sgz/B1GXesbiUpAGF5iIj kFpjI/NB653/JIYMb07YaG/t9gKp8OzfQ4TkJib8g6tJI5BBXmA+ZpCFtrj2Kk2gt82P AIN/OomDRKnxpEqASfH3HX2+8D3hhGzGtZXT4wPt8HInrnVqOr++oEZIpdXHC2QS9A+U 9Aww== X-Gm-Message-State: ALoCoQkb3ax+67GwQ8VHNZARbO5ghhNXbewTkQtLNm7iTjgm8pm+gQK2sK7a6cUrSSx6j/Od76odf3SU0+I3NgTjFBfTjxEFI5I9tqclZHswY0WGiwradSpPTdAKq4kGxbB3mztGxv4txly07HCaacy/xmKLI2ZNC9RECnRcys6O5Pv7P7t47jiXiZkrDPH+mEhd5siTnLExoSAjcSKSWQC2cfpRvQtW9Q== X-Received: by 10.236.39.99 with SMTP id c63mr2873647yhb.31.1398879874831; Wed, 30 Apr 2014 10:44:34 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id y50si3078865yhk.4.2014.04.30.10.44.34 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Apr 2014 10:44:34 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id AB3F35A428E; Wed, 30 Apr 2014 10:44:34 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 6171A80FCB; Wed, 30 Apr 2014 10:44:34 -0700 (PDT) From: Doug Anderson To: lee.jones@linaro.org, swarren@nvidia.com, wsa@the-dreams.de Cc: abrestic@chromium.org, dgreid@chromium.org, olof@lixom.net, sjg@chromium.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, Doug Anderson , sameo@linux.intel.com, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] mfd: cros_ec: spi: Increase cros_ec_spi deadline from 5ms to 100ms Date: Wed, 30 Apr 2014 10:44:07 -0700 Message-Id: <1398879850-9111-5-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1398879850-9111-1-git-send-email-dianders@chromium.org> References: <1398879850-9111-1-git-send-email-dianders@chromium.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Lee Jones Reviewed-by: Simon Glass Tested-by: Andrew Bresticker Tested-by: Stephen Warren --- Changes in v3: None Changes in v2: None 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