Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5501520rwd; Wed, 24 May 2023 02:44:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7U2MeY9V9eRTcE12eikFI4E4f8uG90p2F+vHqxHtGANMAk87PBro0Q+ETJmPboQB9XYG1A X-Received: by 2002:a05:6a00:2d1d:b0:64d:3e7f:7121 with SMTP id fa29-20020a056a002d1d00b0064d3e7f7121mr2133701pfb.22.1684921479070; Wed, 24 May 2023 02:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684921479; cv=none; d=google.com; s=arc-20160816; b=SSPPCFj7dOhueFEnZKKdG/qB1zy/W/KnqLMGMnGFVC7akd3jWygGeM9Sz88xZmsjz5 0AAWJxOOaJfwc6OPjc01sA3qoFsisASjhs0GSWlMbCxvYhq5iY1yDR+vPxleaUmMgTU9 UkzdznYDzrauBXX2gAL8zhiAW2xYwsXN3m2UiwO+iwh4el/YoEUSgMUUhgIwfxCixFXt XCeNbZRWTlKet2LI8ZdcTj4vaDvnBGb9mfU1vq8NFgU4AIDdxrAAKkZCgneZ/i7rH+mk ULwXpnMnvGLoKw9cAa9bwCw8XWVUg27tv9lY1R/bB19h+iJL9ilEQ5NKtHzfliUP1Ty7 IgNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=dANZ+34Cj+apXQq0ujqh5laptz7aFMADMcnj2pcYRpg=; b=Ce9oQY12N89YnQNeSVI1zyBQ0L9qzSenSX2UD1h5rgsreHwzUAxF7wM9iYJ/1uuVbP k+VSpNLX59WSr27PYOoNfvVatuaLxVlpu0mfNznvhxem3OlbdBYA19B2oTvQrdx/UmT/ iByfdK44DkYkxmV/8XnXX75nXYFN7182tvLBKMVmguUAzfhaqMUwLKKGQLZMRqqRlDnt oCBPhMPS5mtelyT3ALJMZMst7Jjj7iGt0YLwmbsYDs2GmPxM3TXJt/Q1S5bpsTrSCaZN 1T0R7zEOAIcm3VaTwpVW/eqr+p6DQ4QinOOYIy2YtWsbLcvHmwTBoAdEUNcvxvmBgOBc +k0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=V7KqU+ES; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020aa78bc3000000b0064d2c1fb45dsi7927119pfd.154.2023.05.24.02.44.26; Wed, 24 May 2023 02:44:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=V7KqU+ES; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229482AbjEXJcm (ORCPT + 99 others); Wed, 24 May 2023 05:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjEXJck (ORCPT ); Wed, 24 May 2023 05:32:40 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2265793; Wed, 24 May 2023 02:32:39 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34O8c7rJ019014; Wed, 24 May 2023 09:32:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=dANZ+34Cj+apXQq0ujqh5laptz7aFMADMcnj2pcYRpg=; b=V7KqU+ES0Bv6cJ/Iw18gliaRRDRNAHZR9ZyANakioHJP47CSf0k5Cuy+CKn7ycQ715uL QQWupR1isJf5CnWhTdcoyj3DIUJyayVUF9/fDJUOPqA0CG89FjeZ2cJ60anWXGCQvWOm 4PARlycNFi4Xn4trAbBEoxIEwO/yAWYABYTMXFQov7XaJM3p8DAmClXjfObKd7jjrOza wl0zvNVBE/0kTGzXjD7rmI40vU6KQOkmy2Yetuis8pjwz6NGsry564+P5S6z/RwZQzVY V3nKvLczbLBUAnUq+SAbmpAkTmV5CjGlcZC3WZdiam/YgxYghNx6c+XXW86dL8A9Wsc4 hQ== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qsf8805df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 May 2023 09:32:28 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34O9WS0F004019 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 May 2023 09:32:28 GMT Received: from [10.201.3.104] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 24 May 2023 02:32:25 -0700 Message-ID: Date: Wed, 24 May 2023 15:02:22 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v2 4/5] mtd: rawnand: qcom: Add support for read, write, erase exec_ops Content-Language: en-US To: Miquel Raynal CC: , , , , , , References: <20230511133017.6307-1-quic_mdalam@quicinc.com> <20230511133017.6307-5-quic_mdalam@quicinc.com> <20230522155345.1d12600e@xps-13> From: Md Sadre Alam In-Reply-To: <20230522155345.1d12600e@xps-13> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: -U9uGJkjeqSIBjqHQfJKJSV3cPBKL8Au X-Proofpoint-GUID: -U9uGJkjeqSIBjqHQfJKJSV3cPBKL8Au X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_05,2023-05-23_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240080 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/22/2023 7:23 PM, Miquel Raynal wrote: > > quic_mdalam@quicinc.com wrote on Thu, 11 May 2023 19:00:16 +0530: > >> This change will add exec_ops support for READ, WRITE, and ERASE >> command. >> >> Co-developed-by: Sricharan Ramabadhran >> Signed-off-by: Sricharan Ramabadhran >> Signed-off-by: Md Sadre Alam >> --- >> Change in [v2] >> >> * Missed to post Cover-letter, so posting v2 patch with cover-letter >> >> drivers/mtd/nand/raw/qcom_nandc.c | 52 +++++++++++++++++++++++++++++-- >> 1 file changed, 49 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c >> index 8717d5086f80..14ab21a4771b 100644 >> --- a/drivers/mtd/nand/raw/qcom_nandc.c >> +++ b/drivers/mtd/nand/raw/qcom_nandc.c >> @@ -1765,7 +1765,8 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, >> int ret, reg_off = FLASH_BUF_ACC, read_loc = 0; >> int raw_cw = cw; >> >> - nand_read_page_op(chip, page, 0, NULL, 0); >> + chip->cont_read.ongoing = false; > > This should be checked once for all by the core at startup, that's when > you can tell the core continuous read is not supported by the > controller. Sure, Will fix this in next patch V3. > >> + nand_read_page_op(chip, page, 0, data_buf, mtd->writesize); >> host->use_ecc = false; >> >> if (nandc->props->qpic_v2) >> @@ -2182,14 +2183,24 @@ static void qcom_nandc_codeword_fixup(struct qcom_nand_host *host, int page) >> static int qcom_nandc_read_page(struct nand_chip *chip, uint8_t *buf, >> int oob_required, int page) >> { >> + struct mtd_info *mtd = nand_to_mtd(chip); >> struct qcom_nand_host *host = to_qcom_nand_host(chip); >> struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); >> + struct nand_ecc_ctrl *ecc = &chip->ecc; >> u8 *data_buf, *oob_buf = NULL; >> >> if (host->nr_boot_partitions) >> qcom_nandc_codeword_fixup(host, page); >> >> - nand_read_page_op(chip, page, 0, NULL, 0); >> + chip->cont_read.ongoing = false; >> + nand_read_page_op(chip, page, 0, buf, mtd->writesize); >> + nandc->buf_count = 0; >> + nandc->buf_start = 0; >> + host->use_ecc = true; >> + clear_read_regs(nandc); >> + set_address(host, 0, page); >> + update_rw_regs(host, ecc->steps, true, 0); >> + >> data_buf = buf; >> oob_buf = oob_required ? chip->oob_poi : NULL; >> >> @@ -2259,6 +2270,10 @@ static int qcom_nandc_write_page(struct nand_chip *chip, const uint8_t *buf, >> >> nand_prog_page_begin_op(chip, page, 0, NULL, 0); >> >> + set_address(host, 0, page); >> + nandc->buf_count = 0; >> + nandc->buf_start = 0; >> + >> clear_read_regs(nandc); >> clear_bam_transaction(nandc); >> >> @@ -3081,7 +3096,38 @@ static int qcom_read_status_exec(struct nand_chip *chip, >> >> static int qcom_erase_cmd_type_exec(struct nand_chip *chip, const struct nand_subop *subop) >> { >> - return 0; >> + struct qcom_nand_host *host = to_qcom_nand_host(chip); >> + struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); >> + struct qcom_op q_op; >> + int ret = 0; >> + >> + qcom_parse_instructions(chip, subop, &q_op); >> + >> + q_op.cmd_reg |= PAGE_ACC | LAST_PAGE; >> + >> + pre_command(host, NAND_CMD_ERASE1); > > The instruction is up to the caller, not to the driver. If no other > instruction rather than NAND_CMD_ERASE1 can be used with this pattern, > then it should be properly described (see the Arasan controller, > anfc_check_op()). > Thanks, will fix this in next patch V3. >> + >> + nandc_set_reg(chip, NAND_FLASH_CMD, q_op.cmd_reg); >> + nandc_set_reg(chip, NAND_ADDR0, q_op.addr1_reg); >> + nandc_set_reg(chip, NAND_ADDR1, q_op.addr2_reg); >> + nandc_set_reg(chip, NAND_DEV0_CFG0, >> + host->cfg0_raw & ~(7 << CW_PER_PAGE)); >> + nandc_set_reg(chip, NAND_DEV0_CFG1, host->cfg1_raw); >> + nandc_set_reg(chip, NAND_EXEC_CMD, 1); >> + >> + write_reg_dma(nandc, NAND_FLASH_CMD, 3, NAND_BAM_NEXT_SGL); >> + write_reg_dma(nandc, NAND_DEV0_CFG0, 2, NAND_BAM_NEXT_SGL); >> + write_reg_dma(nandc, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL); >> + >> + ret = submit_descs(nandc); >> + if (ret) >> + dev_err(nandc->dev, "failure in sbumitting reset descriptor\n"); >> + >> + free_descs(nandc); >> + >> + ret = qcom_wait_rdy_poll(chip, q_op.rdy_timeout_ms); >> + >> + return ret; >> } >> >> static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_subop *subop) > > > Thanks, > Miquèl