From patchwork Thu Jun 22 09:06:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 13288805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47CDCEB64DB for ; Thu, 22 Jun 2023 09:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uDUOqQuHmD3OotGXubO5DTyM8sYEyoBu2Pu38wfIx38=; b=X77k9vEOBwGEGW EpEEMc16aNfKFF8CQjyAQGyYoovAJBTnF6fMU4KPLk7zy9wFpSfxAmSilu2J6YnAbcsoXDOTevwdc GcAzD7SQtsvv5zZj+SjGhlnCxGszU4gZLToz+sfDRi9N0FxNPkW6A9Epluq9sBA4OPkYNy4DZSbR2 WUzEgj53Cv9EedRCOLnwveP+/PFoA7vyCDXEnaHOsF/MG0So87F5EVgqVL9poOVdy57+A8eyddhsE N54w/Q/rAXLlPVteWpC6XG5wJggjmsgqZFVB7/k4xb0wd3E3dP4crklNMIjqhHT6rYntK2W2KxMp6 I1iRNXT3Lqvkc+VYMoQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCGH5-00HXah-2v; Thu, 22 Jun 2023 09:06:43 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCGH2-00HXYK-1m for linux-arm-kernel@lists.infradead.org; Thu, 22 Jun 2023 09:06:42 +0000 X-GND-Sasl: miquel.raynal@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1687424796; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=smUguiUnq/2ETy4GDzWzASOaK7+FY98RKmwyQrczEKo=; b=Kt8zDoybTN2+sdhcOsTJ/AVmCuksnWdHAZJ0wEg/DE+N+X3NqqF4xHoaT3JEonsxvIDbLt 2Haj8RarDMprtsD6IamCksSqm2/GLskf3JSNmCzYoFMyOm/B3zeqX41F2M2XizvzwEX/tf JHHiqTVE+2MzvBqIxDRbnPJSTgKrR4tii10ruPu8wRmKFpXMkc/EXmXXXsMQQ0zqpUOFZk wURIVhjBb/Sk5D0/LfQFsuNSQD1HLT3Jjc2qpN8gw6NgFy3fGMJ710M1TtXi5agzVNneYx ecBTVTMk0d0AXMY4HW1Fwhu9/Gd/yzTrKpxK1o/A/1GC+pK466qa+GRqoIbxuA== X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id E8C7E4000C; Thu, 22 Jun 2023 09:06:34 +0000 (UTC) From: Miquel Raynal To: Mark Brown , Subject: [PATCH v3 0/3] spi: Helper for deriving timeout values Date: Thu, 22 Jun 2023 11:06:31 +0200 Message-Id: <20230622090634.3411468-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230622_020640_752173_99C86278 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Holland , Chen-Yu Tsai , Jernej Skrabec , Tudor Ambarus , Thomas Petazzoni , Miquel Raynal , Claudiu Beznea , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello, I recently came across an issue with the Atmel spi controller driver which would stop my transfers after a too small timeout when performing big transfers (reading a 4MiB flash in one transfer). My initial idea was to derive a the maximum amount of time a transfer would take depending on its size and use that as value to avoid erroring-out when not relevant. Mark wanted to go further by creating a core helper doing that, based on the heuristics from the sun6i driver. Here is a small series of 3 patches doing exactly that. Cheers, Miquèl Changes in v3: * Collected a tag. * As my platform runs on 6.1 currently, I cherry-picked a mainline patch changing s/master/host/ in the atmel controller driver and modified the series to fit the new naming. I then cherry-picked my three patches and verified it compiled correctly against a v6.4-rc1. Miquel Raynal (3): spi: Create a helper to derive adaptive timeouts spi: atmel: Prevent false timeouts on long transfers spi: sun6i: Use the new helper to derive the xfer timeout value drivers/spi/spi-atmel.c | 18 +++++++++++------- drivers/spi/spi-sun6i.c | 2 +- include/linux/spi/spi.h | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 8 deletions(-)