From: "Thibaut VARÈNE" <hacks+kernel@slashdirt.org>
To: linux-mtd@lists.infradead.org
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
tudor.ambarus@microchip.com, p.yadav@ti.com, michael@walle.cc,
git@johnthomson.fastmail.com.au,
"Thibaut VARÈNE" <hacks+kernel@slashdirt.org>
Subject: [PATCH v3 3/3] mtd: spi-nor: allow overriding uniform erase
Date: Fri, 29 Jul 2022 11:16:36 +0200 [thread overview]
Message-ID: <20220729091636.59287-4-hacks+kernel@slashdirt.org> (raw)
In-Reply-To: <20220729091636.59287-1-hacks+kernel@slashdirt.org>
This patch introduces a new CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE option
which forces an SPI NOR mtd device to use non-uniform erase, enabling
(on supporting hardware) to complete erase operations using all
available erasesizes through spi_nor_erase_multi_sectors().
The majority of current SPI NOR devices support multiple erasesizes:
instead of forcing all operations to use 4K erase size for everything
(using CONFIG_MTD_SPI_NOR_USE_4K_SECTORS) when write access to a
minor-aligned partition is needed, this patch allows the kernel to use
the largest suitable erase size for a given operation, thus improving
performance.
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Signed-off-by: Thibaut VARÈNE <hacks+kernel@slashdirt.org>
---
drivers/mtd/spi-nor/Kconfig | 10 ++++++++++
drivers/mtd/spi-nor/core.c | 2 ++
2 files changed, 12 insertions(+)
diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 24cd25de2..09df9f1a8 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -10,6 +10,16 @@ menuconfig MTD_SPI_NOR
if MTD_SPI_NOR
+config MTD_SPI_NOR_USE_VARIABLE_ERASE
+ bool "Disable uniform_erase to allow use of all hardware supported erasesizes"
+ depends on !MTD_SPI_NOR_USE_4K_SECTORS
+ default n
+ help
+ Allow mixed use of all hardware supported erasesizes,
+ by forcing spi_nor to use the multiple eraseregions code path.
+ For example: A 68K erase will use one 64K erase, and one 4K erase
+ on supporting hardware.
+
config MTD_SPI_NOR_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
default y
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index bafd3396e..b4b539a9f 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1048,6 +1048,8 @@ static u8 spi_nor_convert_3to4_erase(u8 opcode)
static bool spi_nor_has_uniform_erase(const struct spi_nor *nor)
{
+ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE))
+ return false;
return !!nor->params->erase_map.uniform_erase_type;
}
--
2.30.2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2022-07-29 9:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 9:16 [PATCH v3 0/3] mtd: write support for minor-aligned partitions Thibaut VARÈNE
2022-07-29 9:16 ` [PATCH v3 1/3] mtd: mtdpart: " Thibaut VARÈNE
2022-07-29 9:16 ` [PATCH v3 2/3] mtd: spi-nor: set erasesize_minor for non-uniform erase Thibaut VARÈNE
2022-07-29 9:16 ` Thibaut VARÈNE [this message]
2022-08-09 9:23 ` [PATCH v3 0/3] mtd: write support for minor-aligned partitions Thibaut VARÈNE
2022-08-09 15:45 ` Tudor.Ambarus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220729091636.59287-4-hacks+kernel@slashdirt.org \
--to=hacks+kernel@slashdirt.org \
--cc=git@johnthomson.fastmail.com.au \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=p.yadav@ti.com \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).