Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1373135imm; Tue, 22 May 2018 03:04:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrdGPi1lTwDOgGD0p1XO9AZ86GopupHkocJjP7D7OwsL++CtNDfbyWvlU8sMLJHNIOQuRkr X-Received: by 2002:a17:902:4464:: with SMTP id k91-v6mr23616927pld.219.1526983469573; Tue, 22 May 2018 03:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526983469; cv=none; d=google.com; s=arc-20160816; b=m8Nrl2TmkQNkDtcZySGLrKBNm0EO5XeqK6ByTaQ7VMVNV6Mi+9fC1an5/wGoxSvWJf Fq6WvlKvIXPztiQ4yDB+LoJD02tD8RHRgh1d7GXS2kd7UPF3n66mYtwirulNsOu9l4yw gefvu5eCaZHVGzBd0nhzhKJMaTYFX+qN5Q1pm+lXwFKRhw1Chf/DXNiyWE16mbZYkRfV msqC7MQVOMrSetYIezmE5ZFM4GNCR3dR8M+WoiDGiC3kTXKa48ffEnxfQjna2FGtEF7M IrH3aZXiG+llUwd2W8rbwwsQK8X7mJS4PUtRDpM8puKZlUUBpAeRdpmqeHsnNaKPUpSL 5iBw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=Cnvuiv9Q/FjYkD6Hc2Kg4EOM/i281odnm6EoEYZtDAo=; b=CHPOO5cpQCl+YGyClHAn8lGGlZuc+EoePG9Rir7PbLy5zVqmX+orcA5bOOHsqsvRfO VL4MWJenJenZLWnfBOa77WtEFBt9wFI4Jh/dYZnf7ho4aA/347C+x5PztM1JrJYzloQV yPkhSjbRjZQpleja4pKzq7sw5dgeMYeROsLYBDqRBb5L5qxrZLcqoLtdZae+rf9c5wbf xd7HuX4ToLZ1ZBbFD+fqMGXQ1rLuPDDWhHw74/BF+WHjAEQ1UNO4LfAZzrrKXIvd9aYM X0Lm784ENL0BP5eZLNOn88z63mFhmQs7gCw3Sv40oFZXZg3lVHRu/z0mxYGoppo9kE+k SleA== 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 j194-v6si12376494pgc.92.2018.05.22.03.04.15; Tue, 22 May 2018 03:04: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 S1751447AbeEVKCt convert rfc822-to-8bit (ORCPT + 99 others); Tue, 22 May 2018 06:02:49 -0400 Received: from mail.bootlin.com ([62.4.15.54]:51201 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeEVKCo (ORCPT ); Tue, 22 May 2018 06:02:44 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id E9659207AC; Tue, 22 May 2018 12:02:41 +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 xps13 (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 8276720787; Tue, 22 May 2018 12:02:31 +0200 (CEST) Date: Tue, 22 May 2018 12:02:31 +0200 From: Miquel Raynal To: Abhishek Sahu Cc: Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andy Gross , Archit Taneja Subject: Re: [PATCH v2 09/14] mtd: rawnand: qcom: modify write_oob to remove read codeword part Message-ID: <20180522120231.5dd32f8b@xps13> In-Reply-To: <1525350041-22995-10-git-send-email-absahu@codeaurora.org> References: <1525350041-22995-1-git-send-email-absahu@codeaurora.org> <1525350041-22995-10-git-send-email-absahu@codeaurora.org> Organization: Bootlin 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=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Abhishek, Some nitpicking below. On Thu, 3 May 2018 17:50:36 +0530, Abhishek Sahu wrote: > QCOM NAND layout protect available OOB data bytes with ECC also so ^controller > when ecc->write_oob (qcom_nandc_write_oob) is being called then it You can just state "->write_oob()" > can't update just OOB bytes. Currently, it first reads the last > codeword which includes old OOB bytes. Then it updates the old OOB > bytes with new one and then again writes the codeword back. ones? > The reading codeword is unnecessary since all the other bytes > should be 0xff only. since the user is responsible to have these bytes cleared to 0xFF. > > This patch removes the read part and updates the oob bytes with s/oob/OOB/ > all other data bytes as 0xff. The end of the sentence is not clear for me. Do you mean that padding with 0xFF is realized before write? > > Signed-off-by: Abhishek Sahu > --- > * Changes from v1: > > NEW CHANGE > > drivers/mtd/nand/raw/qcom_nandc.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c > index 61d0e7d..f85d8ab 100644 > --- a/drivers/mtd/nand/raw/qcom_nandc.c > +++ b/drivers/mtd/nand/raw/qcom_nandc.c > @@ -2067,10 +2067,9 @@ static int qcom_nandc_write_page_raw(struct mtd_info *mtd, > * implements ecc->write_oob() > * > * the NAND controller cannot write only data or only oob within a codeword, s/oob/OOB/ Remove the trailing ',' > - * since ecc is calculated for the combined codeword. we first copy the > - * entire contents for the last codeword(data + oob), replace the old oob > - * with the new one in chip->oob_poi, and then write the entire codeword. > - * this read-copy-write operation results in a slight performance loss. > + * since ecc is calculated for the combined codeword. So make all the data s/ecc/ECC/ > + * bytes as 0xff and update the oob from chip->oob_poi, and then write > + * the entire codeword again. What about "Pad the data area with OxFF before writing."? > */ > static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, > int page) > @@ -2082,20 +2081,14 @@ static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, > int data_size, oob_size; > int ret; > > - host->use_ecc = true; > - > - clear_bam_transaction(nandc); > - ret = copy_last_cw(host, page); > - if (ret) > - return ret; > - > - clear_read_regs(nandc); > clear_bam_transaction(nandc); > > /* calculate the data and oob size for the last codeword/step */ > data_size = ecc->size - ((ecc->steps - 1) << 2); > oob_size = mtd->oobavail; > + host->use_ecc = true; You don't need to move this line here, do you? > > + memset(nandc->data_buffer, 0xff, host->cw_data); > /* override new oob content to last codeword */ > mtd_ooblayout_get_databytes(mtd, nandc->data_buffer + data_size, oob, > 0, mtd->oobavail); Once fixed, you can add my: Acked-by: Miquel Raynal Thanks, Miquèl