From patchwork Mon Jun 19 15:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 13284751 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 00C55EB64D9 for ; Mon, 19 Jun 2023 15:54:19 +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=XWBhTFDc8PC6CcOsLodFQwFve0UsgLwK4eRt5GSAl7A=; b=L6VEvwm3cOs6MH IfINPTSJmbaQnpDI83SM/PFIU8SH95mgVbPrvOE3MYPWRpo4OzCCk6QhPrJsW6Sv3DE1xdLnwohnH o4xxRWzINzciyW/JxyBy4VDW8KQ1Vf+Kdx24uxZiBoY64DzuBr9xOryXF+M9cRPgiT+yZqj7WEpOt gjGpAQ8jRGlTammifeWo34FNuUT7UjCGgNEgrQf9SvKwIfPWEtfUPCjGwJZzG7Z4fQCl1Ew4APOsX q5ZvVUXyfGPp8q87QzjQ4s4lecuYcyuTTv5acI1m2NOzRcQy/V3R/ehvHyxduOB4J3f3h5zN/9P/q MLSY0Z0paUEReDNCoYjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBHCb-008qm5-0v; Mon, 19 Jun 2023 15:54:01 +0000 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBHCY-008qjq-2f for linux-arm-kernel@lists.infradead.org; Mon, 19 Jun 2023 15:54:00 +0000 X-GND-Sasl: miquel.raynal@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1687190034; 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=O1eIJeAVog5amjj66j1E1EeTqm3rvg0ZXdAJ8CVTp74=; b=Sm1fulgrRfC0KJDlLgvDwIiuncg9hgnic30gNPkplmsPm34Bzb1ZizeclCE/9TamYqKK03 IzpJSojjsEfgWGHpvTQw/SyWMwFgCX+sHjMVE5VoPDacqfWOVzIoHXdpqRM9lMZP102Hd7 6sMkUgtuq49Xhx/D15U/VHidcMOF6kYfAHgn9hbktsoOF0lL0GPrwZAlJWYv9FJaqkrx0S iUle7yx3bEzoiLWAB6Lo8EiSUwLzFCexNkp7rp31Y1arI11PJ/wWhwos6320UokkGWFKWR SFsZKqunY9OD86qK+2UvBdIBDG9Y+Dx2ILe3KEfOkfyYffzkgPPSnBrseswxUA== 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 X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 45F2A1BF20A; Mon, 19 Jun 2023 15:53:50 +0000 (UTC) From: Miquel Raynal To: Mark Brown , Subject: [PATCH v2 0/3] spi: Helper for deriving timeout values Date: Mon, 19 Jun 2023 17:53:46 +0200 Message-Id: <20230619155349.3118420-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-20230619_085359_174741_1920C017 X-CRM114-Status: GOOD ( 10.28 ) 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: Alexandre Belloni , Samuel Holland , Chen-Yu Tsai , Jernej Skrabec , Tudor Ambarus , Thomas Petazzoni , Miquel Raynal , linux-sunxi@lists.linux.dev, 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 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(-)