Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1646113imm; Tue, 22 May 2018 07:16:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr2DFVGSO7OdUA/4/jwBNEEqV9HXQuDo9YM0Zsky+OqdX+xJ010Zwu2uVheiyZZE85KgdRV X-Received: by 2002:a65:65d2:: with SMTP id y18-v6mr18738188pgv.186.1526998591983; Tue, 22 May 2018 07:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998591; cv=none; d=google.com; s=arc-20160816; b=RO47Zf6xP7uj0rXjQGXYZLH23XsMMdewbdrYuYz3UhnmVhdxypvizIN6aRoCYF1s8f 3DBbONW0MPD1rVWJltFn5yQPTTvMChgu/XMqZAhqG6EQ/RjW1HiG5Mz1mHpLXDjtzFf4 8b9JyOQ5KPnMjoVk8sOQBGgTe/lBMtTfvvJhyLiz9zm7NWKU+0gQps7o7eBAGQ4FvIJE paT7iPp1EUkdC/ZbC9VsF+P9H8ym/iU8lqTjoyxR9By0ymgceSrYDrIiLbwpJAaSzuYa K6kaEQAvNXphMcLKBATGEtrMAD6ruquKggM0R0H0D7mQiaPIHv+FP1s54EeYmC+2iE9G ApjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=9mWto2E6eUYEm8l3cQUp3A2UVdHV5ThdxIYZJPd6d2Y=; b=XoAAOuVF47ez8F5s6GSNpr7bMXFPHDp1R+wEj159InnY3QfmEmKkPHi37WuMfvWhS8 57CRKCLzazkpIIF6g2C4V6ranV/hFfRf/LKs2N+JKLkLZ0bG+UhDjQdADZloik39gMGT zeI9lrJwDjaKzRiovRTC5rC3PiKGjFl1RRoMmoq6lSKr6eZTQXLg0fFRgVVP1h5ofNGe YxLN8acaLXyUI90qI/jiqsmOedUNift27ynpNw1494Q/6Jh6b+CcHo5ShjiNeI1vsE8U vTAnc35R4X/6gqH/t++8sG9mpNhnGxduhuIKURZxo1CKc7XqXWLC4kxSldPg8TGLhgeH 0xPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=VZZViILW; dkim=pass header.i=@codeaurora.org header.s=default header.b=OxXrvZQx; 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 f4-v6si10144743pgc.551.2018.05.22.07.16.17; Tue, 22 May 2018 07:16:31 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=VZZViILW; dkim=pass header.i=@codeaurora.org header.s=default header.b=OxXrvZQx; 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 S1751421AbeEVOO5 (ORCPT + 99 others); Tue, 22 May 2018 10:14:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48270 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214AbeEVOOz (ORCPT ); Tue, 22 May 2018 10:14:55 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5403C60314; Tue, 22 May 2018 14:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526998495; bh=pwPZXtmLnKa2Tg8QWuyi8lmLcE5PTmG1JhsQ4TNPf/o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VZZViILWcTOHsI/JVCsOBfGx+xRW62k+rpUSzNVzG8If+w6UPOc2l0uGDp0xR5gjY S8JKFWvkPtATQUij7MvBs9HvhKVwYPOVFpU7zCwOiWq05zGAUeg9eg9h6JRM8TSsQp aQrIABX6Dw8NTyBh3lo5KIOpULFhB96b1ehDU+2w= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 180F060314; Tue, 22 May 2018 14:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526998494; bh=pwPZXtmLnKa2Tg8QWuyi8lmLcE5PTmG1JhsQ4TNPf/o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OxXrvZQxYQ01A7gw5si3/YSUFthha1BOcyNWfu3KQJdgTBxqdr/IIr9ZISahikYmc zRpfMOyT67FO9dwUTRLO85DUl8KMUDM7j0pgCGOGA4+ZGNFQ5bCoeVtRClOKkl8U5U ekP7ygcpkI6vYFo13zHZysRyvPmUWEzigVWdstq4= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 22 May 2018 19:44:54 +0530 From: Abhishek Sahu To: Miquel Raynal 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 In-Reply-To: <20180522120231.5dd32f8b@xps13> References: <1525350041-22995-1-git-send-email-absahu@codeaurora.org> <1525350041-22995-10-git-send-email-absahu@codeaurora.org> <20180522120231.5dd32f8b@xps13> Message-ID: X-Sender: absahu@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-22 15:32, Miquel Raynal wrote: > 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: Thanks Miquel. I will fix all these and update the patch. Regards, Abhishek > > Acked-by: Miquel Raynal > > Thanks, > Miquèl