Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp515529imm; Wed, 20 Jun 2018 02:03:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK/ypaSlirkVr8KOcs/1pn5TnA21a7+sjUWz7mbYGjTRPtsr7hfIe/91YMtFlfmCtCQN1d6 X-Received: by 2002:a17:902:1005:: with SMTP id b5-v6mr5459700pla.207.1529485415116; Wed, 20 Jun 2018 02:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529485415; cv=none; d=google.com; s=arc-20160816; b=PVheN+GpmckHsedtl7HVIugxP9s9kXFj7k5bBndlozXVEA1kWV6ds6KAPilOhZN/Mr NzTw0j/B8FsQirO9zGiZ2gAqYI9QyaFEK67npv6lUYmiVhRTMvSEKWb379ye1/uDtKta f1LEMiSKNQhIZ/YZwEbu6+280ZRzqMSFej7gx8EzeSgNroEOqz3CNQQmBS4fy8wBTHua u/5PgUK0BBhn+xZMz/fsQW9DwwwBVSHDul60O/Ovzeacp0GgMaV8i//P4tVDh9CpqIxL m+stFHLHaJlZSIHM5Z4bASrxGhG9BjLxA6iRxzhAsnIcxSXLllGR0SQHXqymzp76vPeL UKaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=OObAHLqSVhzr8zOrpVxZygp3MIJZ82qb8F0SuLcf/Hc=; b=LGEW2fWNn9TfRHCJfzS+dQm0eG58tNeB2lyY5Y/u8VlwqoT51JiVXJAw3AhvQaYz5F wC29zePQZLAxQfro/X5qfTvXAtIGQIVDV9BrPIFcKkA9cAGLY8pSVq/aNEuJOOATeeXx EpPNJSe7RHHmxh8Lhj5GNcdb1TTX6cJ559TpODeKI/UNqV0E0AO1B93QIpEUSA6ZlnHx LUy3ZKbyJWFGdKjqFIfFiNwwDkljFokpKHLNVO7EOC3Z0w+oVc6Wr+pjKjBdMS6t7f0+ TCNhW1XfD+WLhFJ1OYrmTftxtzMZSQ7mQm1C7ZLgm+60svYIzhMLNfEY7JEIcudlyxAv BV0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="F2WoM/dv"; dkim=pass header.i=@codeaurora.org header.s=default header.b=QUn50H0S; 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 d37-v6si1988403pla.85.2018.06.20.02.03.21; Wed, 20 Jun 2018 02:03:35 -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="F2WoM/dv"; dkim=pass header.i=@codeaurora.org header.s=default header.b=QUn50H0S; 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 S932879AbeFTI5a (ORCPT + 99 others); Wed, 20 Jun 2018 04:57:30 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49612 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753709AbeFTIpD (ORCPT ); Wed, 20 Jun 2018 04:45:03 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 99A6C60B83; Wed, 20 Jun 2018 07:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529479713; bh=f1ZuNS+AL96dc3Yu0tDYkuTUIUz22p8bk9WRXfBFcuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2WoM/dvacd2auHolS9xWvEMsq+9IzwLYhtx6NpoVdTZcXC96okyFw3OAfiVVi6DA IZKh1vPkMKTo2jfsX4wEQyBQ8wmAMZc8eA45IfbwJQnZnk+xPomKyJvi/1Gokmlc78 r/EVqkgG4M1r++H9bFLHGFTXfjtZlMeeSfLeNVq4= 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 absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 618EB60B15; Wed, 20 Jun 2018 07:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529479712; bh=f1ZuNS+AL96dc3Yu0tDYkuTUIUz22p8bk9WRXfBFcuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUn50H0S/VR8kpaRhthubXYIdqb0hzhbWiBlYnOooQVBCL2HBIVXkJQ+GRgegjLUy OTDbYOu3aj2Dv/gpYyJPbbdG82X+3nl3EFW5Hs2/7GxyO8kUq2XDKkaep58NYLrFnz w+UnTsWY1L4Zj4S94B6m+lYFK3jVyspY7jHt7vCA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 618EB60B15 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Boris Brezillon , Miquel Raynal Cc: 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 , Abhishek Sahu Subject: [PATCH v4 10/15] mtd: rawnand: qcom: modify write_oob to remove read codeword part Date: Wed, 20 Jun 2018 12:57:37 +0530 Message-Id: <1529479662-4026-11-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1529479662-4026-1-git-send-email-absahu@codeaurora.org> References: <1529479662-4026-1-git-send-email-absahu@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org QCOM NAND controller layout protects available OOB data bytes with ECC also so when ecc->write_oob() is being called then it 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 ones and then again writes the codeword back. The reading codeword is unnecessary since user is responsible to have these bytes cleared to 0xFF. This patch removes the read part and updates the OOB bytes with data area padded with OxFF. Acked-by: Miquel Raynal Signed-off-by: Abhishek Sahu --- * Changes from v3: NONE * Changes from v2: 1. Changed commit message and comments slightly 2. Changed host->use_ecc assignment place * Changes from v1: NEW CHANGE drivers/mtd/nand/raw/qcom_nandc.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index 285b2ad3..28361b5 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -2064,11 +2064,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, - * 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. + * the NAND controller cannot write only data or only OOB within a codeword + * since ECC is calculated for the combined codeword. So update the OOB from + * chip->oob_poi, and pad the data area with OxFF before writing. */ static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) @@ -2081,19 +2079,13 @@ static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, 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; + 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); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation