From patchwork Thu Apr 10 12:50:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 3962571 Return-Path: X-Original-To: patchwork-linux-spi@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 0FD0FBFF02 for ; Thu, 10 Apr 2014 12:51:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C8D820646 for ; Thu, 10 Apr 2014 12:51:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5039B20640 for ; Thu, 10 Apr 2014 12:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030658AbaDJMuk (ORCPT ); Thu, 10 Apr 2014 08:50:40 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:60712 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030665AbaDJMuh (ORCPT ); Thu, 10 Apr 2014 08:50:37 -0400 Received: by mail-pa0-f50.google.com with SMTP id kq14so3924504pab.23 for ; Thu, 10 Apr 2014 05:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=6WEoO0l7/vKdWEOA+rwp1igRtaaxqSCsO/2Pyina2Tw=; b=TFLc/jgTMcIikLmRhD+b8LpnQlgsbkHtckw+z4RWCUrZIRuWQkd5uhI/AGbeAxSiVL gCuYDNNr/fNV4s+1kzrbwhNLfZYnDG9a+mHkhjF23p3XCNgrj3g6zLAbV/iYDy5/yYOB MdLXmGI6JIV0fH4zxwbfb3582I/+IphKoeeTtch1bxkfd0rvAdLbZ5RISpHZuyUOhPpG k8B7LU03nxxIJRrz6gRMA07vzl4LJThAYdj7HnxyWFLHMnHQSjoCgqcz2oQrtIUcrLgL I8wO2NUxDrT/Q33OmW0xVQarEVNzlbrkZBW4YAbwoQdG1rFjstQfP+e2Cm321AAsDvrN Z5Yw== X-Received: by 10.66.164.165 with SMTP id yr5mr19310162pab.63.1397134237119; Thu, 10 Apr 2014 05:50:37 -0700 (PDT) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id x5sm8992348pbw.26.2014.04.10.05.50.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 10 Apr 2014 05:50:36 -0700 (PDT) From: Harini Katakam To: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: michals@xilinx.com, Harini Katakam Subject: [PATCH] spi: core: Increase timeout value Date: Thu, 10 Apr 2014 18:20:29 +0530 Message-Id: <1397134229-2380-1-git-send-email-harinik@xilinx.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 The existing timeout value in wait_for_completion_timeout is calculated from the transfer length and speed with tolerance of 10msec. This is too low because this is used for error conditions such as hardware hang etc. The xfer->speed_hz considered may not be the actual speed set because the best clock divisor is chosen from a limited set such that the actual speed <= requested speed. This will lead to timeout being less than actual transfer time. Considering acceptable latencies, this timeout can be set to a large value >= 1*HZ typically. This patch adds a tolerance of 2000 msec in the core accordingly. Signed-off-by: Harini Katakam --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 4eb9bf0..3fdecfa 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -775,7 +775,7 @@ static int spi_transfer_one_message(struct spi_master *master, if (ret > 0) { ret = 0; ms = xfer->len * 8 * 1000 / xfer->speed_hz; - ms += 10; /* some tolerance */ + ms += 2000; /* some tolerance */ ms = wait_for_completion_timeout(&master->xfer_completion, msecs_to_jiffies(ms));