From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.bootlin.com ([62.4.15.54]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gK2yM-00075S-85 for linux-mtd@lists.infradead.org; Tue, 06 Nov 2018 15:08:59 +0000 From: Boris Brezillon To: Boris Brezillon , Richard Weinberger , Miquel Raynal , linux-mtd@lists.infradead.org Cc: David Woodhouse , Brian Norris , Marek Vasut , Han Xu , Masahiro Yamada , Tudor Ambarus , Harvey Hunt , Xiaolei Li , Maxim Levitsky , Marc Gonzalez , Stefan Agner , Janusz Krzysztofik Subject: [PATCH v2 19/22] mtd: rawnand: ams-delta: Stop implementing ->select_chip() Date: Tue, 6 Nov 2018 16:08:07 +0100 Message-Id: <20181106150810.9569-20-boris.brezillon@bootlin.com> In-Reply-To: <20181106150810.9569-1-boris.brezillon@bootlin.com> References: <20181106150810.9569-1-boris.brezillon@bootlin.com> List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- Changes in v2: - New patch --- drivers/mtd/nand/raw/ams-delta.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 723318e25691..1c4aa0380599 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -114,14 +114,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, @@ -134,6 +129,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: @@ -172,6 +169,8 @@ static int ams_delta_exec_op(struct nand_chip *this, break; } + ams_delta_ctrl_cs(priv, 0); + return ret; } @@ -215,7 +214,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); -- 2.17.1