From patchwork Tue Apr 22 16:45:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 341410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EDEBC140121 for ; Wed, 23 Apr 2014 02:47:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933280AbaDVQry (ORCPT ); Tue, 22 Apr 2014 12:47:54 -0400 Received: from mail-pb0-f73.google.com ([209.85.160.73]:53332 "EHLO mail-pb0-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933223AbaDVQqV (ORCPT ); Tue, 22 Apr 2014 12:46:21 -0400 Received: by mail-pb0-f73.google.com with SMTP id rp16so738430pbb.2 for ; Tue, 22 Apr 2014 09:46:21 -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=7jtgSOLB7F5ddarOMcYMPrrX90dY6ScVNQez6+kFcfs=; b=TImeqy5tP6JNr5MjsxtqI1yyfLtXF9PLIATrjmXsC4i2UA7b681981AbPI8VxZSpbU Rvcle6tLN2PaSpoM/zhUeu8jUjD9IRVw9OeNRt7OowzFgnGmfL32xnazlNCtps8LvOHQ hsHsA7r0vxbvKk6yfGleqlOy0KxhGwK2AzJe0SrCepPPnoeqoXPS1vdGuq7ue3VEWvRQ B0YKTBobta6CalNRHJOyxTssZuxko1IlpTOrO1EO/rpIyhvCIdawLgXmi0e3U1GgP66f TAsZTcXa6txTpc3cvByAOPoZ6K2V1TsZTgR098BHqGwjV13EIyiX2XWyRhQ7W6nKFldE uKAw== X-Gm-Message-State: ALoCoQmbIUCS8jLUrZAxkvwRRgpFKakqZGcuShxzCC3/9XkxMUI+WaIlXMVIejM3HIeRLdK0DYlA/+bNqfgv368H+rq/pHqplIJFWF/3k0SWa+VQZ9sxWNYewgE11KmI44RW1sqNfEAW8tkKSlehtN9mum+nN7BaGIhJobhDimEI+8yY8kix4LzzwihM8Qpj4TchU8OPrO0s7USLZzKe3+JH+KHWL0fWqA== X-Received: by 10.66.141.135 with SMTP id ro7mr22396441pab.28.1398185180972; Tue, 22 Apr 2014 09:46:20 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id a44si5664458yhb.6.2014.04.22.09.46.20 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Apr 2014 09:46:20 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id C1F1831C27D; Tue, 22 Apr 2014 09:46:20 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 76FC581025; Tue, 22 Apr 2014 09:46:20 -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 v2 4/7] mfd: cros_ec: spi: Increase cros_ec_spi deadline from 5ms to 100ms Date: Tue, 22 Apr 2014 09:45:51 -0700 Message-Id: <1398185154-19404-5-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1398185154-19404-1-git-send-email-dianders@chromium.org> References: <1398185154-19404-1-git-send-email-dianders@chromium.org> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.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 Reviewed-by: Simon Glass Tested-by: Andrew Bresticker Tested-by: Stephen Warren --- 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