* [PATCH] mtd: rawnand: Skip timing mode readback check for GigaDevice NAND
@ 2026-11-24 13:06 Teng Wu
2026-11-24 13:40 ` Miquel Raynal
0 siblings, 1 reply; 4+ messages in thread
From: Teng Wu @ 2026-11-24 13:06 UTC (permalink / raw)
To: linux-mtd
Cc: miquel.raynal, vigneshr, richard, linux-kernel, teng.wu, weijie.huang
GigaDevice raw NAND chips (manufacturer ID 0xC8) support the timing
modes advertised in their ONFI parameter page, so there is no need to
verify or enforce the timing mode switch on them. The supported set
depends on the supply voltage: 3.3V parts (e.g. GD9FU2G8F3A, DID DAh)
report modes 0-5 (3Fh in byte 129-130 of the parameter page), while
1.8V parts (e.g. GD9FS2G8F3A, DID AAh) report modes 0-4 (1Fh). The
highest supported mode is already picked automatically from the
parameter page by nand_choose_best_sdr_timings(), so the only thing
getting in the way is the readback check.
The GET_FEATURE timing mode readback on these chips does not reflect
the mode selected through SET_FEATURE. The strict check in
nand_setup_interface() therefore misdetects the chip as not
acknowledging the requested timing mode, printing "timing mode N not
acknowledged by the NAND chip" and falling back to a slower mode for
no reason.
Skip the readback check for GigaDevice chips while keeping it for all
other vendors, and go straight to updating the interface
configuration.
Signed-off-by: Teng Wu <gigadevice2025@gmail.com>
---
drivers/mtd/nand/raw/nand_base.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index a225b10f8145..8d77ebac4939 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -890,6 +890,15 @@ static int nand_setup_interface(struct nand_chip *chip, int chipnr)
goto err_reset_chip;
if (request != tmode_param[0]) {
+ /*
+ * GigaDevice raw NAND chips (manufacturer ID 0xC8) support
+ * the timing modes advertised in their ONFI parameter page.
+ * Skip the strict ack check; keep it for other vendors.
+ */
+ if (chip->id.data[0] == 0xC8) {
+ goto update_interface_config;
+ }
+
pr_warn("%s timing mode %d not acknowledged by the NAND chip\n",
nand_interface_is_nvddr(chip->best_interface_config) ? "NV-DDR" : "SDR",
chip->best_interface_config->timings.mode);
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mtd: rawnand: Skip timing mode readback check for GigaDevice NAND
2026-11-24 13:06 [PATCH] mtd: rawnand: Skip timing mode readback check for GigaDevice NAND Teng Wu
@ 2026-11-24 13:40 ` Miquel Raynal
2026-11-27 12:24 ` Teng Wu
0 siblings, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2026-11-24 13:40 UTC (permalink / raw)
To: Teng Wu; +Cc: linux-mtd, vigneshr, richard, linux-kernel, teng.wu, weijie.huang
Hi,
> if (request != tmode_param[0]) {
> + /*
> + * GigaDevice raw NAND chips (manufacturer ID 0xC8) support
> + * the timing modes advertised in their ONFI parameter page.
> + * Skip the strict ack check; keep it for other vendors.
> + */
> + if (chip->id.data[0] == 0xC8) {
> + goto update_interface_config;
> + }
> +
There is a vendor driver, you shall use it rather than polluting the
core with vendor specific fixups. Check what
macronix_nand_fix_broken_get_timings() does for example.
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mtd: rawnand: Skip timing mode readback check for GigaDevice NAND
2026-11-24 13:40 ` Miquel Raynal
@ 2026-11-27 12:24 ` Teng Wu
2026-11-27 12:52 ` Miquel Raynal
0 siblings, 1 reply; 4+ messages in thread
From: Teng Wu @ 2026-11-27 12:24 UTC (permalink / raw)
To: Miquel Raynal
Cc: linux-mtd, vigneshr, richard, linux-kernel, teng.wu, weijie.huang
On Tue, Nov 24, 2026 at 02:40:24PM +0100, Miquel Raynal wrote:
> Hi,
>
> > if (request != tmode_param[0]) {
> > + /*
> > + * GigaDevice raw NAND chips (manufacturer ID 0xC8) support
> > + * the timing modes advertised in their ONFI parameter page.
> > + * Skip the strict ack check; keep it for other vendors.
> > + */
> > + if (chip->id.data[0] == 0xC8) {
> > + goto update_interface_config;
> > + }
> > +
>
> There is a vendor driver, you shall use it rather than polluting the
> core with vendor specific fixups. Check what
> macronix_nand_fix_broken_get_timings() does for example.
>
> Thanks,
> Miquèl
Thank you for your review.
I agree that vendor-specific workarounds do not belong in nand_base.c.
Adding a dedicated nand_gigadevice.c would be a substantial piece of
work and is outside the scope of this effort.I understand if this patch
is rejected, and I will drop it for now.
That said, if there is a significant future need to add nand_gigadevice.c,
we will refer back to the changes in this patch.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mtd: rawnand: Skip timing mode readback check for GigaDevice NAND
2026-11-27 12:24 ` Teng Wu
@ 2026-11-27 12:52 ` Miquel Raynal
0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-11-27 12:52 UTC (permalink / raw)
To: Teng Wu; +Cc: linux-mtd, vigneshr, richard, linux-kernel, teng.wu, weijie.huang
Hi Teng,
> I agree that vendor-specific workarounds do not belong in nand_base.c.
> Adding a dedicated nand_gigadevice.c would be a substantial piece of
> work and is outside the scope of this effort.I understand if this patch
> is rejected, and I will drop it for now.
>
> That said, if there is a significant future need to add nand_gigadevice.c,
> we will refer back to the changes in this patch.
You need a nand_manufacturer_ops (4 lines) and implement the above fix
in the init hook after copy-pasting the pattern from another vendor
driver. Then add that file to the Makefile and refer to it in the core's
includes. Honestly not what I would call a "substantial piece of work" :)
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-27 12:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 13:06 [PATCH] mtd: rawnand: Skip timing mode readback check for GigaDevice NAND Teng Wu
2026-11-24 13:40 ` Miquel Raynal
2026-11-27 12:24 ` Teng Wu
2026-11-27 12:52 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®