Skip to content

Commit da9ba4d

Browse files
kamaldasu-cryptomiquelraynal
authored andcommitted
mtd: rawnand: brcmnand: skip DMA during panic write
When oops_panic_write is set, the driver disables interrupts and switches to PIO polling mode but still falls through into the DMA path. DMA cannot be used reliably in panic context, so make the DMA path an else branch to ensure only PIO is used during panic writes. Fixes: c1ac2dc ("mtd: rawnand: brcmnand: When oops in progress use pio and interrupt polling") Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> Reviewed-by: William Zhang <william.zhang@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent bab2bc6 commit da9ba4d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/mtd/nand/raw/brcmnand/brcmnand.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,14 +2350,12 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
23502350
for (i = 0; i < ctrl->max_oob; i += 4)
23512351
oob_reg_write(ctrl, i, 0xffffffff);
23522352

2353-
if (mtd->oops_panic_write)
2353+
if (mtd->oops_panic_write) {
23542354
/* switch to interrupt polling and PIO mode */
23552355
disable_ctrl_irqs(ctrl);
2356-
2357-
if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
2356+
} else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
23582357
if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,
23592358
CMD_PROGRAM_PAGE))
2360-
23612359
ret = -EIO;
23622360

23632361
goto out;

0 commit comments

Comments
 (0)