]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: rawnand: atmel: set pmecc data setup time
authorBalamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
Mon, 21 Jul 2025 10:43:40 +0000 (16:13 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:35 +0000 (16:22 +0200)
[ Upstream commit f552a7c7e0a14215cb8a6fd89e60fa3932a74786 ]

Setup the pmecc data setup time as 3 clock cycles for 133MHz as recommended
by the datasheet.

Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Reported-by: Zixun LI <admin@hifiphile.com>
Closes: https://lore.kernel.org/all/c015bb20-6a57-4f63-8102-34b3d83e0f5b@microchip.com
Suggested-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/nand/raw/atmel/pmecc.c

index d1ed5878b3b1f31a4859d6c8b481aa4baa1fb484..28ed65dd3d43f336f00978f3c140dea6cb356286 100644 (file)
@@ -143,6 +143,7 @@ struct atmel_pmecc_caps {
        int nstrengths;
        int el_offset;
        bool correct_erased_chunks;
+       bool clk_ctrl;
 };
 
 struct atmel_pmecc {
@@ -846,6 +847,10 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
        if (IS_ERR(pmecc->regs.errloc))
                return ERR_CAST(pmecc->regs.errloc);
 
+       /* pmecc data setup time */
+       if (caps->clk_ctrl)
+               writel(PMECC_CLK_133MHZ, pmecc->regs.base + ATMEL_PMECC_CLK);
+
        /* Disable all interrupts before registering the PMECC handler. */
        writel(0xffffffff, pmecc->regs.base + ATMEL_PMECC_IDR);
        atmel_pmecc_reset(pmecc);
@@ -899,6 +904,7 @@ static struct atmel_pmecc_caps at91sam9g45_caps = {
        .strengths = atmel_pmecc_strengths,
        .nstrengths = 5,
        .el_offset = 0x8c,
+       .clk_ctrl = true,
 };
 
 static struct atmel_pmecc_caps sama5d4_caps = {