Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1198467rwb; Fri, 13 Jan 2023 09:05:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXu9RP36nbFGkuw0354r5+GZZZRobmePfGrWccT639nL4NHnlI1j5rsakeDJMc3JUpXVsQsZ X-Received: by 2002:a05:6a00:bf5:b0:57c:2ab7:2c0b with SMTP id x53-20020a056a000bf500b0057c2ab72c0bmr2668514pfu.28.1673629542524; Fri, 13 Jan 2023 09:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673629542; cv=none; d=google.com; s=arc-20160816; b=MioXMVfTpxcIzYfqCboghA8iJST3mMB4cjMrepCyB++bxKRAmhkyP/SbyB31w4GVE/ zUC3hyErgvoidhR8w/214xvIAom55zPmXs57rjCDdMKdvh26npvYwOwoKQTVu0K1jtHt w6rIYsTNEdeuH+wP9fJIIoeyaDly2jhKa0vmKwumj/X97bp9r3J8Ri+NT2mF107LuBHU MJTpn3u01GZJzTtWehbUGo5N7suf+UL/+qOJHZz1sxRIlyHzTYN5qCC0URHQXBGhH3YX 64vRK8KnqsP/m3RTrrnJ0EN8yL9pnyN3GSe27L3pjbO29u8W8Vti0VUiVJXyCMvvKiVG zXKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3CeGh1xOjJZmAjo3bnaPdUAZVDnewBGMa9REiWAFOQE=; b=QGOBV0fOdJ8ADF1fy0rapOgnQmG/luD0uNR+pVFM68FvOXaLxhXIENJM8eBlasGpAX chEy+tFvPwX75psyw2PcuyRuRRfRUNuGMnN5kotsVS/FoZrf+WQZWQc7AP5V9rwWok9+ +gSZ4tOhzjLAyaxLVlWzMYLKi1yaD7EKkxy47/oWlHO9aakkrYv8/VUqS/VUMDQor59+ 2vtWC3kixw28Pw2Y3E/23dJ+DCTa6RtokS5ebqYtB5uPSjmNbiB/UUNunbkSZMktG3lX TMq+/u1mRIkS2IowAt0pSZvDdXl5luPlGzPRhZxbEbddFfpZC9UFfA+9i04jQr0hv5OM SvjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jzZyixKO; 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 q15-20020a056a00150f00b00576950b449asi20766698pfu.351.2023.01.13.09.05.35; Fri, 13 Jan 2023 09:05:42 -0800 (PST) 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=jzZyixKO; 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 S230017AbjAMQJO (ORCPT + 51 others); Fri, 13 Jan 2023 11:09:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjAMQI1 (ORCPT ); Fri, 13 Jan 2023 11:08:27 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEBE98BA9D; Fri, 13 Jan 2023 08:01:26 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DAxNXP030827; Fri, 13 Jan 2023 16:01:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=3CeGh1xOjJZmAjo3bnaPdUAZVDnewBGMa9REiWAFOQE=; b=jzZyixKOk+fRnf+V+jN0u3Mm8QgFoUQgToz6ymX4ctwrBZiwEKYGETxN6tyfUsUP1dh1 rQXGc6Z87xUf7568V/IVqxPJM4YNNfJWR6KHyf9O+wK7Yklml+3RFOgD6Ty6UfRVlpHl MHeKw/aRdbihDXQJmBZEutXDEL1QSPau8opzRvVGB8GgpV2F4CWycoSGj+UOTPEIWZVo liWIrlbHyRs8E1dNyMoyUE3NOtfnByNWlGfL3LFgnSOBGAOvLZpKC3ivOgASwUym9VNh eh75+1UvVbD4Dnz8Sjq9L1Kli/TpwyunEzrXvhdLoCIxLcbxtjkamTuOzHZ/PdAbgzRg Iw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3n351f91rk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 16:01:01 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 30DG1099015345 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 16:01:00 GMT Received: from poovendh-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 13 Jan 2023 08:00:53 -0800 From: Poovendhan Selvaraj To: , , , , , , , , , , , , , , , , , , , CC: , , , , , , Subject: [PATCH 3/5] firmware: scm: Modify only the DLOAD bit in TCSR register for download mode Date: Fri, 13 Jan 2023 21:30:10 +0530 Message-ID: <20230113160012.14893-4-quic_poovendh@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230113160012.14893-1-quic_poovendh@quicinc.com> References: <20230113160012.14893-1-quic_poovendh@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: o4ued7qFq-9DLCvZfm1tOgMwIVUzFPXM X-Proofpoint-ORIG-GUID: o4ued7qFq-9DLCvZfm1tOgMwIVUzFPXM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_07,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130107 X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Add support to read-modify-write TCSR register to modify only DLOAD bit. Co-developed-by: Anusha Rao Signed-off-by: Anusha Rao Co-developed-by: Kathiravan Thirumoorthy Signed-off-by: Kathiravan Thirumoorthy Signed-off-by: Poovendhan Selvaraj --- drivers/firmware/qcom_scm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index cdbfe54c8146..b56d8f465f71 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -400,7 +400,7 @@ int qcom_scm_set_remote_state(u32 state, u32 id) } EXPORT_SYMBOL(qcom_scm_set_remote_state); -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) +static int __qcom_scm_set_dload_mode(struct device *dev, u32 val, bool enable) { struct qcom_scm_desc desc = { .svc = QCOM_SCM_SVC_BOOT, @@ -410,7 +410,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) .owner = ARM_SMCCC_OWNER_SIP, }; - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; + desc.args[1] = enable ? val | QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; return qcom_scm_call_atomic(__scm->dev, &desc, NULL); } @@ -419,15 +419,19 @@ static void qcom_scm_set_download_mode(bool enable) { bool avail; int ret = 0; + u32 dload_addr_val; avail = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_SET_DLOAD_MODE); + ret = qcom_scm_io_readl(__scm->dload_mode_addr, &dload_addr_val); + if (avail) { - ret = __qcom_scm_set_dload_mode(__scm->dev, enable); + ret = __qcom_scm_set_dload_mode(__scm->dev, dload_addr_val, enable); } else if (__scm->dload_mode_addr) { ret = qcom_scm_io_writel(__scm->dload_mode_addr, - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); + enable ? dload_addr_val | + QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); } else { dev_err(__scm->dev, "No available mechanism for setting download mode\n"); -- 2.17.1