Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp301629pxb; Thu, 26 Aug 2021 03:35:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ2eLRtkRYMcyDZHpFqVQfxSpWrzGfpDca1KUgUNLrmBfNGLnNuzEn4MYHLwNqa5ozjMVN X-Received: by 2002:aa7:dd48:: with SMTP id o8mr3459066edw.44.1629974156392; Thu, 26 Aug 2021 03:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629974156; cv=none; d=google.com; s=arc-20160816; b=BEYKbuA4+uNKDgW98dPqIp3kFu3Dco5wX0dhcqXSY3b9z1abSlLGAm3QOgoU8FG3uR IcNQsIkNEb4vTtC5823PivcrG35HVOR50hrmi+CW3oSURgqFpw85rIahE2x7IaIgfti1 CrKgk6wTcEEiwOpJFfgKPU/ngurq+0aNXEH1ns1+H+f9I2ci6uz0FmykU8x7a4gBAb+/ 4jeyApuE/ug8+YiZ9MGVUqjSMEX8qAQeynilSTtK0xRxr555xlGnXUI2JvxB0K+RXoOx FnUrtRuFX2BKQdFyYKF2uPZFHWH6XAqfXFgVmhHhA5aPKbXnl5YLxwDawdXPuhPmv/YU +78w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=YXGr5TYLMGwu7BWrJKg2Ai2X0xqG94vZR8jiG3gjAgc=; b=CMfKnx+L/gJze+Ze6k2M4sQWbEtvF34NpRtIP8Brm/HJno/ag1ljs8tuynoRU5XsA9 FDjjuzs+CWJFY2yMNhOfNVp0A6FeyGrCqSQxm9QQoQM8sNKBYa5/om5sfLAe3S48guc7 aN8JZreb1MDasUNyLDhztbRK1gOn4x7tPen4Pek+sVq14DqAhgt4gn6Igj+45kB9iKfS 2ul5ub9T7nFDjbJkq/3dM8TB2l6vJoLqae3oFhNimnjczVBrYz8nSSd99xSI1QBU0uyz OnxsuaEt38MYcAqpruCCUUKelao/c+FXU1SCKIA2PQLJ2VVP8UtNfrxKNHTOAgDTJy0p zt6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si2938394edz.49.2021.08.26.03.35.33; Thu, 26 Aug 2021 03:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241425AbhHZKcX (ORCPT + 99 others); Thu, 26 Aug 2021 06:32:23 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:63991 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241180AbhHZKcQ (ORCPT ); Thu, 26 Aug 2021 06:32:16 -0400 Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 26 Aug 2021 03:31:28 -0700 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 26 Aug 2021 03:31:27 -0700 X-QCInternal: smtphost Received: from mdalam-linux.qualcomm.com ([10.201.2.71]) by ironmsg01-blr.qualcomm.com with ESMTP; 26 Aug 2021 16:01:10 +0530 Received: by mdalam-linux.qualcomm.com (Postfix, from userid 466583) id 5155B22319; Thu, 26 Aug 2021 16:01:09 +0530 (IST) From: Md Sadre Alam To: miquel.raynal@bootlin.com, mani@kernel.org, boris.brezillon@collabora.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mdalam@codeaurora.org, sricharan@codeaurora.org Subject: [PATCH] mtd: rawnand: qcom: Update code word value for raw read Date: Thu, 26 Aug 2021 16:01:02 +0530 Message-Id: <1629973862-7248-1-git-send-email-mdalam@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From QPIC V2 onwards there is a separate register to read last code word "QPIC_NAND_READ_LOCATION_LAST_CW_n". qcom_nandc_read_cw_raw() is used to read only one code word at a time. If we will configure number of code words to 1 in in QPIC_NAND_DEV0_CFG0 register then QPIC controller thinks its reading the last code word, since from QPIC V2 onwards we are having separate register to read the last code word, we have to configure "QPIC_NAND_READ_LOCATION_LAST_CW_n" register to fetch data from controller buffer to system memory. Signed-off-by: Md Sadre Alam --- drivers/mtd/nand/raw/qcom_nandc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index ef0bade..04e6f7b 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -1676,13 +1676,17 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, struct nand_ecc_ctrl *ecc = &chip->ecc; int data_size1, data_size2, oob_size1, oob_size2; int ret, reg_off = FLASH_BUF_ACC, read_loc = 0; + int raw_cw = cw; nand_read_page_op(chip, page, 0, NULL, 0); host->use_ecc = false; + if (nandc->props->qpic_v2) + raw_cw = ecc->steps - 1; + clear_bam_transaction(nandc); set_address(host, host->cw_size * cw, page); - update_rw_regs(host, 1, true, cw); + update_rw_regs(host, 1, true, raw_cw); config_nand_page_read(chip); data_size1 = mtd->writesize - host->cw_size * (ecc->steps - 1); @@ -1711,7 +1715,7 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, nandc_set_read_loc(chip, cw, 3, read_loc, oob_size2, 1); } - config_nand_cw_read(chip, false, cw); + config_nand_cw_read(chip, false, raw_cw); read_data_dma(nandc, reg_off, data_buf, data_size1, 0); reg_off += data_size1; -- 2.7.4