Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3576370rwo; Mon, 24 Jul 2023 13:13:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGH2DGOp2ICfcoZ1bEiInCSNzF/1VQ7cEQH/ufH7k6ABzOI8C2e9UidkzqkpjsYEIPD/AYJ X-Received: by 2002:a17:906:e:b0:999:26f6:1579 with SMTP id 14-20020a170906000e00b0099926f61579mr10972192eja.35.1690229627086; Mon, 24 Jul 2023 13:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690229627; cv=none; d=google.com; s=arc-20160816; b=r1Xm4dNx2KDQOgvAitOUu/W5UFmsS+U0MzHdh//Dy+4CghEgofnma6VAvqOBRFdV55 2ZD6uxN8J0z66DJdwnpxJ1b1dyAliGy99V0RVLMeqQZ1egDNP2Tdt4fj2OBYgZ56lqnp oB3/ePglbwt2jScb9Myp3J44qrisHQySNFXmqV3fvJMPAH6L1z/fsk1PMuvrR9hixDVB OExNPj0JNFUllFAjTX5NTmCyCn0gF3HuxIykA/sV0cyk99AnwWlrlJaMLuKF5J2gCTBK aMSpt8CWEx+LMXARprdTJ6xgNrlbmF50gC4H1Nexff0s3m+PwpL3woaXD4NvC92UoaVK neHw== 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=uT4ufz+wHsOJ65L3P5ysUER/zTxRqHomRl0RlZwXaWU=; fh=jiqPiaaCO2EvnsiDaEtL7H7huFfeI/Y0fDQaKLoZwcU=; b=BLQkRpT239yBVWDNUQxRC2JhyKE0rdLSVthc45Kim+seuGdquEmyhtr9htMqqSoxTz ks1wfwVJrOkaiCistW0Et82AwkMImTQR7LbEr5vTMt/5iUHSJhuAN8/nhEqK+34Svwl1 t6zCNyIt2prDRgsDVbRwrAMEXrYnLxEhQkLgp2EYOlbULQU5uv4GjYE4Y+uuGvJiQ4JZ PC6MUyqUiC5YGoGWY5llxNit6tYh/AjmV5NBa5wBWBsbz6ATRalJUAR6AwG2VLfqefF3 sLlgP1N1uDS8M/uTVmOgXjgHFov2oWiyth8bHnAOwrlJ7bUqxaZFOdfhlP1T637axj/d hcmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OokxkpHp; 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 h6-20020a170906828600b00988c64dd7acsi6394015ejx.620.2023.07.24.13.13.22; Mon, 24 Jul 2023 13:13:47 -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=OokxkpHp; 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 S230494AbjGXTGX (ORCPT + 99 others); Mon, 24 Jul 2023 15:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjGXTGE (ORCPT ); Mon, 24 Jul 2023 15:06:04 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C008170F; Mon, 24 Jul 2023 12:05:59 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36OHQrXr005598; Mon, 24 Jul 2023 19:05:56 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=uT4ufz+wHsOJ65L3P5ysUER/zTxRqHomRl0RlZwXaWU=; b=OokxkpHpg4OhJ+OCpfuapHoM6I2dQqig7aOFRNq0AY571F2O7MXJtXTTLPemCMZc/+tq r3VUhZLif0/JRlGj6ouWBctGwyD1FQ/F/iSfjLJ/qsrfxidcpsHSJoe1wJJQN5DTqfEX XGLpY5PEASC7Zveb9mPYsefOe4oUj801Q5y0JzjlvDX9zFuqqK1NhY7LZjVvtsrpnC1i DTF96Msjrzw1UeGQY1TdEYeq0959rsMDHvN9Dz6YuzUGEiYKGJ6ZuC2jdx+wsYs3EfXb +XS+F14FMWpxoy86RRuIil00sWapNExHa9aofVFcmDex0n46sS/4pmPZq59KKjdjmLww Ww== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s1v6u8fqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jul 2023 19:05:55 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36OJ5ssq007013 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jul 2023 19:05:54 GMT Received: from [10.134.65.165] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Mon, 24 Jul 2023 12:05:54 -0700 Message-ID: Date: Mon, 24 Jul 2023 12:05:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH V5 1/3] firmware: qcom_scm: provide a read-modify-write function Content-Language: en-US To: Kathiravan T , Andy Gross , Bjorn Andersson , Konrad Dybcio , Linus Walleij , "Mukesh Ojha" , Kalle Valo , Loic Poulain , , , CC: , , , , Srinivas Kandagatla References: <20230720070408.1093698-1-quic_kathirav@quicinc.com> <20230720070408.1093698-2-quic_kathirav@quicinc.com> From: Elliot Berman In-Reply-To: <20230720070408.1093698-2-quic_kathirav@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: SyZz-8N0IQ_YZPDQ-3VEN98z-z9nFdTu X-Proofpoint-GUID: SyZz-8N0IQ_YZPDQ-3VEN98z-z9nFdTu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-24_14,2023-07-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 priorityscore=1501 mlxlogscore=800 lowpriorityscore=0 impostorscore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307240167 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 7/20/2023 12:04 AM, Kathiravan T wrote: > From: Mukesh Ojha > > It was realized by Srinivas K. that there is a need of read-modify-write > scm exported function so that it can be used by multiple clients. > > Let's introduce qcom_scm_io_update_field() which masks out the bits and > write the passed value to that bit-offset. > > Suggested-by: Srinivas Kandagatla > Signed-off-by: Mukesh Ojha > Signed-off-by: Kathiravan T After updating EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL: Reviewed-by: Elliot Berman > --- > Changes in V5: > - No changes > > drivers/firmware/qcom_scm.c | 15 +++++++++++++++ > include/linux/firmware/qcom/qcom_scm.h | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > index fde33acd46b7..104d86e49b97 100644 > --- a/drivers/firmware/qcom_scm.c > +++ b/drivers/firmware/qcom_scm.c > @@ -407,6 +407,21 @@ int qcom_scm_set_remote_state(u32 state, u32 id) > } > EXPORT_SYMBOL(qcom_scm_set_remote_state); > > +int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask, unsigned int val) > +{ > + unsigned int old, new; > + int ret; > + > + ret = qcom_scm_io_readl(addr, &old); > + if (ret) > + return ret; > + > + new = (old & ~mask) | (val & mask); > + > + return qcom_scm_io_writel(addr, new); > +} > +EXPORT_SYMBOL(qcom_scm_io_update_field); > + > static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) > { > struct qcom_scm_desc desc = { > diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmware/qcom/qcom_scm.h > index 250ea4efb7cb..ca41e4eb33ad 100644 > --- a/include/linux/firmware/qcom/qcom_scm.h > +++ b/include/linux/firmware/qcom/qcom_scm.h > @@ -84,6 +84,8 @@ extern bool qcom_scm_pas_supported(u32 peripheral); > > extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); > extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); > +extern int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask, > + unsigned int val); > > extern bool qcom_scm_restore_sec_cfg_available(void); > extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);