From patchwork Mon Jun 26 08:01:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 106315 Delivered-To: patch@linaro.org Received: by 10.140.101.48 with SMTP id t45csp103215qge; Mon, 26 Jun 2017 01:01:57 -0700 (PDT) X-Received: by 10.99.158.18 with SMTP id s18mr20229623pgd.113.1498464116943; Mon, 26 Jun 2017 01:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498464116; cv=none; d=google.com; s=arc-20160816; b=n02N8LnzuhaeHm4TJh4nC4QSH+T0Kd1dk+Kb8Z+q9vL9UlirawZZs7J25Qyzak6ebV M9bOS79UI4bgYLhmBfBR77SY3yd0avKtVD84f4JR79bwxiXhvDjbljnPbH2Z6Zc1RY42 JIO9hXVjIGfc47bEsTIYElWcdXDfztgGuy6UbLq0rknGJ2eGOUVeJyVP53z3cIkt4/fY 43p0hy5vTh2SkZMNm4XvcQ9D9rCPxx+c/guOdVW/T/RSzQhK7p9U48uxWUbQ26hK37xZ KLlvhJvfnh/ZHb5Qrm04R0wrOc15pGrBSJQLYfGvS1e+q8OPzdFw8SMQbooZAmRyKntD 8J3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=exOszOhYRtNreMyjMjJxQ9YXyNjs2oVaBGzQrrgfz2c=; b=W6Wv/ikEqfpsQLpa2IIWmwnrAW1iT+VdOk4vL0EJ7dVKu/Q285YWVswfB0Egnesxnd VSBAzVmWMYCfZIzpMNnFpEn2hAQxBlQtiNF5GGw21qX3xJ0MHN3gNPHCMFYi1Mpo5umc sJyCFSDwHDhWcOJbDGfGkA02rGJn9p4yAsUvnnyPgdSMuheiXZzGZOoTcvmwfj7cEvzi Y5omFejYsvXE8rBnRWRmqKpc+yBHtEO8f3n1GHQq+7YEdYCxWrR23cSCi4B+f6CyR9Jb J8lLBo+5iZI6kDEqmp2oN5L3Ldu8dpjTMX/6f18MBz+s+nJ/b46fA1W4aRT6ZObOf5LR LsXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=CmrBXNCF; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si8959663pld.125.2017.06.26.01.01.56; Mon, 26 Jun 2017 01:01:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=CmrBXNCF; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751392AbdFZIB4 (ORCPT + 6 others); Mon, 26 Jun 2017 04:01:56 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:33758 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbdFZIBz (ORCPT ); Mon, 26 Jun 2017 04:01:55 -0400 Received: by mail-pf0-f181.google.com with SMTP id e7so51448525pfk.0 for ; Mon, 26 Jun 2017 01:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=exOszOhYRtNreMyjMjJxQ9YXyNjs2oVaBGzQrrgfz2c=; b=CmrBXNCFXscwKj124A289/r0eTIrcg2b+IZ9ZlAxRqCtqyGWtZOrSkh75mG0FUoNvy CEnVit8hUfOJbYgPPYQ11jiPIYJLxI4/NhAhlKczpwShUAWKcjt6B5QUvl8LMmYlVYFK 3hBSfyzoqPREIf2mwk+2j1+GMAg+OlBNv94Jc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=exOszOhYRtNreMyjMjJxQ9YXyNjs2oVaBGzQrrgfz2c=; b=mG+rgBve4sfRkTYR5IshB1tfjmbXyB+7Bc81KBTUIUi92GV2p9WSBLtUR/FMF5Xncp feF/x2gVwZMn0ViowaLLk3h1Jk4BMYBaukfe/hAe8c3Oo5edbpNo7fGWLnXoWOKJgO3l EmLMMpIQQpiU/c3hUjDNPwxn3SILRM1S573zKtC1H/JxgTROeIA1JKUR2KjaLjDR5HH3 50xPxzHQCS1TmWQ7XG72qEfGg4irMTHoVXGLlTyTeeoJG0uZvr0xtAnRStvOjJa58ZHz dhPM8ITjMp/9pj5Br2Pd+K2U4MJNdNiVxb1GAso55CMmTNyzNb5FeNvBNp5XXgGFzFOh bIWQ== X-Gm-Message-State: AKS2vOyw1qLobSDTyXAf9rl57i9JkvYx5G48MvDRr66YRoJanv9PBnNZ +ZhX/lqsO9anjGhPUyXgxA== X-Received: by 10.84.173.129 with SMTP id p1mr22817415plb.143.1498464114956; Mon, 26 Jun 2017 01:01:54 -0700 (PDT) Received: from localhost.localdomain ([106.51.139.251]) by smtp.gmail.com with ESMTPSA id 67sm23673640pfa.83.2017.06.26.01.01.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jun 2017 01:01:53 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Hauke Mehrtens , Mark Brown Subject: [PATCH for-4.9 6/7] spi: double time out tolerance Date: Mon, 26 Jun 2017 13:31:30 +0530 Message-Id: <1498464091-26753-7-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498464091-26753-1-git-send-email-amit.pundir@linaro.org> References: <1498464091-26753-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hauke Mehrtens commit 833bfade96561216aa2129516a5926a0326860a2 upstream. The generic SPI code calculates how long the issued transfer would take and adds 100ms in addition to the timeout as tolerance. On my 500 MHz Lantiq Mips SoC I am getting timeouts from the SPI like this when the system boots up: m25p80 spi32766.4: SPI transfer timed out blk_update_request: I/O error, dev mtdblock3, sector 2 SQUASHFS error: squashfs_read_data failed to read block 0x6e After increasing the tolerance for the timeout to 200ms I haven't seen these SPI transfer time outs any more. The Lantiq SPI driver in use here has an extra work queue in between, which gets triggered when the controller send the last word and the hardware FIFOs used for reading and writing are only 8 words long. Signed-off-by: Hauke Mehrtens Signed-off-by: Mark Brown Signed-off-by: Amit Pundir --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 838783c3fed0..24d4492d0168 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1004,7 +1004,7 @@ static int spi_transfer_one_message(struct spi_master *master, ret = 0; ms = 8LL * 1000LL * xfer->len; do_div(ms, xfer->speed_hz); - ms += ms + 100; /* some tolerance */ + ms += ms + 200; /* some tolerance */ if (ms > UINT_MAX) ms = UINT_MAX;