From patchwork Fri May 25 12:21:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Sahu X-Patchwork-Id: 920472 X-Patchwork-Delegate: miquel.raynal@bootlin.com 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=codeaurora.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r1ZBL2cA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ZST5DR1m"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="XPngHHxd"; dkim=neutral (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="PDVYsNAD"; 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 40slpG6YLDz9s15 for ; Fri, 25 May 2018 22:25:42 +1000 (AEST) 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=wOCpSc3u+xxhH0GnM7hohUknecLSVAzjimtPe9CDOfw=; b=r1ZBL2cA5+/gs5HbKG6kd/LopH KTdVpETIbDmqqWCGCNp2K7vnKa6vD9ljv/76HVvgveWNbKXXi8w7T/WPmenIwRsc11KiXJjFUHElf gG8x54RQHzbMriPSPIScJ8wEgTw7xoOSmOK3j4Dqap6gYKC7TJSiWZz3ZMgamrg5Pgq0GUvxkv9zJ SXMGrVLWzG4aZD3nyVrcKq5AoPp5+SUFQF8DnwhT/kaTrHLh+dAcuUxbAEeMP2FpNKOVO61El09tJ FPbZGWkk0mu16L5SbsEpgK6ZozyNkFlJCLRMbjUVF6YCoeTVLkDTQdaCzw5o+L9ryN7/JEbxSK783 wdYLfOmw==; 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 1fMBmo-0000Nx-Av; Fri, 25 May 2018 12:25:34 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMBkO-0006IR-VN for linux-mtd@bombadil.infradead.org; Fri, 25 May 2018 12:23:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=oThEpFzrylpdxZ5ciI0io1UOjNECzaEiloNt0MNbiMk=; b=ZST5DR1meqBuJo3juLyqeOHEl f5bWDzWvdwk39Qtu9FcQl3gViYC4kX9r76WR1Ahkvqnm6/g6OG8P5t/UCEiZIfOU92Hjn6IYQ2mcJ /NAK2tlz9rijN8SMDzWwZ3REo/J0lDixWJ/McjB5tn/YGMbdZvqQuSb7cR1ILN/2ZlxX/4e84eoIE v9zmUc8JDf1+AspSe/57TF9wprH6Vlxcm+7PHG+aTliPDrg1oLT6VCrOEhBiYwmPVdsI8JGpX04+y gjqjkNBo3kLybqbtzy7y56Yl0bv1Y938tS0Q01F7KVlFeH2rGbcBONTo5G5ok/ljx8DljHO73z+Ya jHX0RbjrA==; Received: from smtp.codeaurora.org ([198.145.29.96]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMBkL-0001l9-KX for linux-mtd@lists.infradead.org; Fri, 25 May 2018 12:23:02 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 864AD60F6E; Fri, 25 May 2018 12:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527250968; bh=AQaLiluGOeAem4orI7TxJlvr0ITX/cgzvbn2a1Kuw20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPngHHxdc1S6kucPLLuxSnDErGggZOnkkoWRguHzI/BIvEMDS9f835wVMfcKJHeNS VSxWwXQIq7GsfQxkF6PyMjm21+9YZ7fBeSTIh1ht8TmnvdkL8JZ06CnNQ/rYAlPVhw Vcf0aIqpDhUDHaxp8/wczU/vWsl4dYbJICT9XbXM= 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 9F85560117; Fri, 25 May 2018 12:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527250967; bh=AQaLiluGOeAem4orI7TxJlvr0ITX/cgzvbn2a1Kuw20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDVYsNADWYDPqtM4i0pAF/e3uzazh3FyvXs79NoptrJcTMJCJdVfgT8XXABOzJxgc 8sZr8aJAngo/4294VqInH9wk8Mg6dbK+yInoPZvDNLeo1ASrcd1JwnDlRa4OhDTLHO ldDtGwIJ9uy8exLLAQOJ0TDdzXW3yafpx0jJ/dZE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9F85560117 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 Subject: [PATCH v3 11/16] mtd: rawnand: qcom: modify write_oob to remove read codeword part Date: Fri, 25 May 2018 17:51:39 +0530 Message-Id: <1527250904-21988-12-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527250904-21988-1-git-send-email-absahu@codeaurora.org> References: <1527250904-21988-1-git-send-email-absahu@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180525_082301_802037_C07628B8 X-CRM114-Status: GOOD ( 17.64 ) X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [198.145.29.96 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: Archit Taneja , Richard Weinberger , linux-arm-msm@vger.kernel.org, Miquel Raynal , linux-kernel@vger.kernel.org, Marek Vasut , Abhishek Sahu , linux-mtd@lists.infradead.org, Cyrille Pitchen , Andy Gross , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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 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 e4b87b7..e02d752 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);