Commit 550b9fc4 authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal

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: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 02b4a526
...@@ -609,22 +609,19 @@ static void fsmc_write_buf_dma(struct mtd_info *mtd, const uint8_t *buf, ...@@ -609,22 +609,19 @@ static void fsmc_write_buf_dma(struct mtd_info *mtd, const uint8_t *buf,
} }
/* fsmc_select_chip - assert or deassert nCE */ /* fsmc_select_chip - assert or deassert nCE */
static void fsmc_select_chip(struct nand_chip *chip, int chipnr) static void fsmc_ce_ctrl(struct fsmc_nand_data *host, bool assert)
{ {
struct fsmc_nand_data *host = mtd_to_fsmc(nand_to_mtd(chip)); u32 pc = readl(host->regs_va + FSMC_PC);
u32 pc;
/* Support only one CS */
if (chipnr > 0)
return;
pc = readl(host->regs_va + FSMC_PC); if (!assert)
if (chipnr < 0)
writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC); writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC);
else else
writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC); writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC);
/* nCE line must be asserted before starting any operation */ /*
* nCE line changes must be applied before returning from this
* function.
*/
mb(); mb();
} }
...@@ -645,6 +642,9 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, ...@@ -645,6 +642,9 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op,
int i; int i;
pr_debug("Executing operation [%d instructions]:\n", op->ninstrs); pr_debug("Executing operation [%d instructions]:\n", op->ninstrs);
fsmc_ce_ctrl(host, true);
for (op_id = 0; op_id < op->ninstrs; op_id++) { for (op_id = 0; op_id < op->ninstrs; op_id++) {
instr = &op->instrs[op_id]; instr = &op->instrs[op_id];
...@@ -701,6 +701,8 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, ...@@ -701,6 +701,8 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op,
} }
} }
fsmc_ce_ctrl(host, false);
return ret; return ret;
} }
...@@ -1081,7 +1083,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) ...@@ -1081,7 +1083,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
mtd->dev.parent = &pdev->dev; mtd->dev.parent = &pdev->dev;
nand->exec_op = fsmc_exec_op; nand->exec_op = fsmc_exec_op;
nand->select_chip = fsmc_select_chip;
/* /*
* Setup default ECC mode. nand_dt_init() called from nand_scan_ident() * Setup default ECC mode. nand_dt_init() called from nand_scan_ident()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment