Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2932069pxy; Mon, 3 May 2021 11:09:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvzW+u6abqMfMnzSAnoQ493zvosZuug4+QREh/VaslPbguy+syGArlXAqT3dIM/GJsCxHu X-Received: by 2002:a65:47cc:: with SMTP id f12mr19517777pgs.252.1620065378586; Mon, 03 May 2021 11:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065378; cv=none; d=google.com; s=arc-20160816; b=CZUnvKcENylV5BOy11ult5APx2tOCZRvn1Jfop6k7m0S4weOySToKJrOmyEliMc1pp tAdqs2AUahdTctSCUQp6/9H7H6nLzCrng/r4S78jiiuA11RpI4tKWIu9Nh6uXhkUIR6Q DgBFE4TiEAgxF50Jv1MEM/xw5GnPapXjEj3WIHZYOJ9lUqHKEuSMZp+LzBkMu7RLGlSJ eZ6YPnSlRz02zWkfJQLiOn11VU3y+yzDfeAxz2i021Tpq33PMCxSsWrKU8cxN4sjj4+Q H6gwiUZ+3Ki2UkreXc6a5lMzlKgI6fSFZYZJ0NCd0gNZXUtTLOw6Ts3kxRIPg+BDhThX pH5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=3Fk+kDMYxkaBQhIOQ4tkY93cPnBbUwngSdDbYFdBEWY=; b=TaX1xdS79asW6MsEbI/z2yANsQ1hvwfNpV2USc0jeY3Ly2g+5jCYF7d6VucoevsNo3 09yiCACYBs/7g8XgVG1xfX1wKj9ZJa/Mq2QUO43MtToDJgVjmn4SzMwIwYLd6RtPHBe8 PQR15F3GqpCWNE3x9WkZm8RN3ioMpYatuCKRYsqUqbryyL1/lif08r/Xu4IwG7pp83Ir RoZC88ehQpo/EiuQ9AlZ+AR4OVncuBZzQZ65C5RE6WSwL0kJydZyMXHwWDMPZ2Ilf1FN 1x1nI1IXiJX0KANxb4BkAgd4THUVL7LiMoMH4CDQFkB7IZpbsPF30kQ4D83Fq8zoNwzi DaXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jgYm7Lx+; 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 v10si15324029pjc.45.2021.05.03.11.09.11; Mon, 03 May 2021 11:09: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=@mg.codeaurora.org header.s=smtp header.b=jgYm7Lx+; 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 S229596AbhECO4H (ORCPT + 99 others); Mon, 3 May 2021 10:56:07 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:39834 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbhECO4F (ORCPT ); Mon, 3 May 2021 10:56:05 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1620053712; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=3Fk+kDMYxkaBQhIOQ4tkY93cPnBbUwngSdDbYFdBEWY=; b=jgYm7Lx+Zxmo3LeP8bHtvSuKXjJ9BdJEkkoeD2LEa9rIPHnoW2VYbInmxHyDH63CdfrFBhI7 VofxBrcpvPFgojGUw0B+kRQ4+5THFyuXxrHovxeZkOjBwPK+QQoFM0CoiQH4UUzzG01WBvtY MorP0K7S4BVAUuLW6b6KjF6Tn2A= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 60900ec19a9ff96d95353c77 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 03 May 2021 14:54:57 GMT Sender: mdalam=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 854F4C433D3; Mon, 3 May 2021 14:54:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mdalam) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7D322C433F1; Mon, 3 May 2021 14:54:54 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 03 May 2021 20:24:54 +0530 From: mdalam@codeaurora.org To: miquel.raynal@bootlin.com, mani@kernel.org, boris.brezillon@collabora.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: sricharan@codeaurora.org Subject: Re: [PATCH] mtd: rawnand: qcom: avoid write to obsolete register In-Reply-To: <1619205694-25645-1-git-send-email-mdalam@codeaurora.org> References: <1619205694-25645-1-git-send-email-mdalam@codeaurora.org> Message-ID: <2667b47434a8f2892ea3d5f304380960@codeaurora.org> X-Sender: mdalam@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-04-24 00:51, Md Sadre Alam wrote: > QPIC_EBI2_ECC_BUF_CFG register got obsolete from QPIC V2.0 onwards. > Avoid writing this register if QPIC version is V2.0 or newer. > > Signed-off-by: Md Sadre Alam > --- > drivers/mtd/nand/raw/qcom_nandc.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/mtd/nand/raw/qcom_nandc.c > b/drivers/mtd/nand/raw/qcom_nandc.c > index fd4c318..8c5205c 100644 > --- a/drivers/mtd/nand/raw/qcom_nandc.c > +++ b/drivers/mtd/nand/raw/qcom_nandc.c > @@ -714,7 +714,8 @@ static void update_rw_regs(struct qcom_nand_host > *host, int num_cw, bool read) > nandc_set_reg(nandc, NAND_DEV0_CFG0, cfg0); > nandc_set_reg(nandc, NAND_DEV0_CFG1, cfg1); > nandc_set_reg(nandc, NAND_DEV0_ECC_CFG, ecc_bch_cfg); > - nandc_set_reg(nandc, NAND_EBI2_ECC_BUF_CFG, host->ecc_buf_cfg); > + if (!nandc->props->qpic_v2) > + nandc_set_reg(nandc, NAND_EBI2_ECC_BUF_CFG, host->ecc_buf_cfg); > nandc_set_reg(nandc, NAND_FLASH_STATUS, host->clrflashstatus); > nandc_set_reg(nandc, NAND_READ_STATUS, host->clrreadstatus); > nandc_set_reg(nandc, NAND_EXEC_CMD, 1); > @@ -1083,7 +1084,8 @@ static void config_nand_page_read(struct > qcom_nand_controller *nandc) > { > write_reg_dma(nandc, NAND_ADDR0, 2, 0); > write_reg_dma(nandc, NAND_DEV0_CFG0, 3, 0); > - write_reg_dma(nandc, NAND_EBI2_ECC_BUF_CFG, 1, 0); > + if (!nandc->props->qpic_v2) > + write_reg_dma(nandc, NAND_EBI2_ECC_BUF_CFG, 1, 0); > write_reg_dma(nandc, NAND_ERASED_CW_DETECT_CFG, 1, 0); > write_reg_dma(nandc, NAND_ERASED_CW_DETECT_CFG, 1, > NAND_ERASED_CW_SET | NAND_BAM_NEXT_SGL); > @@ -1132,8 +1134,9 @@ static void config_nand_page_write(struct > qcom_nand_controller *nandc) > { > write_reg_dma(nandc, NAND_ADDR0, 2, 0); > write_reg_dma(nandc, NAND_DEV0_CFG0, 3, 0); > - write_reg_dma(nandc, NAND_EBI2_ECC_BUF_CFG, 1, > - NAND_BAM_NEXT_SGL); > + if (!nandc->props->qpic_v2) > + write_reg_dma(nandc, NAND_EBI2_ECC_BUF_CFG, 1, > + NAND_BAM_NEXT_SGL); > } > > /* > @@ -1187,7 +1190,8 @@ static int nandc_param(struct qcom_nand_host > *host) > | 2 << WR_RD_BSY_GAP > | 0 << WIDE_FLASH > | 1 << DEV0_CFG1_ECC_DISABLE); > - nandc_set_reg(nandc, NAND_EBI2_ECC_BUF_CFG, 1 << > ECC_CFG_ECC_DISABLE); > + if (!nandc->props->qpic_v2) > + nandc_set_reg(nandc, NAND_EBI2_ECC_BUF_CFG, 1 << > ECC_CFG_ECC_DISABLE); > > /* configure CMD1 and VLD for ONFI param probing in QPIC v1 */ > if (!nandc->props->qpic_v2) { > @@ -2628,7 +2632,8 @@ static int qcom_nand_attach_chip(struct nand_chip > *chip) > | ecc_mode << ECC_MODE > | host->ecc_bytes_hw << ECC_PARITY_SIZE_BYTES_BCH; > > - host->ecc_buf_cfg = 0x203 << NUM_STEPS; > + if (!nandc->props->qpic_v2) > + host->ecc_buf_cfg = 0x203 << NUM_STEPS; > > host->clrflashstatus = FS_READY_BSY_N; > host->clrreadstatus = 0xc0; ping! Hi Miquel could you review this change and let me know if more info needed.