Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3660484imm; Fri, 20 Jul 2018 23:57:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcFB0cQiWRab/jO3ST3gCLujzIbvdcthN1CnvNaU9ZQ3SPS8aamjlZaJ7e/2wXsDgj0yEvE X-Received: by 2002:a63:555:: with SMTP id 82-v6mr4769669pgf.25.1532156249710; Fri, 20 Jul 2018 23:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532156249; cv=none; d=google.com; s=arc-20160816; b=TXObFz4W5cL6WhKn8eISHaStO/65rH+eiw1rf/LzV4e31eAfs1F9XMCzRhXccL3rsK unlhRMW1mlbDe4EN1URdESRB91nm6/d9//ZG4dHmZ/YJHpg6l56hh95FffWMqtHjhKp8 cBurVQO9h2JFX8dWT6EXpKL9qguZQZ5p3yjR1JxotXVOfX5DG7ammYkriPfi8EQkseeG p8i43Kge8pj3PPcHDydtc+in905cHVRVT7dE7FRBnbJEFbp29yGzXa1b32DBuIzXHtNc cK2c4PdgEijGa32ODDHjIO1UBXMtdTeOwJzLIqZEQYmLclxCB+EM/77ZgA5fXtBoc6Ds kxaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Sw7q+OwFePvBPFaF8nq3i1DCZGLl4MYW9lSxC5ZB5FU=; b=wfKh3AKu2mOZ7WxtOMQ1Jm3tBaKWd0c77Ufd8ykISLpgZHUD2NKPZBTlrpqw9a4Xsj JPnehwbco4PljWBWn1OP5B448H4NH+Wsm4y6r3UaAw0RPLxIP+Elopio2obM5mJmLeW+ rBeZiLUWmU0CeFBr9BoRQlgUpPv2YsjSiqCAOIoOWGr0eDr445ynjaZ2JBAm24Fh6T+U mN53R9lT3AicY/j8KHGJ4qpLHDimq9/G+vWt5NNp0VTdjuKULjNEG2t9P1bYoHcnaHz1 s7nYmy4R0YyGxbURvhVUGcYwUbqdNxCm32IWQfKQXgt6Se+e12oFcOhq3Z5bFS/Ql9hq s6yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si3500558pgk.449.2018.07.20.23.57.15; Fri, 20 Jul 2018 23:57:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727638AbeGUHr5 (ORCPT + 99 others); Sat, 21 Jul 2018 03:47:57 -0400 Received: from mail.bootlin.com ([62.4.15.54]:43026 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727284AbeGUHr5 (ORCPT ); Sat, 21 Jul 2018 03:47:57 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 2A859207B4; Sat, 21 Jul 2018 08:56:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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.0 Received: from bbrezillon (unknown [37.170.141.1]) by mail.bootlin.com (Postfix) with ESMTPSA id 3F1E22072F; Sat, 21 Jul 2018 08:56:15 +0200 (CEST) Date: Sat, 21 Jul 2018 08:56:14 +0200 From: Boris Brezillon To: Miquel Raynal Cc: Wenyou Yang , Josh Wu , Tudor Ambarus , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Nicolas Ferre , Alexandre Belloni , Kamal Dasu , Masahiro Yamada , Han Xu , Harvey Hunt , Vladimir Zapolskiy , Sylvain Lemieux , Xiaolei Li , Matthias Brugger , Maxime Ripard , Chen-Yu Tsai , Marc Gonzalez , Mans Rullgard , Stefan Agner , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-mediatek@lists.infradead.org Subject: Re: [PATCH v4 08/35] mtd: rawnand: gpmi: convert driver to nand_scan() Message-ID: <20180721085614.16ebca4d@bbrezillon> In-Reply-To: <20180720151527.16038-9-miquel.raynal@bootlin.com> References: <20180720151527.16038-1-miquel.raynal@bootlin.com> <20180720151527.16038-9-miquel.raynal@bootlin.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Jul 2018 17:15:00 +0200 Miquel Raynal wrote: > Two helpers have been added to the core to make ECC-related > configuration between the detection phase and the final NAND scan. Use > these hooks and convert the driver to just use nand_scan() instead of > both nand_scan_ident() and nand_scan_tail(). > > Signed-off-by: Miquel Raynal Reviewed-by: Boris Brezillon > --- > drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 56 ++++++++++++++++++------------ > 1 file changed, 33 insertions(+), 23 deletions(-) > > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c > index 6294d018df65..1c1ebbc82824 100644 > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c > @@ -744,9 +744,9 @@ static int gpmi_alloc_dma_buffer(struct gpmi_nand_data *this) > * [2] Allocate a read/write data buffer. > * The gpmi_alloc_dma_buffer can be called twice. > * We allocate a PAGE_SIZE length buffer if gpmi_alloc_dma_buffer > - * is called before the nand_scan_ident; and we allocate a buffer > - * of the real NAND page size when the gpmi_alloc_dma_buffer is > - * called after the nand_scan_ident. > + * is called before the NAND identification; and we allocate a > + * buffer of the real NAND page size when the gpmi_alloc_dma_buffer > + * is called after. > */ > this->data_buffer_dma = kzalloc(mtd->writesize ?: PAGE_SIZE, > GFP_DMA | GFP_KERNEL); > @@ -1865,6 +1865,34 @@ static int gpmi_init_last(struct gpmi_nand_data *this) > return 0; > } > > +static int gpmi_nand_attach_chip(struct nand_chip *chip) > +{ > + struct gpmi_nand_data *this = nand_get_controller_data(chip); > + int ret; > + > + if (chip->bbt_options & NAND_BBT_USE_FLASH) { > + chip->bbt_options |= NAND_BBT_NO_OOB; > + > + if (of_property_read_bool(this->dev->of_node, > + "fsl,no-blockmark-swap")) > + this->swap_block_mark = false; > + } > + dev_dbg(this->dev, "Blockmark swapping %sabled\n", > + this->swap_block_mark ? "en" : "dis"); > + > + ret = gpmi_init_last(this); > + if (ret) > + return ret; > + > + chip->options |= NAND_SKIP_BBTSCAN; > + > + return 0; > +} > + > +static const struct nand_controller_ops gpmi_nand_controller_ops = { > + .attach_chip = gpmi_nand_attach_chip, > +}; > + > static int gpmi_nand_init(struct gpmi_nand_data *this) > { > struct nand_chip *chip = &this->nand; > @@ -1905,26 +1933,8 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) > if (ret) > goto err_out; > > - ret = nand_scan_ident(mtd, GPMI_IS_MX6(this) ? 2 : 1, NULL); > - if (ret) > - goto err_out; > - > - if (chip->bbt_options & NAND_BBT_USE_FLASH) { > - chip->bbt_options |= NAND_BBT_NO_OOB; > - > - if (of_property_read_bool(this->dev->of_node, > - "fsl,no-blockmark-swap")) > - this->swap_block_mark = false; > - } > - dev_dbg(this->dev, "Blockmark swapping %sabled\n", > - this->swap_block_mark ? "en" : "dis"); > - > - ret = gpmi_init_last(this); > - if (ret) > - goto err_out; > - > - chip->options |= NAND_SKIP_BBTSCAN; > - ret = nand_scan_tail(mtd); > + chip->dummy_controller.ops = &gpmi_nand_controller_ops; > + ret = nand_scan(mtd, GPMI_IS_MX6(this) ? 2 : 1); > if (ret) > goto err_out; >