summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/ams-delta.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-11-11 08:55:21 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2018-12-07 10:38:26 +0100
commit1770022ffa85e1cdba88e311493cc16d52340a59 (patch)
treeaa7cc6b99fdccc670f6c1cc696dc806847fd974d /drivers/mtd/nand/raw/ams-delta.c
parentmtd: rawnand: vf610: Stop implementing ->select_chip() (diff)
downloadlinux-1770022ffa85e1cdba88e311493cc16d52340a59.tar.xz
linux-1770022ffa85e1cdba88e311493cc16d52340a59.zip
mtd: rawnand: ams-delta: Stop implementing ->select_chip()
Now that the CS to be selected is passed in nand_operation->cs, we can get rid of the ->select_chip() implementation and replace it by an internal function which is called from the chip->exec_op() hook. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Tested-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/ams-delta.c')
-rw-r--r--drivers/mtd/nand/raw/ams-delta.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c
index 34b83edb965c..611c822e967f 100644
--- a/drivers/mtd/nand/raw/ams-delta.c
+++ b/drivers/mtd/nand/raw/ams-delta.c
@@ -116,14 +116,9 @@ static void ams_delta_read_buf(struct ams_delta_nand *priv, u8 *buf, int len)
buf[i] = ams_delta_io_read(priv);
}
-static void ams_delta_select_chip(struct nand_chip *this, int n)
+static void ams_delta_ctrl_cs(struct ams_delta_nand *priv, bool assert)
{
- struct ams_delta_nand *priv = nand_get_controller_data(this);
-
- if (n > 0)
- return;
-
- gpiod_set_value(priv->gpiod_nce, n < 0);
+ gpiod_set_value(priv->gpiod_nce, assert ? 0 : 1);
}
static int ams_delta_exec_op(struct nand_chip *this,
@@ -136,6 +131,8 @@ static int ams_delta_exec_op(struct nand_chip *this,
if (check_only)
return 0;
+ ams_delta_ctrl_cs(priv, 1);
+
for (instr = op->instrs; instr < op->instrs + op->ninstrs; instr++) {
switch (instr->type) {
case NAND_OP_CMD_INSTR:
@@ -174,6 +171,8 @@ static int ams_delta_exec_op(struct nand_chip *this,
break;
}
+ ams_delta_ctrl_cs(priv, 0);
+
return ret;
}
@@ -217,7 +216,6 @@ static int ams_delta_init(struct platform_device *pdev)
priv->io_base = io_base;
nand_set_controller_data(this, priv);
- this->select_chip = ams_delta_select_chip;
this->exec_op = ams_delta_exec_op;
priv->gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", GPIOD_IN);