Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp825091lqt; Tue, 19 Mar 2024 05:16:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXonLY0BO+W1GEksckITJQtxHZlHSR1kk1edYD3xuktvk4wgx5A7c69tMQTwUgg3qbzEEqQJmimhsECdjH3yN5ZYRXGwVo6sMGEnTxbQA== X-Google-Smtp-Source: AGHT+IHsgioIMgGDvVHMSYWE4Ej7r9Xw8czlOthnh2ZMyp1IbzJS69gXBRofK1q1zUV4WWrQT32H X-Received: by 2002:a17:906:4699:b0:a46:d04b:66e7 with SMTP id a25-20020a170906469900b00a46d04b66e7mr2147253ejr.25.1710850618671; Tue, 19 Mar 2024 05:16:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710850618; cv=pass; d=google.com; s=arc-20160816; b=sV2CHKxEaCDruIPOZtLbsbsms2OJzNFQ5Wu7VkyoQy08jNIWfntDdsPz/mRmvpR5Nq 7dAmxChBXh6xoFh1upDCmAGNra2H0trrsP3iAw6UrlMpJ6VeHtDzQi3D2na2maW3YihK grLpmMMQ6bJy1K8pdDdT6CmsXUTOF54PHLFP1UDHiIZcCtLTbRF9U0KPM4KJy0EZkozb 3yTmKHbUEZ+kx9C0YQ66N38NiEF23ERjGOswX2PhhRAD+hJvJ6RnOvavUeQAHLB4ibO/ cN6UepHUqZq9RdHm1qtdAJ+th/eGyQAdJdx0iv7NGsbGquujmO75RuCCvuWoG8driQeZ EJ8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=AIdK1UKm7uWbDB4l190w3ji61JcdvONmHoqBYWiLBHM=; fh=anm/yxLvXN/mVlOKQyj941x07C8bVbMhKtm0Y8rxI+Q=; b=BgvMmqXpG+ow5YzLYrOm6F8SArtG5DbQpadEdw6GTiOPSdyrFykCAQhi0BGo632nLe 9R9K4mQHAv1+uvriVkKk/ZtC7sjONy6qnXZx1cIuBtuz0r/aOWMMwjDuIaYpEIIoBZCc QaBQbQIgw0Xd/tVPlCjFR3AlC+++4m96GAWhccO5P5I3Oyp3mjWFm7TPzAqPhDLAUp3Z yV4Vkyd51koHipyboTlZnUNIrKZfNmn81da8bZQjUNQouRD5l40TYW4yLS/P3UonNBW0 Wiki78LruqFFHz2OFFBdN68rZ332CNOuQWuHBRu3RPk8Xmw4FHtGuzuCjlEFmqxnyb7I 0Ttg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lQsj4izS; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-107505-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107505-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kt22-20020a170906aad600b00a4637091d72si5205589ejb.865.2024.03.19.05.16.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:16:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107505-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lQsj4izS; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-107505-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107505-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3DD4E1F22F25 for ; Tue, 19 Mar 2024 12:16:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22D8F7F7D1; Tue, 19 Mar 2024 12:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="lQsj4izS" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B1487CF03; Tue, 19 Mar 2024 12:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710850607; cv=none; b=YMIwjknzFoUBrNqWEMg2oaWq6GKYa5FDJ/ZhXgz1XZl6f8EB8TpSLibpaKsXpXkfKtjfu51iY3/cmMzhyBvJiDo4Ln5Na7qlYoDZTWtb/xWx5ZTSNMeK/Ah9AKrVSkenx1e2f5C18idLYCjwuIykOO8TAn23fL8aWoVwz5WjKxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710850607; c=relaxed/simple; bh=lG7Mpp10ir6jGVQvb/267xrbeWM2gcvE3nRasap6Ltk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=YwU1NDzK8uQwlt2gajfKgLxB9/fn+8euuBGONk0VhYakJ4/59ef5LBUlyfHhBzlWeUqX2nvEz2Q68pxepBrxXex495n6T3XyxWL3/4SRKIjIvA6tgWus4V4TkH5yl4LQw/hrdjynOB3U2YaiovHgvgrtIG+mJSCm0XnqxiXHZR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=lQsj4izS; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42J7JRxi014653; Tue, 19 Mar 2024 12:16:17 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=AIdK1UKm7uWbDB4l190w3ji61JcdvONmHoqBYWiLBHM=; b=lQ sj4izSKoC2Mosh/Dau3p38O9E4liRYDmx91j9dPqYfU1O/tb+5pAGLWIrW0OK41f chgEzYCTkMg+EfYff0oE01UWtAhasSNINPPBl9VUY+MGNPD4EOq7bKSOX9+n0cGv r+MhdpvsWQsb4QPVLb9AtHjGiKm4j8+GGNhm2za0z8nOuK4wJNm39LMSTZ0+7IBN o5VQZtxlrIjCPfYQhX367Jk8Zo3RAJ/+tl71tgeuRZOYZrnzV2EPireB2FNFtodM 4JBjmHdg7jF/KC83P6ECyeQ9eg7TVGfR5nhTpJlpr/AQkiSLfDGA8//g745zPaWS BQYPHqoMSEPssJejuI4A== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wy1j2h7e8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Mar 2024 12:16:16 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42JCGF8K002516 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Mar 2024 12:16:15 GMT Received: from [10.216.16.222] (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.1118.40; Tue, 19 Mar 2024 05:16:08 -0700 Message-ID: <756ccc79-0077-5c23-73e3-bbb82fbfa8b0@quicinc.com> Date: Tue, 19 Mar 2024 17:46:05 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 v4 2/5] drivers: mtd: nand: Add qpic_common API file Content-Language: en-US To: Miquel Raynal CC: , , , , , , , , , , , , , , , , , , , , References: <20240308091752.16136-1-quic_mdalam@quicinc.com> <20240308091752.16136-3-quic_mdalam@quicinc.com> <20240315124517.4a546ce9@xps-13> <93b08226-3297-2161-cc7d-d33d839c32f0@quicinc.com> <20240319114316.4b977d93@xps-13> From: Md Sadre Alam In-Reply-To: <20240319114316.4b977d93@xps-13> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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-GUID: EHsv-UYCpwLm-waElPxoZGnYSzU6NkYY X-Proofpoint-ORIG-GUID: EHsv-UYCpwLm-waElPxoZGnYSzU6NkYY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-19_02,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 impostorscore=0 phishscore=0 mlxlogscore=650 spamscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403190094 On 3/19/2024 4:13 PM, Miquel Raynal wrote: > Hi, > >>>> +/** >>>> + * qcom_offset_to_nandc_reg() - Get the actual offset >>>> + * @regs: pointer to nandc_reg structure >>>> + * @offset: register offset >>>> + * >>>> + * This function will reurn the actual offset for qpic controller register >>>> + */ >>>> +__le32 *qcom_offset_to_nandc_reg(struct nandc_regs *regs, int offset) >>>> +{ >>>> + switch (offset) { >>>> + case NAND_FLASH_CMD: >>>> + return ®s->cmd; >>>> + case NAND_ADDR0: >>>> + return ®s->addr0; >>>> + case NAND_ADDR1: >>>> + return ®s->addr1; >>>> + case NAND_FLASH_CHIP_SELECT: >>>> + return ®s->chip_sel; >>>> + case NAND_EXEC_CMD: >>>> + return ®s->exec; >>>> + case NAND_FLASH_STATUS: >>>> + return ®s->clrflashstatus; >>>> + case NAND_DEV0_CFG0: >>>> + return ®s->cfg0; >>>> + case NAND_DEV0_CFG1: >>>> + return ®s->cfg1; >>>> + case NAND_DEV0_ECC_CFG: >>>> + return ®s->ecc_bch_cfg; >>>> + case NAND_READ_STATUS: >>>> + return ®s->clrreadstatus; >>>> + case NAND_DEV_CMD1: >>>> + return ®s->cmd1; >>>> + case NAND_DEV_CMD1_RESTORE: >>>> + return ®s->orig_cmd1; >>>> + case NAND_DEV_CMD_VLD: >>>> + return ®s->vld; >>>> + case NAND_DEV_CMD_VLD_RESTORE: >>>> + return ®s->orig_vld; >>>> + case NAND_EBI2_ECC_BUF_CFG: >>>> + return ®s->ecc_buf_cfg; >>>> + case NAND_READ_LOCATION_0: >>>> + return ®s->read_location0; >>>> + case NAND_READ_LOCATION_1: >>>> + return ®s->read_location1; >>>> + case NAND_READ_LOCATION_2: >>>> + return ®s->read_location2; >>>> + case NAND_READ_LOCATION_3: >>>> + return ®s->read_location3; >>>> + case NAND_READ_LOCATION_LAST_CW_0: >>>> + return ®s->read_location_last0; >>>> + case NAND_READ_LOCATION_LAST_CW_1: >>>> + return ®s->read_location_last1; >>>> + case NAND_READ_LOCATION_LAST_CW_2: >>>> + return ®s->read_location_last2; >>>> + case NAND_READ_LOCATION_LAST_CW_3: >>>> + return ®s->read_location_last3; >>> >>> Why do you need this indirection? >> >> This indirection I believe is needed by the write_reg_dma function, >> wherein a bunch of registers are modified based on a starting register. >> Can I change this in a separate cleanup series as a follow up to this? > > I think it would be cleaner to make the changes I requested first and > then make a copy. I understand it is more work on your side, so if you > really prefer you can (1) make the copy and then (2) clean it all. But > please do it all in this series. Ok > >>>> diff --git a/include/linux/mtd/nand-qpic-common.h b/include/linux/mtd/nand-qpic-common.h >>>> new file mode 100644 >>>> index 000000000000..aced15866627 >>>> --- /dev/null >>>> +++ b/include/linux/mtd/nand-qpic-common.h >>>> @@ -0,0 +1,486 @@ >>>> +/* SPDX-License-Identifier: GPL-2.0 */ >>>> +/* >>>> + * QCOM QPIC common APIs header file >>>> + * >>>> + * Copyright (c) 2023 Qualcomm Inc. >>>> + * Authors: Md sadre Alam >>>> + * Sricharan R >>>> + * Varadarajan Narayanan >>>> + * >>>> + */ >>>> +#ifndef __MTD_NAND_QPIC_COMMON_H__ >>>> +#define __MTD_NAND_QPIC_COMMON_H__ >>>> + >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>> >>> You really need this? >> Yes , since some generic structure used here. > > Which ones? If this is a common file, you probably should not. Since we are using this struct qcom_nand_controller { } for both SPI nand as well as raw nand. In this we are having this struct nand_controller controller member. > > Thanks, > Miquèl Thanks, Alam.