Commit ce446b4b authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal
Browse files

mtd: rawnand: Take check_only into account



->exec_op() is passed a check_only argument that encodes when the
controller should just check whether the operation is supported or not
without executing it. Some controllers simply ignore this arguments,
others don't but keep modifying some of the registers before returning.
Let's fix all those drivers.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200418194217.1016060-1-boris.brezillon@collabora.com
parent 4ba246d7
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2223,10 +2223,12 @@ static int cadence_nand_exec_op(struct nand_chip *chip,
				const struct nand_operation *op,
				bool check_only)
{
	if (!check_only) {
		int status = cadence_nand_select_target(chip);

		if (status)
			return status;
	}

	return nand_op_parser_exec_op(chip, &cadence_nand_op_parser, op,
				      check_only);
+3 −0
Original line number Diff line number Diff line
@@ -608,6 +608,9 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op,
	unsigned int op_id;
	int i;

	if (check_only)
		return 0;

	pr_debug("Executing operation [%d instructions]:\n", op->ninstrs);

	for (op_id = 0; op_id < op->ninstrs; op_id++) {
+3 −0
Original line number Diff line number Diff line
@@ -2408,6 +2408,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
	struct completion *completion;
	unsigned long to;

	if (check_only)
		return 0;

	this->ntransfers = 0;
	for (i = 0; i < GPMI_MAX_TRANSFERS; i++)
		this->transfers[i].direction = DMA_NONE;
+2 −1
Original line number Diff line number Diff line
@@ -2107,6 +2107,7 @@ static int marvell_nfc_exec_op(struct nand_chip *chip,
{
	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);

	if (!check_only)
		marvell_nfc_select_target(chip, op->cs);

	if (nfc->caps->is_nfcv2)
+3 −0
Original line number Diff line number Diff line
@@ -899,6 +899,9 @@ static int meson_nfc_exec_op(struct nand_chip *nand,
	u32 op_id, delay_idle, cmd;
	int i;

	if (check_only)
		return 0;

	meson_nfc_select_chip(nand, op->cs);
	for (op_id = 0; op_id < op->ninstrs; op_id++) {
		instr = &op->instrs[op_id];
Loading