Skip to content

Commit 550b9fc

Browse files
Boris Brezillonmiquelraynal
authored andcommitted
mtd: rawnand: fsmc: Stop implementing ->select_chip()
Now that the CS line to assert is directly passed through the nand_operation struct we can replace the fsmc_select_chip() implementation by an internal fsmc_ce_ctrl() function which is directly called from fsmc_exec_op() Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 02b4a52 commit 550b9fc

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

drivers/mtd/nand/raw/fsmc_nand.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -609,22 +609,19 @@ static void fsmc_write_buf_dma(struct mtd_info *mtd, const uint8_t *buf,
609609
}
610610

611611
/* fsmc_select_chip - assert or deassert nCE */
612-
static void fsmc_select_chip(struct nand_chip *chip, int chipnr)
612+
static void fsmc_ce_ctrl(struct fsmc_nand_data *host, bool assert)
613613
{
614-
struct fsmc_nand_data *host = mtd_to_fsmc(nand_to_mtd(chip));
615-
u32 pc;
616-
617-
/* Support only one CS */
618-
if (chipnr > 0)
619-
return;
614+
u32 pc = readl(host->regs_va + FSMC_PC);
620615

621-
pc = readl(host->regs_va + FSMC_PC);
622-
if (chipnr < 0)
616+
if (!assert)
623617
writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC);
624618
else
625619
writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC);
626620

627-
/* nCE line must be asserted before starting any operation */
621+
/*
622+
* nCE line changes must be applied before returning from this
623+
* function.
624+
*/
628625
mb();
629626
}
630627

@@ -645,6 +642,9 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op,
645642
int i;
646643

647644
pr_debug("Executing operation [%d instructions]:\n", op->ninstrs);
645+
646+
fsmc_ce_ctrl(host, true);
647+
648648
for (op_id = 0; op_id < op->ninstrs; op_id++) {
649649
instr = &op->instrs[op_id];
650650

@@ -701,6 +701,8 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op,
701701
}
702702
}
703703

704+
fsmc_ce_ctrl(host, false);
705+
704706
return ret;
705707
}
706708

@@ -1081,7 +1083,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
10811083

10821084
mtd->dev.parent = &pdev->dev;
10831085
nand->exec_op = fsmc_exec_op;
1084-
nand->select_chip = fsmc_select_chip;
10851086

10861087
/*
10871088
* Setup default ECC mode. nand_dt_init() called from nand_scan_ident()

0 commit comments

Comments
 (0)