From patchwork Tue Jun 27 11:36:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 106415 Delivered-To: patch@linaro.org Received: by 10.140.101.48 with SMTP id t45csp1098750qge; Tue, 27 Jun 2017 04:36:35 -0700 (PDT) X-Received: by 10.84.213.8 with SMTP id f8mr5338029pli.22.1498563395318; Tue, 27 Jun 2017 04:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498563395; cv=none; d=google.com; s=arc-20160816; b=surs/AMuQXBwU3sENmyqU+O+kefIhmwwyYha6IyMkk7pCeM93R00FPZbZX+bF4YmJG /fukP2iWtLwCgM2kdGw+NoS+gC3G5xe2aRoan8Jq13LZCFTWMWzwnfnFREcNmvRcnWNU X2qVl+DsuQ9r9MUzlcp2bugtSCjtf+CXqVerxg9yur3gOLLWiZ6EGCyBVE6j4KUjE1kW 7ZEGrqTHnCNdQ59iOsIQWiu7+kr8GLbF4VMHyprDgbIEIc1el5LOxNJ8Wsosi7YQUgRF StsimkNGdqFEaLhMZlt6oNhInJlgOUxP/kuGtBUlwq76jMUaMY5ICzkmQOxHkZvpEKcw HmiQ== 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=1H9HAQlQJv83Qd3vkgh5uJE7mqgHrQKbzPEuOprA0iA=; b=Wn4C6oVFWQ7O5PGp5ignJpaCaqWLYOUZTsAEXzG8Al+TZA6W4ZR1WOqRCvw3G+qAW7 Ojuur9K5UlCZs3bPwzW137Ws0v1ohNPTTHTZxpI5kXVLnGLZfcTBsiyL+d7osByxmNbc NY0UzKas+RKWnLLT7pH5XS3n/fGcsQQdavjujcZWF6BmWyL9XtX4AcOp1GZ8oPwUBUpS cYQqu2TFwtbnGZ2cTpzFeNi9XQG2qFxOQrDfQf+09iT2GmbZ/5M38rPZxC5Mdn1iRJkf QHz0vsxMJW8KKSJRkTGSpGLRCYFGhgUyYscmBpumeK+LKUEpmrtw5mzHTitnjJgoy/yM KPSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=kU3YSR5E; 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 y2si1791565pgo.132.2017.06.27.04.36.34; Tue, 27 Jun 2017 04:36:35 -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=kU3YSR5E; 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 S1752191AbdF0Lge (ORCPT + 6 others); Tue, 27 Jun 2017 07:36:34 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:35071 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbdF0Lgd (ORCPT ); Tue, 27 Jun 2017 07:36:33 -0400 Received: by mail-pf0-f170.google.com with SMTP id c73so15306328pfk.2 for ; Tue, 27 Jun 2017 04:36:33 -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=1H9HAQlQJv83Qd3vkgh5uJE7mqgHrQKbzPEuOprA0iA=; b=kU3YSR5E9WC9bnocFYLp8yLmRLANKmy+46RDyrQitbdYhXdmcHRnTBbABRRx8BYMUt 8uoXV3tGAXfkyq2IZGyEJtoAS7SC69zaIqc9EHR8UOO4AvscIXg+zTHUffFItYDsZFlg TmxtEXrwvmYSuER36N+/wW4qFX266sLQU/9+I= 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=1H9HAQlQJv83Qd3vkgh5uJE7mqgHrQKbzPEuOprA0iA=; b=ROLwOfkBXtddVTiF4kITNJzJfiNLQVpB5gEHJzAkXkA/2vyS+Qf2mEB5TDKns3q3FW uUI2kCLHZ/0E2SEQmCRbnKfuhtt4pnESCnmZACXHKmx3epZJMo7tmilCNoGpGWd4HFZO 67NLo04IIJvkdtOWqV27yeKQ/7An2l7/orDCGt8WKNXKRIH1A2b8cuY7cu6QXn3pq+sb oeiTyQK/Y0xt93BdP5fNlrFW5BgW3UUFv4VRjaU16Q7RpVL2wqWK1Dtis3Pt3cTKuTxv DqQHYJFrTk5CjZnNn8pyndTdl/Xlh/66OZ8kEOUl5HMr3M+GW3fiORT/YMLoO1T3LR/b 6WMg== X-Gm-Message-State: AKS2vOzP1c1pP5WfExtVk1JaSaZo9BXjWmJeHbLwnDXm15CAAGYyPeZF OBjiU856S3yJkWiBdWCQ9A== X-Received: by 10.99.165.82 with SMTP id r18mr4787138pgu.65.1498563393171; Tue, 27 Jun 2017 04:36:33 -0700 (PDT) Received: from localhost.localdomain ([106.51.139.251]) by smtp.gmail.com with ESMTPSA id b8sm6317506pfd.65.2017.06.27.04.36.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jun 2017 04:36:32 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Hauke Mehrtens , Mark Brown Subject: [PATCH for-4.11 1/2] spi: double time out tolerance Date: Tue, 27 Jun 2017 17:06:24 +0530 Message-Id: <1498563385-1430-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498563385-1430-1-git-send-email-amit.pundir@linaro.org> References: <1498563385-1430-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 90b5b2efafbf..b4a8bb7759b2 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1015,7 +1015,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;