From patchwork Wed Apr 19 13:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taniya Das X-Patchwork-Id: 85405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp391385vqo; Wed, 19 Apr 2023 06:31:38 -0700 (PDT) X-Google-Smtp-Source: AKy350YqkPgBJk8vsoI6fwytcMh+Kt7658/5bea6mCTXS72rTi7SCe9VLi7dA1UngzJ284rM/4jY X-Received: by 2002:a05:6a20:1615:b0:e7:7844:903a with SMTP id l21-20020a056a20161500b000e77844903amr4145277pzj.53.1681911098505; Wed, 19 Apr 2023 06:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681911098; cv=none; d=google.com; s=arc-20160816; b=Q3TUgG6TcnAlORSmfJijy2NBFPZXNTuv6NpgC7/AyPbcfp4D/XNhAtHVhTvrMcahf2 Ol9gJkXLhtckQgfFg27AtPVuwePxryaN5XSObM9UWEGUFtu9Xei6bisMJMjEWJZTKsOc tEH4k4n3mk8irWUk4YPwP8kaZQMcVpDcTvL1PrUcZJ/sTUt8Ca7Rr0VJydG7AKtY08pC 5HnW18QvLscHUuTcAeYwXniVoFwogar9+kMmi1ELkfyONhj8z3q2wVl9HjVENoHNnRst BX3iVk0s/tP203FeNmBmEzT7EoQiHme2sMLhxrTCoHsE0LbeYMQjQde/gEgy+FSiLh77 LnVQ== 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=RpsRvXvb/m23/CEmpkdaobByEZtgO+aU85Pq5Ig2c08=; b=jmRZKc61kJvfDg0PPXWrxr3J5vjWDKSrqp2SRd3P5qE9n99jSoz23R084e3iaYLWts vcVe7IYm0vxkQlBmp2iWWtbApa5Q4Oa4QfBBHgtUVqoNNamHNUgohyD/FeFSSNI+JG/G EffUNGU535TzViq0+8lx6ed5Advjb7zlA+C48ptuMWNOMI7N8SEPY1K10vdiZWez+eHe dDGO6NgrCYyQyS81hqykODW4cV+4rxTa0agG74asi7zhS4aHQDaGd/xgCpHzgqiIkQLC Ctxp2vsL+iWrIx5U7BsNohrlrU6Codhkx3I3hBdMLS46kZYR8iun9N8UYNA6X1i2oG+9 qQRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=P+kiUgRp; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x184-20020a6386c1000000b005184d7fc006si2360713pgd.674.2023.04.19.06.31.22; Wed, 19 Apr 2023 06:31:38 -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=P+kiUgRp; 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 S233514AbjDSNay (ORCPT + 99 others); Wed, 19 Apr 2023 09:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233506AbjDSNat (ORCPT ); Wed, 19 Apr 2023 09:30:49 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB34446B8; Wed, 19 Apr 2023 06:30:45 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33JCxTIX009628; Wed, 19 Apr 2023 13:30:42 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=RpsRvXvb/m23/CEmpkdaobByEZtgO+aU85Pq5Ig2c08=; b=P+kiUgRpKeSNvaRNK8V/HKmX/aM7dw8vRWulY0CgC7Y6worwQBa5B60ZgRIdBqeGPZkc sGVDHHsVJ/JOIyqkYLRYZfoWvvdsbuls2N5lG6cbrsP7x/57AdKWFp+tYBuF4N84PSpa oFmpxGmBulI4yPma0UcqRRknjYYQU9tEQJZ0tVjVQIAl3+f6xZD1xyHKAraA3OYWcTzd IfmEpVp29MV8wSw0SjH9wsCXJkGKL1nblTtG6RKRkK38jFNZZ40BQ2rUNxJ7Za5iuHJJ 28QtkMrQlDooCOt2n9NABRIlRDTYjRUWUyBHJ3VyuACmuuQYyGDRdGYO+lCD3697nyuN KQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1wxk2t9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Apr 2023 13:30:42 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33JDUepl015251 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Apr 2023 13:30:40 GMT Received: from hu-tdas-hyd.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.42; Wed, 19 Apr 2023 06:30:35 -0700 From: Taniya Das To: Stephen Boyd , Rob Herring , "Bjorn Andersson" , Andy Gross , "Krzysztof Kozlowski" , Richard Cochran , Michael Turquette CC: , Imran Shaik , , , , , Taniya Das , , Subject: [PATCH 1/4] clk: qcom: branch: Extend the invert logic for branch2 clocks Date: Wed, 19 Apr 2023 19:00:10 +0530 Message-ID: <20230419133013.2563-2-quic_tdas@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230419133013.2563-1-quic_tdas@quicinc.com> References: <20230419133013.2563-1-quic_tdas@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: IlTUYRaTcud-ZlYEwNMDej2meQUqyfpU X-Proofpoint-ORIG-GUID: IlTUYRaTcud-ZlYEwNMDej2meQUqyfpU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-19_08,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304190121 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763611612008888254?= X-GMAIL-MSGID: =?utf-8?q?1763611612008888254?= From: Imran Shaik Add support to handle the invert logic for branch2 clocks. Invert branch halt would indicate the clock ON when CLK_OFF bit is '1' and OFF when CLK_OFF bit is '0'. Signed-off-by: Imran Shaik Signed-off-by: Taniya Das --- drivers/clk/qcom/clk-branch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/qcom/clk-branch.c b/drivers/clk/qcom/clk-branch.c index f869fc6aaed6..4b24d45be771 100644 --- a/drivers/clk/qcom/clk-branch.c +++ b/drivers/clk/qcom/clk-branch.c @@ -48,6 +48,7 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling) { u32 val; u32 mask; + bool invert = (br->halt_check == BRANCH_HALT_ENABLE); mask = BRANCH_NOC_FSM_STATUS_MASK << BRANCH_NOC_FSM_STATUS_SHIFT; mask |= BRANCH_CLK_OFF; @@ -56,9 +57,16 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling) if (enabling) { val &= mask; + + if (invert) + return (val & BRANCH_CLK_OFF) == BRANCH_CLK_OFF; + return (val & BRANCH_CLK_OFF) == 0 || val == BRANCH_NOC_FSM_STATUS_ON; } else { + if (invert) + return (val & BRANCH_CLK_OFF) == 0; + return val & BRANCH_CLK_OFF; } }