Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1330724lqt; Tue, 19 Mar 2024 23:35:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrESSEw6Z6VX0Zg7pIx2hX7hez0e+APWbNLzG5QyyiRzji1CI3G0PeTpEcgvEt+DHi81zSaYGUJ3IJcTvAnXsUJbsr4IOwnTXth/Ay8A== X-Google-Smtp-Source: AGHT+IH5dsjpVoGwz9awLYa/C4eC2e9mS3emK16VPOA3/G7gOurwnzsypWUH+gNR6FNmsO266asl X-Received: by 2002:a05:620a:5793:b0:788:29ec:12b3 with SMTP id wk19-20020a05620a579300b0078829ec12b3mr19419583qkn.53.1710916513968; Tue, 19 Mar 2024 23:35:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710916513; cv=pass; d=google.com; s=arc-20160816; b=mItL+WpiYXzJEdRtuxKNlpF8exNQafCJ3DXOPo5qSxbf7rwo2MHJ6n68b8SK2Z9mq8 EJWkiAj4XRK+vb9jlbaO64oh6aUpt945LOzliKusEBi/NfsM9HrPXVSzoefDrZA0Bdj3 nUi2yMQWEHua3lzmaIhTlJ3dgpbTznbzRPzeMJKqjOsvvAd10z1qYlC/XhXKmQsNNZdG zMbkKm15cGmV7s3F3uz6bMp5SEL+s98sbi1oodwEHH/gFjPGpawI0+NjDViivJ0R+yBR ay+aZ1TbpC9CVr/zUgwtA1T1rYkG2DSCReYDxhYvLW9q+bH6wkK5xYkcZrBrMN4zHfTo ux2Q== 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=gibPDNh+ncfO0OJ7NGZdgTNIfnqZd+drxwtVVYsvV6U=; fh=anm/yxLvXN/mVlOKQyj941x07C8bVbMhKtm0Y8rxI+Q=; b=Kp3iCm13Y2TL5iV202P3JdD8KMbMN+YCsq2hbi6V3cbdZU32x7ypJI14NuafLkdRxv KrabtBFF4Kv9cCj3US5FT/0Q/j1PeSEMvgUfBJhHKYsBlE+Ue6+gWij5Nub92clhxG0D GUtGI9hH7m6WGbHt0PfmvfkYRMhwY3N5J9YzKTr8UpW2by1ZcO/ieRwuZiDQPs6DT0I9 dwB1HJyoUEMBvW7qG65B7A9R10iATfXpqk0nWshPNogYheIHHNkGFbS+YSPruGMlNepl 8H70Q13Dkg0e4SffoV7p/ViSQ+zO25eRbbEdtahn7kVoaDWA7YlLXbPq9hNsSUHSeG8k 1Tnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=msCSRmCf; 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-108499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bk28-20020a05620a1a1c00b00789e841bac8si10880490qkb.311.2024.03.19.23.35.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 23:35:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=msCSRmCf; 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-108499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108499-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8EC601C2214A for ; Wed, 20 Mar 2024 06:35:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD8411802E; Wed, 20 Mar 2024 06:35:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="msCSRmCf" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 27C6DA29; Wed, 20 Mar 2024 06:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710916503; cv=none; b=RRKskHIDwf0ygJZnNSJEXqmC0QychfNNnUWQHCXxhGDAGnj+QPF7Ng22MetZgGu2yCJkpnkYIkeTEFdLOUgOBGXqZQG7/TcPCQzSfqAGOwTvHTSHbOrOK1ywON4PXW4Nc0nGE/5O5wQaBdyfQFAZ48C4PSiNI5T+rawyeiX3MiM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710916503; c=relaxed/simple; bh=ianIbzzQTFfYXMot1C3h/FL9tFGEeRVdkfcK1e0VSiQ=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=foNWXQFnjVlwOL4tObu/Ig1Z3hyqzO+wfcC8p+QWieeg08byfYkQqN7lEOdSuhd2YTvYSgwOzLacOqEoFrDgNnJlVQ0qxeJZ3E0MqNCIie/XdS9d8RLj12+rGvt618KAz4c8aiUg0rF3VaFEGDI5p7yKx7rraXKDZoasi2k7l5E= 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=msCSRmCf; arc=none smtp.client-ip=205.220.180.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 (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42K4I9FJ016465; Wed, 20 Mar 2024 06:34:27 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=gibPDNh+ncfO0OJ7NGZdgTNIfnqZd+drxwtVVYsvV6U=; b=ms CSRmCfIwhfqYtxU0xAP81OGWZMJZnq8e5z6Bhs7NtRKxffj1+dTNJXB9AEdmHrj6 y+OUzT9rt5OMHGYBbmdtOnauqmBlHB8hhFEqBZT76cLB+wh044MAy7pcsg1hnPhp sXb08c3N8CQaBXvXXzwjTarWaL+Odaq6miQxBrVHhX6LVylPxL9mY6Hh5uZ3Ksmx 8BET4BBYa0yWBGh05OqT/gxOiBDpOBhtf9DdxN6Geh2/FrAAB/kQ+F6HIiwhWIoX 4qrPdUyWPodqLpuzOdrZa1xDApABhOZNlqOH90fNoIQfAyfU0wpeFoymcFUYZJfR YGx7+cRSpTWcziI5iawQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wygbbh4y3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Mar 2024 06:34:27 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42K6YPso019848 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Mar 2024 06:34:25 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 23:34:19 -0700 Message-ID: <58dfa2f5-8b49-a8a9-0857-f75f755f703c@quicinc.com> Date: Wed, 20 Mar 2024 12:04:16 +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> <756ccc79-0077-5c23-73e3-bbb82fbfa8b0@quicinc.com> <20240319140924.167f3063@xps-13> From: Md Sadre Alam In-Reply-To: <20240319140924.167f3063@xps-13> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit 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: BfPakkWhuLrOxL76Q0W3qYhEzZTAFfXw X-Proofpoint-GUID: BfPakkWhuLrOxL76Q0W3qYhEzZTAFfXw 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-20_03,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxscore=0 impostorscore=0 malwarescore=0 mlxlogscore=660 phishscore=0 spamscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403200050 On 3/19/2024 6:39 PM, Miquel Raynal wrote: > Hi, > > quic_mdalam@quicinc.com wrote on Tue, 19 Mar 2024 17:46:05 +0530: > >> 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. > > Maybe we should not expose qcom_nand_controller at all and just share > the minimum bits which are really common. Will move all the header files to .c file from nand-qpic-common.h > > Thanks, > Miquèl Thanks, Alam.