From patchwork Wed Jan 26 06:38:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 1584364 X-Patchwork-Delegate: koen.vandeputte@ncentric.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=abiHq/ji; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=lemmela.net header.i=@lemmela.net header.a=rsa-sha256 header.s=dkim header.b=IYkhRbyT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkDh64KCZz9t6h for ; Wed, 26 Jan 2022 17:43:34 +1100 (AEDT) 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eq8I/g2nSwEVwxwO9vAG9GTmQaAIFmVOorTu47NhrNg=; b=abiHq/jiYJifCP QIyCqKlzgYoVbXqQIHHD+OUnkyqVwxzGTOmHkpGRVKKQGZTiuknk5MGGgWh/uNWuf7bDhcWfMO5wD trV9eiTR4f8tYcHHH+EYIvjWm+kC7XczS6CvCkzxZWdK7zrCWooacpR1TCGvgQs+llimz5ym/FfjX gZDr77ZlRrDvUHeXs+HbpLKNar/ZoqBJLs09ebPoiEYcZgSjlBhS7AFUDQXLH163WmBiZR6VAmYB0 rJaut8JvORmdc8BW9DeY/aZU3bwzfgEvtzthuLoPb0U1rk2ORE6muhxFWCu1VnjtEMOeQ/dmwIzaF NB0o1XiFmYxLtWFv5ijQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxz-00AJJd-2k; Wed, 26 Jan 2022 06:39:39 +0000 Received: from mail1.kuutio.org ([2001:41d0:701:1000::88b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCbxS-00AJCE-SO for openwrt-devel@lists.openwrt.org; Wed, 26 Jan 2022 06:39:08 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 6A4EF1FE02; Wed, 26 Jan 2022 07:39:05 +0100 (CET) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=dkim; t=1643179142; x=1645771143; bh=40TPA Sa9bSzmdBx45ou4u8Yw11ZfWwTBnN0xXi2fFrQ=; b=IYkhRbyT33liKMN0bm8uq ghOLK/svt5I4VLTdvR5mWz0vbKtPX3RY4oJXjvvHcHNF7WygJiHvWggGZYkNQQOa 0O5qkB/PKE78iAfhpKD782qclKUrc6gkM3e4U6Yb8fETdFqwJjfvCGxEelLOI8Do JgaZdoy4fLan3m+agn1+dnsZeDrVOL5bzKMVTZ2c2A4UQ0ps/QUxVs9+Ksm0zuL2 s8Nf//lea9XKGyIAVaPxDXjCndlEApVNApfy2Vir18NZZh1g3zvNilfam2rqld2J nsvn5lUFpa6l7lppowZb0CfidDEowfYPls0Ttwg9qy04ZpswRQOVntZzgy3eCCUA NC+eCvg+lc2QBWJow3XpP6MqvBDctb2h1dZ5Pnu0hs2Rausz/n3xZdMr9c3eR7K1 31XM3O+STs+2NUDM1FTK9Hu/khNbqM91ZUxNQYGX8BVcMIUU+vq24gApVwaxzeZQ AuFR6JuRsfk1QwG9g2s+lxIGPRcwIUxEEPnCCPKzK0zY5VuXN8ZojMqBBOW4/QDI KEoRZWldj87U83Rp5bm/94HoDez0R2mgsvylGLSEEkiVZTsWopBxhsJ0f+/AT/Ax AXgwzlVsMkVF52+07OfGNTPhOgzUoygl9BoXKGGYfB8dQsDP4QE/Rxgu5/qoyM2T Iuve/pbTHe5Bn4GbKCOYuI= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id R-emfhz0ZIlq; Wed, 26 Jan 2022 07:39:02 +0100 (CET) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id CEA7C1FD87; Wed, 26 Jan 2022 07:39:00 +0100 (CET) From: Oskari Lemmela To: openwrt-devel@lists.openwrt.org Cc: Oskari Lemmela Subject: [PATCH 3/5] ath79: fix ar934x spi driver delays Date: Wed, 26 Jan 2022 08:38:43 +0200 Message-Id: <20220126063845.587284-4-oskari@lemmela.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126063845.587284-1-oskari@lemmela.net> References: <20220126063845.587284-1-oskari@lemmela.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_223907_271681_36E64607 X-CRM114-Status: GOOD ( 19.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Backport spi driver delay fixes from the 5.17-rc1 kernel. Signed-off-by: Oskari Lemmela --- ...-ar934x-fix-transfer-and-word-delays.patch | 32 +++++++++ ...3-v5.17-spi-ar934x-fix-transfer-size.patch | 67 +++++++++++++++++++ 2 files chang [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Backport spi driver delay fixes from the 5.17-rc1 kernel. Signed-off-by: Oskari Lemmela --- ...-ar934x-fix-transfer-and-word-delays.patch | 32 +++++++++ ...3-v5.17-spi-ar934x-fix-transfer-size.patch | 67 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch create mode 100644 target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch diff --git a/target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch b/target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch new file mode 100644 index 0000000000..16aad7734a --- /dev/null +++ b/target/linux/ath79/patches-5.10/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch @@ -0,0 +1,32 @@ +From c70282457c380db7deb57c81a6894debc8f88efa Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Wed, 22 Dec 2021 07:59:58 +0200 +Subject: [PATCH] spi: ar934x: fix transfer and word delays + +Add missing delay between transferred messages and words. + +Signed-off-by: Oskari Lemmela +Link: https://lore.kernel.org/r/20211222055958.1383233-3-oskari@lemmela.net +Signed-off-by: Mark Brown +--- + drivers/spi/spi-ar934x.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/spi/spi-ar934x.c b/drivers/spi/spi-ar934x.c +index def32e0aaefe..e1b64e35900c 100644 +--- a/drivers/spi/spi-ar934x.c ++++ b/drivers/spi/spi-ar934x.c +@@ -137,8 +137,10 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + reg >>= 8; + } + } ++ spi_delay_exec(&t->word_delay, t); + } + m->actual_length += t->len; ++ spi_transfer_delay_exec(t); + } + + msg_done: +-- +2.25.1 + diff --git a/target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch b/target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch new file mode 100644 index 0000000000..361194e8ee --- /dev/null +++ b/target/linux/ath79/patches-5.10/403-v5.17-spi-ar934x-fix-transfer-size.patch @@ -0,0 +1,67 @@ +From ebe33e5a98dcf14a9630845f3f10c193584ac054 Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Wed, 22 Dec 2021 07:59:57 +0200 +Subject: [PATCH] spi: ar934x: fix transfer size + +If bits_per_word is configured, transfer only word amount +of data per iteration. + +Signed-off-by: Oskari Lemmela +Link: https://lore.kernel.org/r/20211222055958.1383233-2-oskari@lemmela.net +Signed-off-by: Mark Brown +--- + drivers/spi/spi-ar934x.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/drivers/spi/spi-ar934x.c b/drivers/spi/spi-ar934x.c +index e1b64e35900c..ec7250c4c810 100644 +--- a/drivers/spi/spi-ar934x.c ++++ b/drivers/spi/spi-ar934x.c +@@ -82,7 +82,7 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + struct spi_device *spi = m->spi; + unsigned long trx_done, trx_cur; + int stat = 0; +- u8 term = 0; ++ u8 bpw, term = 0; + int div, i; + u32 reg; + const u8 *tx_buf; +@@ -90,6 +90,11 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + + m->actual_length = 0; + list_for_each_entry(t, &m->transfers, transfer_list) { ++ if (t->bits_per_word >= 8 && t->bits_per_word < 32) ++ bpw = t->bits_per_word >> 3; ++ else ++ bpw = 4; ++ + if (t->speed_hz) + div = ar934x_spi_clk_div(sp, t->speed_hz); + else +@@ -105,10 +110,10 @@ static int ar934x_spi_transfer_one_message(struct spi_controller *master, + iowrite32(reg, sp->base + AR934X_SPI_REG_CTRL); + iowrite32(0, sp->base + AR934X_SPI_DATAOUT); + +- for (trx_done = 0; trx_done < t->len; trx_done += 4) { ++ for (trx_done = 0; trx_done < t->len; trx_done += bpw) { + trx_cur = t->len - trx_done; +- if (trx_cur > 4) +- trx_cur = 4; ++ if (trx_cur > bpw) ++ trx_cur = bpw; + else if (list_is_last(&t->transfer_list, &m->transfers)) + term = 1; + +@@ -193,7 +198,8 @@ static int ar934x_spi_probe(struct platform_device *pdev) + ctlr->mode_bits = SPI_LSB_FIRST; + ctlr->setup = ar934x_spi_setup; + ctlr->transfer_one_message = ar934x_spi_transfer_one_message; +- ctlr->bits_per_word_mask = SPI_BPW_MASK(8); ++ ctlr->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) | ++ SPI_BPW_MASK(16) | SPI_BPW_MASK(8); + ctlr->dev.of_node = pdev->dev.of_node; + ctlr->num_chipselect = 3; + +-- +2.25.1 +