From patchwork Sun Nov 11 07:55:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 996078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nU97Mgft"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="aWsKMJlp"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42t5s25DF9z9s5c for ; Sun, 11 Nov 2018 18:59:50 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=aIhiXJRLHO2RyYsXzeH5i7NIEuA/+VZ9335dsphSruw=; b=nU97MgftLiKUdx5/jDEnIBoeF6 llScMTRxrQYmTG7o63/gwdIwqM/FucKrLliYacd8zmxtjZ/MaxGI7BDB+tVQ3bx7sQdb+g8qy93ik xL+GouybVOzACOYiSS6T7ShUZOdYNEhsICz9oqRdfhnQPTVToCG+OImjyJpOVRPV65kOz4u13SIIk MBGrrOvMP7aOtA9QdbRhbOcczyegg+iKq+C0hgvPI8+Ihl5ik8wc9lM1UXjZm95+nehMF/XUB028U tBlhDX2Yyzh8DkqIqiJ6WDmeFzVAgGFzh5dn16IP0RQPTiD8n2BzsVOomd5092+kQ1esay/e8SFX6 j4nHV70Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLkej-0001os-Ua; Sun, 11 Nov 2018 07:59:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLkb8-0006b7-05 for linux-mtd@bombadil.infradead.org; Sun, 11 Nov 2018 07:55:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GxR1XWMvw4gXcQKYmPovKNEEMwQUtYOFCfWDJZXS2tI=; b=aWsKMJlpefQcAqv+y3ZnoPoA4 sou5cGEFjaW7vnHSaEb3PPmyNuCZEWodfKusQ8giTfLjyzBCPjCOgh+3iMAYxPWyjpNJL9yI3FL/1 ZCWDK4mdIBoI2O+Z1JhMvln4/uWAVjTfXXwKLxKbrMrCLbsnzikm1sL36GYvDQmoScumATBGUG9By gdQsZ7o+GSzZoUZJugFZgGJq0OlJe64w6FypgYVY1JPG7QYp+/B539yEkaqpoBUEu+k1YWWaCjg/a FxrlH3z8DdV8b3uAVMFc00ub6PPALOpMA7GsdOvrcveKFWbu8F4E/FJdJt+X1xwnLUz8Lve9Ls7nP o0rMxqoPg==; Received: from mail.bootlin.com ([62.4.15.54]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLkb1-0000QQ-Kv for linux-mtd@lists.infradead.org; Sun, 11 Nov 2018 07:55:56 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id C607C224F8; Sun, 11 Nov 2018 08:55:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost.localdomain (unknown [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 5A132224CD; Sun, 11 Nov 2018 08:55:33 +0100 (CET) From: Boris Brezillon To: Boris Brezillon , Richard Weinberger , Miquel Raynal , linux-mtd@lists.infradead.org Subject: [PATCH v3 17/22] mtd: rawnand: tegra: Stop implementing ->select_chip() Date: Sun, 11 Nov 2018 08:55:19 +0100 Message-Id: <20181111075524.13123-18-boris.brezillon@bootlin.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181111075524.13123-1-boris.brezillon@bootlin.com> References: <20181111075524.13123-1-boris.brezillon@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181111_075551_897902_4828B9FE X-CRM114-Status: GOOD ( 16.39 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxim Levitsky , Marek Vasut , Tudor Ambarus , Janusz Krzysztofik , Stefan Agner , Masahiro Yamada , Harvey Hunt , Marc Gonzalez , Han Xu , Xiaolei Li , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Now that the CS to be selected is kept in chip->cur_cs and 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() and chip->ecc.read/write_xxx() hooks. Signed-off-by: Boris Brezillon --- Changes in v3: - None Changes in v2: - None --- drivers/mtd/nand/raw/tegra_nand.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index 9767e29d74e2..590393d93ffc 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -454,29 +454,24 @@ static const struct nand_op_parser tegra_nand_op_parser = NAND_OP_PARSER( NAND_OP_PARSER_PAT_DATA_IN_ELEM(true, 4)), ); +static void tegra_nand_select_target(struct nand_chip *chip, + unsigned int die_nr) +{ + struct tegra_nand_chip *nand = to_tegra_chip(chip); + struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller); + + ctrl->cur_cs = nand->cs[die_nr]; +} + static int tegra_nand_exec_op(struct nand_chip *chip, const struct nand_operation *op, bool check_only) { + tegra_nand_select_target(chip, op->cs); return nand_op_parser_exec_op(chip, &tegra_nand_op_parser, op, check_only); } -static void tegra_nand_select_chip(struct nand_chip *chip, int die_nr) -{ - struct tegra_nand_chip *nand = to_tegra_chip(chip); - struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller); - - WARN_ON(die_nr >= (int)ARRAY_SIZE(nand->cs)); - - if (die_nr < 0 || die_nr > 0) { - ctrl->cur_cs = -1; - return; - } - - ctrl->cur_cs = nand->cs[die_nr]; -} - static void tegra_nand_hw_ecc(struct tegra_nand_controller *ctrl, struct nand_chip *chip, bool enable) { @@ -503,6 +498,8 @@ static int tegra_nand_page_xfer(struct mtd_info *mtd, struct nand_chip *chip, u32 addr1, cmd, dma_ctrl; int ret; + tegra_nand_select_target(chip, chip->cur_cs); + if (read) { writel_relaxed(NAND_CMD_READ0, ctrl->regs + CMD_REG1); writel_relaxed(NAND_CMD_READSTART, ctrl->regs + CMD_REG2); @@ -1116,7 +1113,6 @@ static int tegra_nand_chips_init(struct device *dev, chip->options = NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER; chip->exec_op = tegra_nand_exec_op; - chip->select_chip = tegra_nand_select_chip; chip->setup_data_interface = tegra_nand_setup_data_interface; ret = nand_scan(chip, 1);