Received: by 10.192.165.148 with SMTP id m20csp1778885imm; Thu, 3 May 2018 05:23:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZouGEhd4rwqXF21Zjo8IEJrNUgsE/3DDRNQOG4xCMV2HNnNBjDyxyj3hvOrpYnn7LMHMGQL X-Received: by 2002:a65:4c06:: with SMTP id u6-v6mr18731884pgq.388.1525350239825; Thu, 03 May 2018 05:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525350239; cv=none; d=google.com; s=arc-20160816; b=xWWyC5cos2ecF7nJ33hvHr1c1/V+y9h4L0FgUeNbN7zQGCQqkAp9QzxdKElUe9T4A4 8KcB6OyKwtaUfMTCJUbv6v270Y7zE2H6z+XQ3U9CnoQp5qTvHMEjbD2htNMDrqfp+UDa yWJLeLoiAupweNdn+kLCxGt/4pXf56OwpCOS+31tspIeOx8/Poc+XnWSKY096qJZaVNR QEuxBPxwLwAtMecHpAeEOtkMcl3I7aSmsqLTDv4KDd5yggxXS1lU07m5RYTf1ipBr9NS aRZ407maghD7jXFqLaJyq1pIpdWGajU9S1LZ2G2UtP72Syl7EzK8j3hdgwj3lObqQav2 p+fA== 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=Ug5noIMbcDeIygbGSwclq8xtIwYzGLEfpPyqv2v2SfA=; b=uwAsgUDnR+X+NsqfwunRhn/w1YJtjWXwpP7rBftMOtvIn3lua+3RioLuz/cJIzFPqB Q5sqE86BS+r7mZ+DFkk5Zbu1uuLYww6VNJVCCxuBGljYZciCsEBIgbflhtuOdak/ipAg PJcCQAxol+y8L/cePTwK7rIaOvPAIVeTnl+NV7PCHKfkhhPNxvBPL30vzAXph+xDg4m4 mmo7b67XnYiidW3Hhw1IEB/gLZbhwDGUeKI7XEVYu5XOK/1TegOIBgR0LV/DmJIjQYKr MlsxWc0PvXDef5BcQGt3RMn8lXqToOdpEl0SzquBmYbBaqdQjAUbUKfx/hskgn/0ql39 Xzzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=beEwrY/5; dkim=pass header.i=@codeaurora.org header.s=default header.b=PxwzvLrV; 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 b97-v6si14200490plb.135.2018.05.03.05.23.45; Thu, 03 May 2018 05:23:59 -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=beEwrY/5; dkim=pass header.i=@codeaurora.org header.s=default header.b=PxwzvLrV; 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 S1752000AbeECMVk (ORCPT + 99 others); Thu, 3 May 2018 08:21:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42436 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154AbeECMVg (ORCPT ); Thu, 3 May 2018 08:21:36 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9677760AF9; Thu, 3 May 2018 12:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525350095; bh=1i13Ydf2+EnlWK/NOgofMJYzgzrk/ymUqAu5PrAV1Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=beEwrY/58+Yj38DWOYvsxoK5hSUjupb0cVBf8ZIGov68cuRZl2iEfXRheNlMjAWue hqZe10BSO6ADdvzsOIdp9vQ+bF+xrXmkU067K/qpXC2sPaqGJfni7wR7q9+swqrhJT mX4Guia1oFAxFFn/UfNq8KtOsL/wSpiAb04yDfL4= 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 F377160591; Thu, 3 May 2018 12:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525350094; bh=1i13Ydf2+EnlWK/NOgofMJYzgzrk/ymUqAu5PrAV1Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PxwzvLrVvR/3MmLUu7fqeE1sP5RbHiloXABtgqytHr5EwXvRZAxrZJUSOL5uhBxUT Onyt/Hix6NWlXuND8dn/lQUcf2f5TGrqCJnYEdLP2xaGjCsqgUqJqrnNBl1d7VECYy f1DIwvq7L1PQ1MLSjut2LYLG4ZR0vNZTk9R0hGfc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F377160591 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 Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Miquel Raynal , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andy Gross , Archit Taneja , Abhishek Sahu Subject: [PATCH v2 09/14] mtd: rawnand: qcom: modify write_oob to remove read codeword part Date: Thu, 3 May 2018 17:50:36 +0530 Message-Id: <1525350041-22995-10-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525350041-22995-1-git-send-email-absahu@codeaurora.org> References: <1525350041-22995-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 layout protect available OOB data bytes with ECC also so when ecc->write_oob (qcom_nandc_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 one and then again writes the codeword back. The reading codeword is unnecessary since all the other bytes should be 0xff only. This patch removes the read part and updates the oob bytes with all other data bytes as 0xff. 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, - * 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 + * bytes as 0xff and update the oob from chip->oob_poi, and then write + * the entire codeword again. */ 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; + 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