From patchwork Fri Oct 2 12:22:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11813289 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9748E174A for ; Fri, 2 Oct 2020 12:23:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79DF72074B for ; Fri, 2 Oct 2020 12:23:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="qz+vef36" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387893AbgJBMXY (ORCPT ); Fri, 2 Oct 2020 08:23:24 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:54180 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387911AbgJBMW6 (ORCPT ); Fri, 2 Oct 2020 08:22:58 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201002122256euoutp02cedadd06e98e0694cd77db90e582f454~6LFiaFv-G2297122971euoutp02c for ; Fri, 2 Oct 2020 12:22:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201002122256euoutp02cedadd06e98e0694cd77db90e582f454~6LFiaFv-G2297122971euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1601641376; bh=7LtCdh3X+5TnFv/x7HOdoPIHebaOi5pA9zfppmeDtdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qz+vef36m73sPBaSm5dUcO/aI655hvK7kedOYruQZGXSs36zJBVkEHQT7EWszIFGA gxAYAS8MEjTDtRLey5btgpyENxkwrIcg5GBArsyGdBgkbjainsICXHW8RDtO/jXgC9 MjmfbNIbXRpbmDgDcDlN9nk3Zp+Ea2NodQXUXVZM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201002122256eucas1p12e5bf98482976c654647738ab239202b~6LFiD4kQb3160631606eucas1p15; Fri, 2 Oct 2020 12:22:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D9.8F.06318.F9B177F5; Fri, 2 Oct 2020 13:22:56 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201002122255eucas1p2cec6d9cdac111d6f2dc628c7865f7bd5~6LFhoMk3s1906319063eucas1p2f; Fri, 2 Oct 2020 12:22:55 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201002122255eusmtrp2f67b56444dfc2817397a3c9c19eaa9f0~6LFhninyB0251002510eusmtrp2V; Fri, 2 Oct 2020 12:22:55 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-f3-5f771b9f9d33 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E3.C0.06017.F9B177F5; Fri, 2 Oct 2020 13:22:55 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201002122255eusmtip124cc2afa490630643fd094aded4aca84~6LFhbCGOi0741307413eusmtip1A; Fri, 2 Oct 2020 12:22:55 +0000 (GMT) From: =?utf-8?q?=C5=81ukasz_Stelmach?= To: Kukjin Kim , Krzysztof Kozlowski , Tomasz Figa , Andi Shyti , Mark Brown , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , =?utf-8?q?Bart=C5=82omiej_?= =?utf-8?q?=C5=BBo=C5=82nierkiewicz?= , =?utf-8?q?=C5=81ukasz_Stelmach?= Subject: [PATCH v3 8/9] spi: spi-s3c64xx: Increase transfer timeout Date: Fri, 2 Oct 2020 14:22:42 +0200 Message-Id: <20201002122243.26849-9-l.stelmach@samsung.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201002122243.26849-1-l.stelmach@samsung.com> MIME-Version: 1.0 Organization: Samsung R&D Institute Poland X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDKsWRmVeSWpSXmKPExsWy7djPc7oLpMvjDSY1slks/vGcyWLjjPWs FlMfPmGz6H/8mtni/PkN7BY3D61gtNj0+BqrxeVdc9gsZpzfx2TR+PEmu8XaI3fZLVbt+sPo wONxfcknZo+ds+6ye2xa1cnmsXlJvUffllWMHp83yQWwRXHZpKTmZJalFunbJXBlfDh4lqng M0fF/v1PGRsYZ7J3MXJySAiYSKxb+Iipi5GLQ0hgBaPEzkWXoJwvjBKvbyxlh3A+M0p8fPua Caal8ew3VojEckaJqzsaoKqeM0r09l9nBqliE3CU6F96AqxKRGA7k8TEz+dZQBxmgaOMEpsf XAVyODiEBZwlFj4qAGlgEVCV2PFwFyuIzStgLTH1/D5GiHXyEu3Lt7OB2JwCNhInF21jg6gR lDg58wkLiM0voCWxpuk6mM0MVN+8dTYzyC4JgXvsEucnzGeGGOQicbF9AdRQYYlXx7dAg0BG 4v/O+Uwg90gI1EtMnmQG0dvDKLFtzg8WiBpriTvnfrGB1DALaEqs36UPEXaUuHGwjRWilU/i xltBiBP4JCZtm84MEeaV6GgTgqhWkVjXvwdqoJRE76sVjBMYlWYheWYWkgdmIexawMi8ilE8 tbQ4Nz212DgvtVyvODG3uDQvXS85P3cTIzBNnf53/OsOxn1/kg4xCnAwKvHwZhwqjRdiTSwr rsw9xCjBwawkwut09nScEG9KYmVValF+fFFpTmrxIUZpDhYlcV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EjF+6JXZdqrMx6N4fzDDfHNq/jzo8aVjBqdu/9r7jV07eDO2Xe2il5mpZy rb3f7ASEmrz0ZX30bkw/ILp0zp7NF//uPbnY5Q+vEktxRqKhFnNRcSIAtLk2Jd8CAAA= X-CMS-MailID: 20201002122255eucas1p2cec6d9cdac111d6f2dc628c7865f7bd5 X-Msg-Generator: CA X-RootMTR: 20201002122255eucas1p2cec6d9cdac111d6f2dc628c7865f7bd5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201002122255eucas1p2cec6d9cdac111d6f2dc628c7865f7bd5 References: <20201002122243.26849-1-l.stelmach@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Increase timeout by 30 ms for some wiggle room and set the minimum value to 100 ms. This ensures a non-zero value for short transfers which may take less than 1 ms. The timeout value does not affect performance because it is used with a completion. Similar formula is used in other drivers e.g. sun4i, sun6i. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Ɓukasz Stelmach --- drivers/spi/spi-s3c64xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 0bd3e230350c..9f728a7c59a1 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -473,7 +473,8 @@ static int s3c64xx_wait_for_dma(struct s3c64xx_spi_driver_data *sdd, /* millisecs to xfer 'len' bytes @ 'cur_speed' */ ms = xfer->len * 8 * 1000 / sdd->cur_speed; - ms += 10; /* some tolerance */ + ms += 30; /* some tolerance */ + ms = max(ms, 100); /* minimum timeout */ val = msecs_to_jiffies(ms) + 10; val = wait_for_completion_timeout(&sdd->xfer_completion, val);