Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5035119pxb; Tue, 28 Sep 2021 09:14:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyystj2qASQVgcg6UlP5xgrivGIqJMN7GdcAQNeQCQOoelCtS/gIO5XwFVviL/q3XCW8q55 X-Received: by 2002:a17:902:6b0b:b0:13a:18bf:1ece with SMTP id o11-20020a1709026b0b00b0013a18bf1ecemr5352909plk.49.1632845678165; Tue, 28 Sep 2021 09:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632845678; cv=none; d=google.com; s=arc-20160816; b=VYiF7IBiuHRLVjMgBp18QqYrNXycffd0vBo7XsMFDPDFQPgFsoCazL+l7YdTocJc3n bse7JIk5nT8WwfaxpuzZZWMDMkpGyoqiPhyrvMNLMf87k3Pxvelg/MJNPE75dmshsbLX hlEwTWazo1a+f4vxcKwfWAnRV9/lU8W3TZjWOpZNkLJLsrE7fVDrXFD1pbJ9IJGQiZUS 4qlXtoQ6zgiYZoJ0Jy0r1OJlo5Nm2bJ1gqhLPWzbWqeZtsJ5rENELHJ7RLUwT11UPj1p 0PRoAPlvlQxtnQ9JwyVFE9MylsKajY1+vp3AeWjeuYrpzgJQII8y/EyP7fWyURlVi0ne Iv/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k6Vcwg8FBC+6UXBw4s5KjrCcLNS9faU7U6dzXCbaZt0=; b=r2OeA13GAgf63JU3Nm0AXal0rPsJBOus9eM4hRFwctdBofH3qYLt5PG+4ffxRjNzbs 1F9P6fgUe7084McbnXC5msenTiY8T6jGjuw7gvE0NpfmQF6uiWPyA6e4rfCy7kSayfqj 3s6yJq4a5h9+1+N4s8dadQsOqH8doWZq7TCszGK50/LTHqV6/ikp7fC6IMBXS4gpQxXX EiRjfZtyToLLSN/myLsonJ7daVgITV/2vJRcS1dV7lTJ/EKkpDEyDhyWTcsWXUK4vNYy qYUXek/QS9zx8VkE63as4yHqUtmFWcqr/I/QDUC4SP53DMHyW+ERN/+9DWrycmiWKPx3 J8tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dac+fqiH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si25038280pgr.342.2021.09.28.09.14.24; Tue, 28 Sep 2021 09:14:38 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dac+fqiH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241700AbhI1QO2 (ORCPT + 99 others); Tue, 28 Sep 2021 12:14:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:50796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241523AbhI1QO2 (ORCPT ); Tue, 28 Sep 2021 12:14:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F0FA611C3; Tue, 28 Sep 2021 16:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632845568; bh=DFUNqDy3Ot4Tq/eu+piBAz26Q4OJcSk95Ec7Bn5i6Dg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Dac+fqiHI1x2PWBuvFfxKNJDpFWhm/YXuGKyIH0a3CYgDU/rJjao/sCWx0YisD96a fYoWfKjze8RtTP7gJnFx4BxwiDzBTL5eRZzL16tVn5hxZjPcTT/WhLUAWcMURXtPFd YUyCR52j/GFh34N4oHXz+4AkaPYW3JBkyfLqKqtqqDE7MXxXoSbFtSBrCj+1hffvDA v/m2efbsgzH/ZaSrMRNmXGKxBvIPzFiYhQXewvMzCZPeo02x7zK7zzqIXvSfC0oyid sVsL/Fz3ZwH7JcrPn4s59UyUMXeeNlST4Ru2/mDlDO+qHRWXAwmxYSohpy1Nc95TxR 07tmeWhZ0/rIA== Date: Tue, 28 Sep 2021 21:42:19 +0530 From: Manivannan Sadhasivam To: Md Sadre Alam Cc: miquel.raynal@bootlin.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, sricharan@codeaurora.org Subject: Re: [PATCH 3/3] mtd: rawnand: qcom: Add support for page scope read Message-ID: <20210928161219.GD12183@thinkpad> References: <1631699851-12172-1-git-send-email-mdalam@codeaurora.org> <1631699851-12172-4-git-send-email-mdalam@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1631699851-12172-4-git-send-email-mdalam@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 03:27:31PM +0530, Md Sadre Alam wrote: > QPIC V2.0 onwards QPIC controller support enhanced read mode > like page scope read and multi page read. > Define page scope read. > In QPIC V1, SW is needed to write EXEC_CMD register for each > Code word and collect any Status related to that CW before > issueing EXEC_CMD for next CW. > > Page scope command is truly a page mode command where SW is > required to issue EXEC_CMD only once for a page. Controller > HW takes care of Codeword specific details and automatically > returns status associated with each CW to BAM pipe, dedicated > for status deposition. > > With this command, SW now can issue one read command for a page > and upon receiving completion interrupt, can process status, > that have already been deposited in memory through status BAM pipe. > > Signed-off-by: Md Sadre Alam > --- > drivers/mtd/nand/raw/qcom_nandc.c | 77 ++++++++++++++++++++++++++++++++++++--- > 1 file changed, 71 insertions(+), 6 deletions(-) > > diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c > index 07448c4..257dec7e 100644 > --- a/drivers/mtd/nand/raw/qcom_nandc.c > +++ b/drivers/mtd/nand/raw/qcom_nandc.c > @@ -157,6 +157,10 @@ > #define OP_FETCH_ID 0xb > #define OP_RESET_DEVICE 0xd > > +/* Auto status val and mask */ > +#define AUTO_STS_VAL 0x000B000B Use non-cap hex. > +#define PAGE_SCOPE_READ BIT(23) > + > /* Default Value for NAND_DEV_CMD_VLD */ > #define NAND_DEV_CMD_VLD_VAL (READ_START_VLD | WRITE_START_VLD | \ > ERASE_START_VLD | SEQ_READ_START_VLD) > @@ -336,6 +340,8 @@ struct nandc_regs { > > __le32 erased_cw_detect_cfg_clr; > __le32 erased_cw_detect_cfg_set; > + > + __le32 auto_sts_en; > }; > > /* > @@ -421,6 +427,9 @@ struct qcom_nand_controller { > > u32 cmd1, vld; > const struct qcom_nandc_props *props; > + > + __le32 *status_buf; > + int sts_buf_size; Add kdoc for these two members. > }; > > /* > @@ -487,6 +496,7 @@ struct qcom_nandc_props { > bool is_bam; > bool is_qpic; > bool qpic_v2; > + bool page_scope; > u32 dev_cmd_reg_start; > }; > > @@ -656,6 +666,8 @@ static __le32 *offset_to_nandc_reg(struct nandc_regs *regs, int offset) > return ®s->cfg1; > case NAND_DEV0_ECC_CFG: > return ®s->ecc_bch_cfg; > + case NAND_AUTO_STATUS_EN: > + return ®s->auto_sts_en; > case NAND_READ_STATUS: > return ®s->clrreadstatus; > case NAND_DEV_CMD1: > @@ -756,10 +768,13 @@ static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read, i > struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); > > if (read) { > - if (host->use_ecc) > + if (host->use_ecc) { > cmd = OP_PAGE_READ_WITH_ECC | PAGE_ACC | LAST_PAGE; > - else > + if (nandc->props->qpic_v2 && nandc->props->page_scope) Again, why you are checking for both conditions? Using "page_scope" is sufficient enough. > + cmd |= PAGE_SCOPE_READ; > + } else { > cmd = OP_PAGE_READ | PAGE_ACC | LAST_PAGE; > + } > } else { > cmd = OP_PROGRAM_PAGE | PAGE_ACC | LAST_PAGE; > } [...] > if (use_ecc) { > - read_reg_dma(nandc, NAND_FLASH_STATUS, 2, 0); > - read_reg_dma(nandc, NAND_ERASED_CW_DETECT_STATUS, 1, > - NAND_BAM_NEXT_SGL); > + if (nandc->props->qpic_v2 && nandc->props->page_scope) { > + if (qcom_nandc_is_last_cw(ecc, cw)) > + write_reg_dma(nandc, NAND_EXEC_CMD, 1, > + NAND_BAM_NEXT_SGL); > + } else { > + write_reg_dma(nandc, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL); > + read_reg_dma(nandc, NAND_FLASH_STATUS, 2, 0); > + read_reg_dma(nandc, NAND_ERASED_CW_DETECT_STATUS, 1, > + NAND_BAM_NEXT_SGL); > + } You need to add a comment for this. Thanks, Mani