[PATCH v2] mtd: rawnand: pl353: make sure optimal timings are applied

Olivier Sobrie posted 1 patch 2 weeks, 6 days ago
drivers/mtd/nand/raw/pl35x-nand-controller.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH v2] mtd: rawnand: pl353: make sure optimal timings are applied
Posted by Olivier Sobrie 2 weeks, 6 days ago
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.

Fixes: 08d8c62164a3 ("mtd: rawnand: pl353: Add support for the ARM PL353 SMC NAND controller")
Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
Cc: stable@vger.kernel.org
---
Changes in v2:
  - added Fixes tag.
  - added stable in Cc.

 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
Re: [PATCH v2] mtd: rawnand: pl353: make sure optimal timings are applied
Posted by Miquel Raynal 2 weeks, 5 days ago
On Tue, 17 Mar 2026 18:18:07 +0100, Olivier Sobrie 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.
> 
> [...]

Applied to mtd/fixes, thanks!

[1/1] mtd: rawnand: pl353: make sure optimal timings are applied
      commit: b9465b04de4b90228de03db9a1e0d56b00814366

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl