Commit 02b4a526 authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal

mtd: rawnand: Make ->select_chip() optional when ->exec_op() is implemented

Now that the CS to be selected on a nand_operation is passed in
nand_operation->cs we can make the ->select_chip() hook optional for
drivers implementing ->exec_op().

When not implemented, the core is assuming the CS line is automatically
asserted/deasserted by the driver ->exec_op() implementation.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Tested-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent ae2294b1
...@@ -247,6 +247,8 @@ void nand_select_target(struct nand_chip *chip, unsigned int cs) ...@@ -247,6 +247,8 @@ void nand_select_target(struct nand_chip *chip, unsigned int cs)
return; return;
chip->cur_cs = cs; chip->cur_cs = cs;
if (chip->select_chip)
chip->select_chip(chip, cs); chip->select_chip(chip, cs);
} }
EXPORT_SYMBOL_GPL(nand_select_target); EXPORT_SYMBOL_GPL(nand_select_target);
...@@ -260,7 +262,9 @@ EXPORT_SYMBOL_GPL(nand_select_target); ...@@ -260,7 +262,9 @@ EXPORT_SYMBOL_GPL(nand_select_target);
*/ */
void nand_deselect_target(struct nand_chip *chip) void nand_deselect_target(struct nand_chip *chip)
{ {
if (chip->select_chip)
chip->select_chip(chip, -1); chip->select_chip(chip, -1);
chip->cur_cs = -1; chip->cur_cs = -1;
} }
EXPORT_SYMBOL_GPL(nand_deselect_target); EXPORT_SYMBOL_GPL(nand_deselect_target);
...@@ -5021,11 +5025,6 @@ static int nand_scan_ident(struct nand_chip *chip, unsigned int maxchips, ...@@ -5021,11 +5025,6 @@ static int nand_scan_ident(struct nand_chip *chip, unsigned int maxchips,
if (!mtd->name && mtd->dev.parent) if (!mtd->name && mtd->dev.parent)
mtd->name = dev_name(mtd->dev.parent); mtd->name = dev_name(mtd->dev.parent);
if (chip->exec_op && !chip->select_chip) {
pr_err("->select_chip() is mandatory when implementing ->exec_op()\n");
return -EINVAL;
}
ret = nand_legacy_check_hooks(chip); ret = nand_legacy_check_hooks(chip);
if (ret) if (ret)
return ret; return ret;
......
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