From: Sudip Mukherjee <sudip.mukherjee@sifive.com>
To: Tudor Ambarus <tudor.ambarus@microchip.com>,
Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <michael@walle.cc>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: greentime.hu@sifive.com, jude.onyenegecha@sifive.com,
william.salmon@sifive.com, adnan.chowdhury@sifive.com,
ben.dooks@sifive.com, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org,
Sudip Mukherjee <sudip.mukherjee@sifive.com>
Subject: [PATCH v3 2/2] mtd: spi-nor: add SFDP fixups for Quad Page Program
Date: Tue, 20 Sep 2022 19:48:08 +0100 [thread overview]
Message-ID: <20220920184808.44876-2-sudip.mukherjee@sifive.com> (raw)
In-Reply-To: <20220920184808.44876-1-sudip.mukherjee@sifive.com>
SFDP table of some flash chips do not advertise support of Quad Input
Page Program even though it has support. Use flags and add hardware
cap for these chips.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@sifive.com>
---
Change from v2: SPI_NOR_QUAD_PP added to info->flags instead of
info->fixup_flags.
Link: https://lore.kernel.org/lkml/498c33a8-014f-e542-f143-cba5760fafdd@microchip.com/
Results from the tests given by Tudor in the following mail.
drivers/mtd/spi-nor/core.c | 6 ++++++
drivers/mtd/spi-nor/core.h | 2 ++
drivers/mtd/spi-nor/issi.c | 1 +
3 files changed, 9 insertions(+)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index f2c64006f8d75..992fb332514d8 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2474,6 +2474,12 @@ static void spi_nor_late_init_params(struct spi_nor *nor)
*/
if (nor->flags & SNOR_F_HAS_LOCK && !nor->params->locking_ops)
spi_nor_init_default_locking_ops(nor);
+
+ if (nor->info->flags & SPI_NOR_QUAD_PP) {
+ nor->params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4;
+ spi_nor_set_pp_settings(&nor->params->page_programs[SNOR_CMD_PP_1_1_4],
+ SPINOR_OP_PP_1_1_4, SNOR_PROTO_1_1_4);
+ }
}
/**
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 85b0cf254e974..c2334fe33e2f9 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -458,6 +458,7 @@ struct spi_nor_fixups {
* SPI_NOR_NO_ERASE: no erase command needed.
* NO_CHIP_ERASE: chip does not support chip erase.
* SPI_NOR_NO_FR: can't do fastread.
+ * SPI_NOR_QUAD_PP: flash supports Quad Input Page Program.
*
* @no_sfdp_flags: flags that indicate support that can be discovered via SFDP.
* Used when SFDP tables are not defined in the flash. These
@@ -507,6 +508,7 @@ struct flash_info {
#define SPI_NOR_NO_ERASE BIT(6)
#define NO_CHIP_ERASE BIT(7)
#define SPI_NOR_NO_FR BIT(8)
+#define SPI_NOR_QUAD_PP BIT(9)
u8 no_sfdp_flags;
#define SPI_NOR_SKIP_SFDP BIT(0)
diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c
index 8b48459b5054c..014cd9038bedc 100644
--- a/drivers/mtd/spi-nor/issi.c
+++ b/drivers/mtd/spi-nor/issi.c
@@ -73,6 +73,7 @@ static const struct flash_info issi_nor_parts[] = {
{ "is25wp256", INFO(0x9d7019, 0, 64 * 1024, 512)
PARSE_SFDP
FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
+ FLAGS(SPI_NOR_QUAD_PP)
.fixups = &is25lp256_fixups },
/* PMC */
--
2.30.2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2022-09-20 18:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 18:48 [PATCH v3 1/2] mtd: spi-nor: issi: is25wp256: Init flash based on SFDP Sudip Mukherjee
2022-09-20 18:48 ` Sudip Mukherjee [this message]
2022-09-20 18:52 ` [PATCH v3 2/2] mtd: spi-nor: add SFDP fixups for Quad Page Program Sudip Mukherjee
2022-09-20 18:51 ` [PATCH v3 1/2] mtd: spi-nor: issi: is25wp256: Init flash based on SFDP Sudip Mukherjee
2022-09-22 14:19 ` Michael Walle
2022-09-23 18:31 ` Sudip Mukherjee
2022-11-22 10:26 ` Tudor Ambarus
2022-12-21 0:30 ` Guenter Roeck
2022-12-21 7:03 ` Tudor Ambarus
2022-12-21 8:49 ` Tudor Ambarus
2022-12-21 8:22 ` Michael Walle
2022-12-21 12:16 ` Guenter Roeck
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=20220920184808.44876-2-sudip.mukherjee@sifive.com \
--to=sudip.mukherjee@sifive.com \
--cc=adnan.chowdhury@sifive.com \
--cc=ben.dooks@sifive.com \
--cc=greentime.hu@sifive.com \
--cc=jude.onyenegecha@sifive.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.com \
--cc=vigneshr@ti.com \
--cc=william.salmon@sifive.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