Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4216580rwr; Mon, 8 May 2023 04:53:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Ep4rbhvo8M9ALCgJ0R+IbiGcWkPZEIxl6/K3P0MHDmXcb44waYLSm/9bxBqFVP6OgbBaJ X-Received: by 2002:a17:903:230e:b0:1ab:19f6:ef0f with SMTP id d14-20020a170903230e00b001ab19f6ef0fmr18198867plh.33.1683546825183; Mon, 08 May 2023 04:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683546825; cv=none; d=google.com; s=arc-20160816; b=z2ZZ850puPZznbSRI0VPQ64XD5uqZBSjZNHhJGyOjx/K/mRegc9bQ2COQz82uAoF2g v0WJTlmlnOAMqB/rFuBLVqs/Iv+23wFsCTWgusCAs8qlqb+TNpdCL/GUX1I0z3x11caj 4qjjB5Mz56foEGn38DgFk//PxyGZykik+KYWogSZW2Q9vHLLkBigjLo4a6ZCR9ONUkPC Ve7Qlqh0NFvNemnmJrk4y+By8f3rFwJyf8DP2K3AIuF37fY64yituxEtaRQLjkt2PLq+ DYSmjng2tNaBQR8YEaehS15AeBai9curvZp3oI6xfxULpnKjWYsGRdPsZ7mw2RETmomH 4lFQ== 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=30YV3GSfUJH7uuAX8OaPEaPxhsD0B30A4xbCT71CEQo=; b=U51bIGr/ZkrVqZBjP5CoQpYGS1PkKiO7muG32eWN2RB/c/cXj4pFpmwIHHs8qgH3cm vrjl27qfVl0yugHiVByzXKxE6MnWBhPue2ekIuqZVxIaViDSfFzorXcjYJ8MRT0MGtfm G3dnfwSD0ZhXS0ggdaRuQHU9d4/dW2uWNh6seMDYhJ4kMM88KigamgVRdr2xC7ejW6Wf /uBqGfjuB3v0T7gtqMUct5vnxAwFiZabxpqT/nxTLcd6up1f8l8pp/THMZ3Fu1RFexP9 2ZT2Kl4jrzYTsA7al0t1Mk2D6Zq4O+QTnMusbRitykRik+aHnh0hWzF2caAv8uilyf7s tOrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WGHVlF3B; 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 b17-20020a170902d51100b001ab089f7319si8226213plg.52.2023.05.08.04.53.32; Mon, 08 May 2023 04:53:45 -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=WGHVlF3B; 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 S233491AbjEHLCv (ORCPT + 99 others); Mon, 8 May 2023 07:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235451AbjEHLCh (ORCPT ); Mon, 8 May 2023 07:02:37 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE092E80E; Mon, 8 May 2023 04:01:25 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3486Eqs2025662; Mon, 8 May 2023 11:01:20 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=30YV3GSfUJH7uuAX8OaPEaPxhsD0B30A4xbCT71CEQo=; b=WGHVlF3BsyIuV/3SBrU26+mSJHJfuxCpxS0A4EPFCSIZPqVCmu2edkCUpANl261nQVDH IJKmmANwNZ2pWLDEwsGtr4OKjv/o5iPw/wWd56LwUGXjAhHaf5X5IY9GUfxY6ASRZ3m4 S7VeeZMEx/2JaEV6u7tCLCLPL5fh10l2IXG1QMBk7b7gBL+rWaVfmeyX0jx029Uvhpo2 oaV9CEdyxq5IbyNTvk1eM7ogRngQ2qIkQtKWrUafeBrHBRF/W8T80mvbJMvq9rFoKIuS +4wlbkvPEuvB6I/mHdNz7kKo1Oeaz+uzMy/4CCUpc/frjFVMKz7t+9SHL7Sxln39tOqz Lg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qdf4b3ce1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 May 2023 11:01:20 +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 348B1J0P008879 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 8 May 2023 11:01:19 GMT Received: from [10.216.33.39] (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; Mon, 8 May 2023 04:01:14 -0700 Message-ID: <62a80dec-91ff-8a07-9818-7207a08a35b3@quicinc.com> Date: Mon, 8 May 2023 16:31:11 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH 1/4] clk: qcom: branch: Extend the invert logic for branch2 clocks Content-Language: en-US To: Stephen Boyd , Andy Gross , "Bjorn Andersson" , Krzysztof Kozlowski , Michael Turquette , Richard Cochran , "Rob Herring" CC: , Imran Shaik , , , , , , References: <20230419133013.2563-1-quic_tdas@quicinc.com> <20230419133013.2563-2-quic_tdas@quicinc.com> <0dc457cbd13ea76a3aa3c70b2a31a537.sboyd@kernel.org> From: Taniya Das In-Reply-To: <0dc457cbd13ea76a3aa3c70b2a31a537.sboyd@kernel.org> 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 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-ORIG-GUID: kQ3XYs3uLOipgrKCKIHyYStYliBRUIOY X-Proofpoint-GUID: kQ3XYs3uLOipgrKCKIHyYStYliBRUIOY 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-05-08_08,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 adultscore=0 impostorscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305080075 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, 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 Hello Stephen, Thanks for your review. On 4/20/2023 3:07 AM, Stephen Boyd wrote: > Quoting Taniya Das (2023-04-19 06:30:10) >> 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; > > Do these clks have a NOC_FSM_STATUS bit? I think it would be better to > make a local variable for the val we're looking for, and then test for > that. We may need a mask as well, but the idea is to not duplicate the > test and return from multiple places. > Clocks which has invert status doesn't have NOC_FSM_STATUS bit. Will remove the multiple returns in next patch. >> } else { >> + if (invert) >> + return (val & BRANCH_CLK_OFF) == 0; >> + >> return val & BRANCH_CLK_OFF; >> } > > While at it, I'd get rid of this else and de-indent the code because if > we're 'enabling' we'll return from the function regardless. Yes, Stephen, will take care in the next patch. -- Thanks & Regards, Taniya Das.