From patchwork Sun Oct 18 21:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 1383914 X-Patchwork-Delegate: vigneshr@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=BPCydHNa; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4CDtQt0rxwz9sS8 for ; Mon, 19 Oct 2020 08:32:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; 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=9+R4MkkUxt95oFPeJrRHWSl0EKRZj+cUBgf2wOvzf6U=; b=BPCydHNau2Y5S0Vl8BLhL8QLCl +Zu1XqKTQ0Mj20U9CvZ+IoO3XaVA2nWMgs5wAoSFV/oyFjtIiUWXtwlMRgxEMkHz/OU89zuEdDaWa WJYuJYRWjeqKInptO8G43D4LEy3o/yTMvUUarlQ4yfO2jNAanj5BSgxrRTXUow0blCg02Je/v+zSY n7KefeazdeXQPIs8magDz8uyi/2CYt9eqc9B1uKPymrxRD18VmINjrNiz3/Qu2HVrlKTrRKoaOqBX YDpOP8F7Ki12beoTJyu0Nz/mpe7ORFBzPwr3KENFpsFsxi0GL9mlg8YxmPKY1SIwI8FlEw7IvV1N3 t2FxRlXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUGH5-0005Te-Sv; Sun, 18 Oct 2020 21:31:31 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUGH3-0005SX-0F for linux-mtd@lists.infradead.org; Sun, 18 Oct 2020 21:31:29 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id CAAD21816C713; Sun, 18 Oct 2020 23:31:18 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id e0k_lvnIVV77; Sun, 18 Oct 2020 23:31:18 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id kLkPh2HFQ1iH; Sun, 18 Oct 2020 23:31:18 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [RFC][PATCH 1/3] spi-nor: Add SPI_NOR_NO_WIP Date: Sun, 18 Oct 2020 23:31:01 +0200 Message-Id: <20201018213103.28798-1-richard@nod.at> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201018_173129_170764_7EF40E94 X-CRM114-Status: GOOD ( 13.31 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , tudor.ambarus@microchip.com, vigneshr@ti.com, miquel.raynal@bootlin.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Some flashes have their WIP bit hardwired to 0. They are always ready and there there is no need query the status register after a write command. Signed-off-by: Richard Weinberger --- drivers/mtd/spi-nor/core.c | 6 +++++- drivers/mtd/spi-nor/core.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 0369d98b2d12..eb01a0798087 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -546,8 +546,12 @@ static void spi_nor_clear_sr(struct spi_nor *nor) */ static int spi_nor_sr_ready(struct spi_nor *nor) { - int ret = spi_nor_read_sr(nor, nor->bouncebuf); + int ret; + + if (nor->flags & SPI_NOR_NO_WIP) + return 1; + ret = spi_nor_read_sr(nor, nor->bouncebuf); if (ret) return ret; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 6f2f6b27173f..621202fda5d0 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -311,6 +311,8 @@ struct flash_info { * BP3 is bit 6 of status register. * Must be used with SPI_NOR_4BIT_BP. */ +#define SPI_NOR_NO_WIP BIT(19) /* Flash is always reads, WIP status bit + has no meaning. */ /* Part specific fixup hooks. */ const struct spi_nor_fixups *fixups; From patchwork Sun Oct 18 21:31:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 1383913 X-Patchwork-Delegate: vigneshr@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=hM5zwrUO; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4CDtQm2cPbz9sSC for ; Mon, 19 Oct 2020 08:32:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=eT5uDvO2R4pJ+xSkAkBbLTnbquPEwBtddolDjPzxJO4=; b=hM5zwrUO77aZHezSfi0fDc6VQ 7NCZdKeEVJtFBadq5DsI0vE08/ZyEng5pMudKli/NsMQlTBCIBINo4o0lHT1lErxBhmI5IHB5WpfA aR6FVJsGWPsfrMaiBm754BYwX58ax6U43dD2ZK6jE1MBfZa5RBoKwuazMKJ67jFMevH5yKA0C/IxA zkPsU2g+oKfL6C+lTIbWe1HZ9mBCz+3e+qoobzrdvD68sJ6j4Ty5HIQs0SBzBa4vBRyPU8zKNcrYP GqXEIYWpobxpGaUiJdV7JjdDrRlw1crLVMxuFsu9VsVYI6jKOI6XHeaEXN9sOdGN/ARYDyBPL3xNW LLxWTxR+A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUGH8-0005UL-Pb; Sun, 18 Oct 2020 21:31:34 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUGH2-0005SY-Vy for linux-mtd@lists.infradead.org; Sun, 18 Oct 2020 21:31:30 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 05E9D1816C718; Sun, 18 Oct 2020 23:31:19 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 5vg5sjU_jtkM; Sun, 18 Oct 2020 23:31:18 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fEsAp7Mt5D7Y; Sun, 18 Oct 2020 23:31:18 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [RFC][PATCH 2/3] spi-nor: Add INFO_PGZ Date: Sun, 18 Oct 2020 23:31:02 +0200 Message-Id: <20201018213103.28798-2-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201018213103.28798-1-richard@nod.at> References: <20201018213103.28798-1-richard@nod.at> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201018_173129_171201_DF32CA8B X-CRM114-Status: GOOD ( 10.27 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , tudor.ambarus@microchip.com, vigneshr@ti.com, miquel.raynal@bootlin.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Allow much larger page sizes than just 256 bytes. Signed-off-by: Richard Weinberger --- drivers/mtd/spi-nor/core.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 621202fda5d0..76c3f8ef47e9 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -268,7 +268,7 @@ struct flash_info { unsigned sector_size; u16 n_sectors; - u16 page_size; + u32 page_size; u16 addr_width; u32 flags; @@ -319,7 +319,7 @@ struct flash_info { }; /* Used when the "_ext_id" is two bytes at most */ -#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ +#define INFO_PGZ(_jedec_id, _ext_id, _sector_size, _n_sectors, _page_size, _flags) \ .id = { \ ((_jedec_id) >> 16) & 0xff, \ ((_jedec_id) >> 8) & 0xff, \ @@ -330,9 +330,12 @@ struct flash_info { .id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))), \ .sector_size = (_sector_size), \ .n_sectors = (_n_sectors), \ - .page_size = 256, \ + .page_size = (_page_size), \ .flags = (_flags), +#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ + INFO_PGZ(_jedec_id, _ext_id, _sector_size, _n_sectors, 256, _flags) + #define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ .id = { \ ((_jedec_id) >> 16) & 0xff, \ From patchwork Sun Oct 18 21:31:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 1383912 X-Patchwork-Delegate: vigneshr@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Re/dQe9a; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4CDtQk4LR9z9sS8 for ; Mon, 19 Oct 2020 08:32:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=AZpAIHY4o0oghALPFZHsmBDeMoV5zy4dQoiOGGzNQLQ=; b=Re/dQe9apptntSB8xefVjDgCp wNRXVmBIKg3AcqLVC8ajqyPdKk9uO+s2ZACflSp7DNM4ncmVU+2DKg+HEWvbpSuVlAJIL7uT94FJ8 kFLs1xTTtr3FbAH+YvGv3Pu4luw3QL9HIe+H7CBcz864Up8y9P1MtjfkiyZJYdcDiFrLcG4z1vSuf iY3KJ7yp43x5hsSTqyBX+AQITEuVV41Y/tcqq3uNpD29CnvXwbn1RYTXaOrwFw4XOj/1os1ELg9X9 eBmQB3c7105hscB5b5zvxsGS+/3hAuMxOouC99/jkp10VxvAxTwVa+OL7zttCpXINayGlPn1Ww+1Y pQI/1zjIA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUGH7-0005U9-LN; Sun, 18 Oct 2020 21:31:33 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUGH2-0005SZ-VR for linux-mtd@lists.infradead.org; Sun, 18 Oct 2020 21:31:29 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 558F91816C70F; Sun, 18 Oct 2020 23:31:19 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Z0016ic3gZEJ; Sun, 18 Oct 2020 23:31:19 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 1H89e6CMb0k1; Sun, 18 Oct 2020 23:31:18 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [RFC][PATCH 3/3] spi-nor: Speedup mb85rs1mt FRAM writes Date: Sun, 18 Oct 2020 23:31:03 +0200 Message-Id: <20201018213103.28798-3-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201018213103.28798-1-richard@nod.at> References: <20201018213103.28798-1-richard@nod.at> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201018_173129_146084_6C0C80A3 X-CRM114-Status: GOOD ( 13.83 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , tudor.ambarus@microchip.com, vigneshr@ti.com, miquel.raynal@bootlin.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This FRAM does not internally buffer writes, as soon the write command returns, all data is stable. Therefore the WIP bit is always 0 and we can skip the check. The write command accepts infinitely data, the target address will just roll over if you feed in more bytes than the flash can handle. To speed up bulk writes, specify a page size of the sizeof the whole FRAM. That way the whole FRAM can be written using single program sequence. With this changes I was able to double the write performance on one of my systems. Signed-off-by: Richard Weinberger --- drivers/mtd/spi-nor/fujitsu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/fujitsu.c b/drivers/mtd/spi-nor/fujitsu.c index e385d93e756c..3152999fbaa1 100644 --- a/drivers/mtd/spi-nor/fujitsu.c +++ b/drivers/mtd/spi-nor/fujitsu.c @@ -10,7 +10,7 @@ static const struct flash_info fujitsu_parts[] = { /* Fujitsu */ - { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) }, + { "mb85rs1mt", INFO_PGZ(0x047f27, 0, 1 << 17, 1, 1 << 17, SPI_NOR_NO_ERASE | SPI_NOR_NO_WIP) }, }; const struct spi_nor_manufacturer spi_nor_fujitsu = {