Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3219122pxu; Sun, 11 Oct 2020 01:31:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrPm5oLwJivAkzp105JHoeAUDKI54nguy90xG4iNsZ4OjhnA4CGK3eC7s7A4UfEdl+zMC1 X-Received: by 2002:aa7:dbcb:: with SMTP id v11mr8155985edt.351.1602405113679; Sun, 11 Oct 2020 01:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602405113; cv=none; d=google.com; s=arc-20160816; b=GYhRiCfLR4wCJNy7+7QOOOeSuEFlhkf7VBxrWEOB4312CxNIM28xNYFRVrz8nTVI+d zeJaeQx8zlR3Vwxux8pxUtXwrnQ5vVRXT2W7PEqGeHIjsz9fVL2JIlfFkDYfaEt+tO0b CwTQlXKr0AlhrOOtSDLy7swJQrwmMVNGTG9bcUToruAKvHq/sTX37mUd6pWBYyjXF1b0 FyHlJa3wUalTRhYlE4Gj6OH8zentopb7ulYdDsRV22tpo/4YZJPr/B2iknc3DDJ+XIHB MmUZlw9XbTiZjgVFah0a1gaS/2TfpU3AB8mQxdmVFggT90ZcuGbuU+SLnd9A5UGiKTcR ZVZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=nTcStqYQ5/1HZiroQkBYmdgJjmj2AYumaJJuQTsZTgY=; b=nK/y7Az/f2neUg04gs6Cwn7x2ZPLDvXmnwXJTxmrpadJljyg6DSSKHBTjrLwD+Nnqk 1kZ7SDqWUK/C1GlWFa7D6prfDbblXqzu/PQkzmTIqnkTkYur55Ds/6OW5tUCymIW4ydx uPrg2mcWK3eeZ0YPqo1pCmS1cZ0+MbI6DMzF/XQ8ywNo3yf7wTM0cix9cKpapJ9JZref yhf713B0mF/sNscmaATllN2NMf7GmsdAwmajm45x+yQWSIkH+N3V1X3OmdF91WFzCoYB rPD9Pf+wHIlyhk65DkBde5vS2qaLCUeqmyLJOklxb/DTT1vhvBsaLGi8OkcdtpKkrMRY roaA== 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 r18si9855588edy.411.2020.10.11.01.31.05; Sun, 11 Oct 2020 01:31:53 -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 S1730818AbgJJFn2 (ORCPT + 99 others); Sat, 10 Oct 2020 01:43:28 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:18434 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730380AbgJJFcR (ORCPT ); Sat, 10 Oct 2020 01:32:17 -0400 Received: from ironmsg07-lv.qualcomm.com (HELO ironmsg07-lv.qulacomm.com) ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 09 Oct 2020 22:32:11 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg07-lv.qulacomm.com with ESMTP/TLS/AES256-SHA; 09 Oct 2020 22:32:10 -0700 X-QCInternal: smtphost Received: from mdalam-linux.qualcomm.com ([10.201.2.71]) by ironmsg02-blr.qualcomm.com with ESMTP; 10 Oct 2020 11:01:44 +0530 Received: by mdalam-linux.qualcomm.com (Postfix, from userid 466583) id 19D3421ADC; Sat, 10 Oct 2020 11:01:43 +0530 (IST) From: Md Sadre Alam To: agross@kernel.org, bjorn.andersson@linaro.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org, linux-arm-msm@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mdalam@codeaurora.org, sricharan@codeaurora.org Subject: [PATCH 3/5] mtd: rawnand: qcom: Read QPIC version Date: Sat, 10 Oct 2020 11:01:40 +0530 Message-Id: <1602307902-16761-4-git-send-email-mdalam@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1602307902-16761-1-git-send-email-mdalam@codeaurora.org> References: <1602307902-16761-1-git-send-email-mdalam@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change will add support to read QPIC version. QPIC version V2.0 onwards some new register introduced in QPIC. So based on hw_version we will update those register. Signed-off-by: Md Sadre Alam --- drivers/mtd/nand/raw/qcom_nandc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index f5064ab..eabb803 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -443,6 +443,7 @@ struct qcom_nand_controller { u32 cmd1, vld; const struct qcom_nandc_props *props; + u32 hw_version; }; /* @@ -2538,6 +2539,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip) int ecc_mode = 1; int num_addr_cycle = 5, dsbl_sts_aftr_write = 0; int wr_rd_bsy_gap = 2, recovery_cycle = 7; + u32 version_reg; /* controller only supports 512 bytes data steps */ ecc->size = NANDC_STEP_SIZE; @@ -2545,6 +2547,26 @@ static int qcom_nand_attach_chip(struct nand_chip *chip) cwperpage = mtd->writesize / NANDC_STEP_SIZE; /* + * Read the required ecc strength from NAND device and overwrite the + * device tree ecc strength + */ + if (chip->base.eccreq.strength >= 8) + ecc->strength = 8; + + /* Read QPIC version register */ + if (nandc->props->is_serial_nand) + version_reg = (NAND_VERSION + 0x4000); + else + version_reg = NAND_VERSION; + nandc->hw_version = nandc_read(nandc, version_reg); + pr_debug("QPIC controller hw version Major:%d, Minor:%d\n", + ((nandc->hw_version & NAND_VERSION_MAJOR_MASK) + >> NAND_VERSION_MAJOR_SHIFT), + ((nandc->hw_version & NAND_VERSION_MINOR_MASK) + >> NAND_VERSION_MINOR_SHIFT)); + nandc->hw_version = ((nandc->hw_version & NAND_VERSION_MAJOR_MASK) + >> NAND_VERSION_MAJOR_SHIFT); + /* * Each CW has 4 available OOB bytes which will be protected with ECC * so remaining bytes can be used for ECC. */ -- 2.7.4