drivers/mtd/nand/raw/pl35x-nand-controller.c | 3 +++ 1 file changed, 3 insertions(+)
Timings of the nand are adjusted by pl35x_nfc_setup_interface() but
actually applied by the pl35x_nand_select_target() function.
If there is only one nand chip, the pl35x_nand_select_target() will only
apply the timings once since the test at its beginning will always be true
after the first call to this function. As a result, the hardware will
keep using the default timings set at boot to detect the nand chip, not
the optimal ones.
With this patch, we program directly the new timings when
pl35x_nfc_setup_interface() is called.
Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
---
drivers/mtd/nand/raw/pl35x-nand-controller.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/nand/raw/pl35x-nand-controller.c b/drivers/mtd/nand/raw/pl35x-nand-controller.c
index 947fd86ac5fa..f2c65eb7a8d9 100644
--- a/drivers/mtd/nand/raw/pl35x-nand-controller.c
+++ b/drivers/mtd/nand/raw/pl35x-nand-controller.c
@@ -862,6 +862,9 @@ static int pl35x_nfc_setup_interface(struct nand_chip *chip, int cs,
PL35X_SMC_NAND_TAR_CYCLES(tmgs.t_ar) |
PL35X_SMC_NAND_TRR_CYCLES(tmgs.t_rr);
+ writel(plnand->timings, nfc->conf_regs + PL35X_SMC_CYCLES);
+ pl35x_smc_update_regs(nfc);
+
return 0;
}
--
2.53.0
Hello Olivier, + Andrea On 04/03/2026 at 22:18:23 +01, Olivier Sobrie <olivier@sobrie.be> wrote: > Timings of the nand are adjusted by pl35x_nfc_setup_interface() but > actually applied by the pl35x_nand_select_target() function. > If there is only one nand chip, the pl35x_nand_select_target() will only > apply the timings once since the test at its beginning will always be true > after the first call to this function. As a result, the hardware will > keep using the default timings set at boot to detect the nand chip, not > the optimal ones. > > With this patch, we program directly the new timings when > pl35x_nfc_setup_interface() is called. > > Signed-off-by: Olivier Sobrie <olivier@sobrie.be> Nice, this probably will deserve a Fixes tag and Cc: stable. Andrea, this might be the reason why your NAND chip misbehaves after a set_feature. Would you mind testing it? Thanks, Miquèl
Hello Miquel, On Mon, Mar 16, 2026 at 09:46:39AM +0100, Miquel Raynal wrote: > Hello Olivier, > > + Andrea > > On 04/03/2026 at 22:18:23 +01, Olivier Sobrie <olivier@sobrie.be> wrote: > > > Timings of the nand are adjusted by pl35x_nfc_setup_interface() but > > actually applied by the pl35x_nand_select_target() function. > > If there is only one nand chip, the pl35x_nand_select_target() will only > > apply the timings once since the test at its beginning will always be true > > after the first call to this function. As a result, the hardware will > > keep using the default timings set at boot to detect the nand chip, not > > the optimal ones. > > > > With this patch, we program directly the new timings when > > pl35x_nfc_setup_interface() is called. > > > > Signed-off-by: Olivier Sobrie <olivier@sobrie.be> > > Nice, this probably will deserve a Fixes tag and Cc: stable. Do you implicitely suggest that I should send a v2 of this patch with Fixes tag and stable in CC? Or do you take care of that? Thanks, Olivier
>> > With this patch, we program directly the new timings when >> > pl35x_nfc_setup_interface() is called. >> > >> > Signed-off-by: Olivier Sobrie <olivier@sobrie.be> >> >> Nice, this probably will deserve a Fixes tag and Cc: stable. > > Do you implicitely suggest that I should send a v2 of this patch > with Fixes tag and stable in CC? Or do you take care of that? Please send a v2, indeed! Thanks, Miquèl
© 2016 - 2026 Red Hat, Inc.