Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2510254pxj; Mon, 10 May 2021 04:52:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylEgWFt+0qU+sCCcC3ridARbsa5yYA6JtDNwHyZ/osDF9Li+h+l19UJ1sY5F071fYKA0vg X-Received: by 2002:a05:6402:31a7:: with SMTP id dj7mr28629735edb.314.1620647540743; Mon, 10 May 2021 04:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620647540; cv=none; d=google.com; s=arc-20160816; b=ybp5H5qF1bg8UrV6ftxqfjK5AtJ/9CVgB3PIS0tKRMTDrq9g0deXeROI59lRSs0ip9 Klh/IAlENrXQfidXvhVoDA7wBurkFQuO331AAjXxnbENaBGSb4t8NXCrIVdeHI8pvbPV h2lgCQnGUOeTSYmcglsdXKjlWwFzOqEWQcQoqr7T2s6Es5S9oWXG/T5/byb2vbp4CYdg V9Wdbh8kwQi4M1ewamovMQ3B2v3TTCKJpmK9HF+5TqEc9LT9yTD+SctgGGnVkt7bxErA ITt9yyH5YJNG0mh5AmNE/LV9drjahGN1Tyd14XCYOEM5ipAomBH0KJwKtILzZD04lZCI 8Gug== 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=4xOMdtMSdK3EDu/vRJPSmTvG+5YJFJ5EnBaroEbp4/I=; b=y3mse2WXnX3POpCZEG1O1hGfjIyAYe6qMFDl6L3WG8QVXiVu8iq7y2TlEaYtxS9l9O Hve5ChrnZKgPpyVv2MJeBey+UudjGIGILpnTKmIX7UF+81VyKtCpXrlQx5RBxf6sG6qU e8GGIletyEwMXXDigmgbwMJTCmjvhW/iK25QC23nzMoyoNM1j/l8414/LnrXUOPAjW93 a/rmYk94Ur4IYWQmoKc/nJXU0Bi66Ysdl3O6unRIJBa06Gi9ciCiSEzZ47Df42bkXTXR XYUg9O1OWgRfJdqIQwvTpUrXTAnUfL64A5/46STz9foXk5P51rxnF4z3X3vloHf9uf2V 9wbw== 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 c16si13776014eja.41.2021.05.10.04.51.52; Mon, 10 May 2021 04:52:20 -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 S236816AbhEJLpv (ORCPT + 99 others); Mon, 10 May 2021 07:45:51 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:5641 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232386AbhEJK6P (ORCPT ); Mon, 10 May 2021 06:58:15 -0400 Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 10 May 2021 03:57:09 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 10 May 2021 03:57:08 -0700 X-QCInternal: smtphost Received: from mdalam-linux.qualcomm.com ([10.201.2.71]) by ironmsg02-blr.qualcomm.com with ESMTP; 10 May 2021 16:26:50 +0530 Received: by mdalam-linux.qualcomm.com (Postfix, from userid 466583) id D0E6120DF0; Mon, 10 May 2021 16:26:48 +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 V2] mtd: rawnand: qcom: avoid writing to obsolete register Date: Mon, 10 May 2021 16:26:46 +0530 Message-Id: <1620644206-2250-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 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 --- [V2] * Updated commit message 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 a64fb6c..32f4641 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -762,7 +762,8 @@ static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read, i nandc_set_reg(chip, NAND_DEV0_CFG0, cfg0); nandc_set_reg(chip, NAND_DEV0_CFG1, cfg1); nandc_set_reg(chip, NAND_DEV0_ECC_CFG, ecc_bch_cfg); - nandc_set_reg(chip, NAND_EBI2_ECC_BUF_CFG, host->ecc_buf_cfg); + if (!nandc->props->qpic_v2) + nandc_set_reg(chip, NAND_EBI2_ECC_BUF_CFG, host->ecc_buf_cfg); nandc_set_reg(chip, NAND_FLASH_STATUS, host->clrflashstatus); nandc_set_reg(chip, NAND_READ_STATUS, host->clrreadstatus); nandc_set_reg(chip, NAND_EXEC_CMD, 1); @@ -1133,7 +1134,8 @@ static void config_nand_page_read(struct nand_chip *chip) 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); @@ -1191,8 +1193,9 @@ static void config_nand_page_write(struct nand_chip *chip) 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); } /* @@ -1248,7 +1251,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(chip, NAND_EBI2_ECC_BUF_CFG, 1 << ECC_CFG_ECC_DISABLE); + if (!nandc->props->qpic_v2) + nandc_set_reg(chip, 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) { @@ -2689,7 +2693,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; -- 2.7.4