Message ID | 20230113143647.14961-7-quic_devipriy@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp313449wrt; Fri, 13 Jan 2023 06:58:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXZyjP4q1NpuF9QPNuWGuN32F6+S29BNUaBodTgF/RDVOPzKN0PubNr9X72QD+T/daaGDp X-Received: by 2002:a17:902:db0e:b0:194:5ff8:a3b0 with SMTP id m14-20020a170902db0e00b001945ff8a3b0mr8765638plx.7.1673621889754; Fri, 13 Jan 2023 06:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673621889; cv=none; d=google.com; s=arc-20160816; b=DK8Kd3sY/41iErEdDgrsDm8zwcnIGdej8B4blk4ZpL9eK44BDtsVnbaJwePY74UzMQ Cz/IyuUi2HYaL6F/oQtJvkE739DtgW+jzPHz0L/O8RWBLlO0KguYCJyQ/udw4BKlWvQm /3s/Z2c1ADvU5hhTNBa+RElNMDFGM5P+usv5F/0YGBbicru+PavL4+xbO9ThOrHA5bHQ FSfUShHfrq2mgOc6iHLvQ777CgqXD3GZ1G9LOoai2QXoIhRaSJyVBwthf0kE5wP7fqD5 O3jpa5rAJn/n+3nN+ARJeHRBYISCUZ4Y/MYgh6iUm70fEku7r4OSdC6PsnLAvIesDD2+ npoQ== 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=TIzwL21/6Eec7RTfa/nt4grL8psh5AsYyGkeDqti/xg=; b=in4RdwAxHJHeKtR/F0GbjeLQEg3OsZaetdK5LZ4ZoexsnXGMUm1P7bxsiVWBbLS9d7 c8VBTS8C/3dQhycfTToUlC0XC2VLKYjPW4CTp1Kt9235TmNa37B6WdeDwB86uN4UjVDz tuJlZ/62cbWAxLw6Awmhmyj2/kZ8TadM0oNFLPbm1+uE0diJcv7nTG8YbNscrnKFTATh xdBnYbMOezvwdtBo5VbSJ7Zrn9AS1yPSqNhwP/1GMH8gt1wbt/H/Y/jogMcHcRbjwOEe HACkoCjq0xSiY2K6rQXpUyJpFmajj6xuIdK9LPJvv8DqlsSqG+xQK/V9AvIz8jKkSOyj eKow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="fBGu/Gl2"; 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 t13-20020a170902e84d00b001944c51f9d6si8130407plg.123.2023.01.13.06.57.56; Fri, 13 Jan 2023 06:58:09 -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="fBGu/Gl2"; 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 S229607AbjAMOxM (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Fri, 13 Jan 2023 09:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjAMOwg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Jan 2023 09:52:36 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 859E47EC88; Fri, 13 Jan 2023 06:38:26 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DDgCvE018314; Fri, 13 Jan 2023 14:37:58 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=TIzwL21/6Eec7RTfa/nt4grL8psh5AsYyGkeDqti/xg=; b=fBGu/Gl2vYLFq1BbDfpgwDBZ056Z1Pw9KFUie2sPX5lhCwGoOTLCAh74Bq0dNhq0Foz4 uL0CRw1bPfqR0FaHSO8X25E8AdakIAfMGR18WrOwJHSkH8UbVWXsf575ntFdpQznNGPM DPr+EPMtOy1cvMpA8ohXLitEyRgu3rHHgyDpa82CTOv6GRFiQ2hFYDJew+rAOyet24R5 fT++GzrRF/7it2VEH96RuMABehZpMyh/dyCR940f2uHjuQ9N2PQ3O87f5BMwB3qwJRQp iugZ/rRRhSQX+On0kpeZAthplcpWnU4H/LTYru04Fr28E8Yq/EWqy5sggXn+9Qhae4WO tQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3n2jghtys8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 14:37:58 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 30DEbvsE000505 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 14:37:57 GMT Received: from devipriy-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 06:37:49 -0800 From: devi priya <quic_devipriy@quicinc.com> To: <agross@kernel.org>, <andersson@kernel.org>, <konrad.dybcio@linaro.org>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <mturquette@baylibre.com>, <sboyd@kernel.org>, <jassisinghbrar@gmail.com>, <catalin.marinas@arm.com>, <will@kernel.org>, <shawnguo@kernel.org>, <arnd@arndb.de>, <marcel.ziswiler@toradex.com>, <dmitry.baryshkov@linaro.org>, <nfraprado@collabora.com>, <broonie@kernel.org>, <linux-arm-msm@vger.kernel.org>, <linux-clk@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org> CC: <quic_srichara@quicinc.com>, <quic_gokulsri@quicinc.com>, <quic_sjaganat@quicinc.com>, <quic_kathirav@quicinc.com>, <quic_arajkuma@quicinc.com>, <quic_anusha@quicinc.com>, <quic_poovendh@quicinc.com> Subject: [PATCH 6/6] clk: qcom: Fix APSS PLL and RCG Configuration Date: Fri, 13 Jan 2023 20:06:47 +0530 Message-ID: <20230113143647.14961-7-quic_devipriy@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230113143647.14961-1-quic_devipriy@quicinc.com> References: <20230113143647.14961-1-quic_devipriy@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain 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: dfOSr7wANXk6JETj8MnbsuzSbz2-IxvR X-Proofpoint-ORIG-GUID: dfOSr7wANXk6JETj8MnbsuzSbz2-IxvR 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_06,2023-01-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 phishscore=0 clxscore=1015 bulkscore=0 impostorscore=0 mlxlogscore=922 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130096 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754919746977530790?= X-GMAIL-MSGID: =?utf-8?q?1754919746977530790?= |
Series |
Add APSS clock controller support for IPQ9574
|
|
Commit Message
Devi Priya
Jan. 13, 2023, 2:36 p.m. UTC
Included CLK_IS_CRITICAL flag which helps to properly enable the APSS PLL during bootup. clk_rcg2_ops should be used for APSS clock RCG, as other ops will not configure the RCG register Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> Signed-off-by: devi priya <quic_devipriy@quicinc.com> --- drivers/clk/qcom/apss-ipq-pll.c | 1 + drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-)
Comments
On 13.01.2023 15:36, devi priya wrote: > Included CLK_IS_CRITICAL flag which helps to properly enable > the APSS PLL during bootup. Please describe the issue and not only the user-visible impact it makes. Does the PLL get shut down by clk_ignore_unused? Maybe you would be interested in the sync_state changes that landed in recent -next that may solve it for you? I don't think it should be always-on, as you have an alternate source for low power modes, adding CLK_IS_CRITICAL will keep the PLL enabled even if you're not using it. > clk_rcg2_ops should be used for APSS clock RCG, as other ops > will not configure the RCG register RCG register meaning RCG register*s*, meaning in this case M/N/D which would be required for proper rate setting and not only input switching (which arguably doesn't seem to be of much concern on a single-parent clock)? This all is not obvious.. Konrad > > Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> > Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> > Signed-off-by: devi priya <quic_devipriy@quicinc.com> > --- > drivers/clk/qcom/apss-ipq-pll.c | 1 + > drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c > index dd0c01bf5a98..75486a124fcd 100644 > --- a/drivers/clk/qcom/apss-ipq-pll.c > +++ b/drivers/clk/qcom/apss-ipq-pll.c > @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { > }, > .num_parents = 1, > .ops = &clk_alpha_pll_huayra_ops, > + .flags = CLK_IS_CRITICAL, > }, > }, > }; > diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c > index f2f502e2d5a4..0d0e7196a4dc 100644 > --- a/drivers/clk/qcom/apss-ipq6018.c > +++ b/drivers/clk/qcom/apss-ipq6018.c > @@ -33,15 +33,21 @@ static const struct parent_map parents_apcs_alias0_clk_src_map[] = { > { P_APSS_PLL_EARLY, 5 }, > }; > > +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { > + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, > + { } > +}; > + > static struct clk_rcg2 apcs_alias0_clk_src = { > .cmd_rcgr = 0x0050, > + .freq_tbl = ftbl_apcs_alias0_clk_src, > .hid_width = 5, > .parent_map = parents_apcs_alias0_clk_src_map, > .clkr.hw.init = &(struct clk_init_data){ > .name = "apcs_alias0_clk_src", > .parent_data = parents_apcs_alias0_clk_src, > .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), > - .ops = &clk_rcg2_mux_closest_ops, > + .ops = &clk_rcg2_ops, > .flags = CLK_SET_RATE_PARENT, > }, > };
On 13. 01. 2023. 16:20, Konrad Dybcio wrote: > > On 13.01.2023 15:36, devi priya wrote: >> Included CLK_IS_CRITICAL flag which helps to properly enable >> the APSS PLL during bootup. > Please describe the issue and not only the user-visible impact it > makes. Does the PLL get shut down by clk_ignore_unused? Maybe you > would be interested in the sync_state changes that landed in recent > -next that may solve it for you? > > I don't think it should be always-on, as you have an alternate source > for low power modes, adding CLK_IS_CRITICAL will keep the PLL enabled > even if you're not using it. I have the same opinion, as this is working fine on IPQ6018 and IPQ8074 and I have not experienced any issues with it. > >> clk_rcg2_ops should be used for APSS clock RCG, as other ops >> will not configure the RCG register > RCG register meaning RCG register*s*, meaning in this case M/N/D > which would be required for proper rate setting and not only input > switching (which arguably doesn't seem to be of much concern on a > single-parent clock)? This all is not obvious.. Same question from me as well, why do you need clk_rcg2_ops with a dummy frequency table since this is just a mux using RCG2 control bits? Regards, Robert > > Konrad >> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> >> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> >> Signed-off-by: devi priya <quic_devipriy@quicinc.com> >> --- >> drivers/clk/qcom/apss-ipq-pll.c | 1 + >> drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- >> 2 files changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c >> index dd0c01bf5a98..75486a124fcd 100644 >> --- a/drivers/clk/qcom/apss-ipq-pll.c >> +++ b/drivers/clk/qcom/apss-ipq-pll.c >> @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { >> }, >> .num_parents = 1, >> .ops = &clk_alpha_pll_huayra_ops, >> + .flags = CLK_IS_CRITICAL, >> }, >> }, >> }; >> diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c >> index f2f502e2d5a4..0d0e7196a4dc 100644 >> --- a/drivers/clk/qcom/apss-ipq6018.c >> +++ b/drivers/clk/qcom/apss-ipq6018.c >> @@ -33,15 +33,21 @@ static const struct parent_map parents_apcs_alias0_clk_src_map[] = { >> { P_APSS_PLL_EARLY, 5 }, >> }; >> >> +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { >> + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, >> + { } >> +}; >> + >> static struct clk_rcg2 apcs_alias0_clk_src = { >> .cmd_rcgr = 0x0050, >> + .freq_tbl = ftbl_apcs_alias0_clk_src, >> .hid_width = 5, >> .parent_map = parents_apcs_alias0_clk_src_map, >> .clkr.hw.init = &(struct clk_init_data){ >> .name = "apcs_alias0_clk_src", >> .parent_data = parents_apcs_alias0_clk_src, >> .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), >> - .ops = &clk_rcg2_mux_closest_ops, >> + .ops = &clk_rcg2_ops, >> .flags = CLK_SET_RATE_PARENT, >> }, >> }; >
Thanks for taking time to review the patch On 1/13/2023 8:50 PM, Konrad Dybcio wrote: > > > On 13.01.2023 15:36, devi priya wrote: >> Included CLK_IS_CRITICAL flag which helps to properly enable >> the APSS PLL during bootup. > Please describe the issue and not only the user-visible impact it > makes. Does the PLL get shut down by clk_ignore_unused? Maybe you > would be interested in the sync_state changes that landed in recent > -next that may solve it for you? > > I don't think it should be always-on, as you have an alternate source > for low power modes, adding CLK_IS_CRITICAL will keep the PLL enabled > even if you're not using it. Yeah, got it. Will drop the critical flag > >> clk_rcg2_ops should be used for APSS clock RCG, as other ops >> will not configure the RCG register > RCG register meaning RCG register*s*, meaning in this case M/N/D > which would be required for proper rate setting and not only input > switching (which arguably doesn't seem to be of much concern on a > single-parent clock)? This all is not obvious.. > > Konrad The source selection is done by configuring the RCGR config register with the source entry (P_APSS_PLL_EARLY) added to the frequency table. Proper rate is achieved by configuring the PLL and hence M/N/D values are not configured >> >> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> >> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> >> Signed-off-by: devi priya <quic_devipriy@quicinc.com> >> --- >> drivers/clk/qcom/apss-ipq-pll.c | 1 + >> drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- >> 2 files changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c >> index dd0c01bf5a98..75486a124fcd 100644 >> --- a/drivers/clk/qcom/apss-ipq-pll.c >> +++ b/drivers/clk/qcom/apss-ipq-pll.c >> @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { >> }, >> .num_parents = 1, >> .ops = &clk_alpha_pll_huayra_ops, >> + .flags = CLK_IS_CRITICAL, >> }, >> }, >> }; >> diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c >> index f2f502e2d5a4..0d0e7196a4dc 100644 >> --- a/drivers/clk/qcom/apss-ipq6018.c >> +++ b/drivers/clk/qcom/apss-ipq6018.c >> @@ -33,15 +33,21 @@ static const struct parent_map parents_apcs_alias0_clk_src_map[] = { >> { P_APSS_PLL_EARLY, 5 }, >> }; >> >> +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { >> + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, >> + { } >> +}; >> + >> static struct clk_rcg2 apcs_alias0_clk_src = { >> .cmd_rcgr = 0x0050, >> + .freq_tbl = ftbl_apcs_alias0_clk_src, >> .hid_width = 5, >> .parent_map = parents_apcs_alias0_clk_src_map, >> .clkr.hw.init = &(struct clk_init_data){ >> .name = "apcs_alias0_clk_src", >> .parent_data = parents_apcs_alias0_clk_src, >> .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), >> - .ops = &clk_rcg2_mux_closest_ops, >> + .ops = &clk_rcg2_ops, >> .flags = CLK_SET_RATE_PARENT, >> }, >> }; Best Regards, Devi Priya
Thanks for taking time to review the patch! On 1/13/2023 9:47 PM, Robert Marko wrote: > > On 13. 01. 2023. 16:20, Konrad Dybcio wrote: >> >> On 13.01.2023 15:36, devi priya wrote: >>> Included CLK_IS_CRITICAL flag which helps to properly enable >>> the APSS PLL during bootup. >> Please describe the issue and not only the user-visible impact it >> makes. Does the PLL get shut down by clk_ignore_unused? Maybe you >> would be interested in the sync_state changes that landed in recent >> -next that may solve it for you? >> >> I don't think it should be always-on, as you have an alternate source >> for low power modes, adding CLK_IS_CRITICAL will keep the PLL enabled >> even if you're not using it. > > I have the same opinion, as this is working fine on IPQ6018 and IPQ8074 > and I have not experienced any issues with it. > Sure, will drop the critical flag >> >>> clk_rcg2_ops should be used for APSS clock RCG, as other ops >>> will not configure the RCG register >> RCG register meaning RCG register*s*, meaning in this case M/N/D >> which would be required for proper rate setting and not only input >> switching (which arguably doesn't seem to be of much concern on a >> single-parent clock)? This all is not obvious.. > Same question from me as well, why do you need clk_rcg2_ops with > a dummy frequency table since this is just a mux using RCG2 control > bits? > > Regards, > Robert >> The RCGR is used for source selection whereas the rate setting is done by configuring the PLL. The source is configured in the RCGR using the source entry (P_APSS_PLL_EARLY) added to the frequency table. >> Konrad >>> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> >>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> >>> Signed-off-by: devi priya <quic_devipriy@quicinc.com> >>> --- >>> drivers/clk/qcom/apss-ipq-pll.c | 1 + >>> drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- >>> 2 files changed, 8 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/clk/qcom/apss-ipq-pll.c >>> b/drivers/clk/qcom/apss-ipq-pll.c >>> index dd0c01bf5a98..75486a124fcd 100644 >>> --- a/drivers/clk/qcom/apss-ipq-pll.c >>> +++ b/drivers/clk/qcom/apss-ipq-pll.c >>> @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { >>> }, >>> .num_parents = 1, >>> .ops = &clk_alpha_pll_huayra_ops, >>> + .flags = CLK_IS_CRITICAL, >>> }, >>> }, >>> }; >>> diff --git a/drivers/clk/qcom/apss-ipq6018.c >>> b/drivers/clk/qcom/apss-ipq6018.c >>> index f2f502e2d5a4..0d0e7196a4dc 100644 >>> --- a/drivers/clk/qcom/apss-ipq6018.c >>> +++ b/drivers/clk/qcom/apss-ipq6018.c >>> @@ -33,15 +33,21 @@ static const struct parent_map >>> parents_apcs_alias0_clk_src_map[] = { >>> { P_APSS_PLL_EARLY, 5 }, >>> }; >>> +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { >>> + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, >>> + { } >>> +}; >>> + >>> static struct clk_rcg2 apcs_alias0_clk_src = { >>> .cmd_rcgr = 0x0050, >>> + .freq_tbl = ftbl_apcs_alias0_clk_src, >>> .hid_width = 5, >>> .parent_map = parents_apcs_alias0_clk_src_map, >>> .clkr.hw.init = &(struct clk_init_data){ >>> .name = "apcs_alias0_clk_src", >>> .parent_data = parents_apcs_alias0_clk_src, >>> .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), >>> - .ops = &clk_rcg2_mux_closest_ops, >>> + .ops = &clk_rcg2_ops, >>> .flags = CLK_SET_RATE_PARENT, >>> }, >>> }; >> Best Regards, Devi Priya
On 31/01/2023 11:17, Devi Priya wrote: > Thanks for taking time to review the patch > > On 1/13/2023 8:50 PM, Konrad Dybcio wrote: >> >> >> On 13.01.2023 15:36, devi priya wrote: >>> Included CLK_IS_CRITICAL flag which helps to properly enable >>> the APSS PLL during bootup. >> Please describe the issue and not only the user-visible impact it >> makes. Does the PLL get shut down by clk_ignore_unused? Maybe you >> would be interested in the sync_state changes that landed in recent >> -next that may solve it for you? >> >> I don't think it should be always-on, as you have an alternate source >> for low power modes, adding CLK_IS_CRITICAL will keep the PLL enabled >> even if you're not using it. > Yeah, got it. Will drop the critical flag >> >>> clk_rcg2_ops should be used for APSS clock RCG, as other ops >>> will not configure the RCG register >> RCG register meaning RCG register*s*, meaning in this case M/N/D >> which would be required for proper rate setting and not only input >> switching (which arguably doesn't seem to be of much concern on a >> single-parent clock)? This all is not obvious.. >> >> Konrad > The source selection is done by configuring the RCGR config register > with the source entry (P_APSS_PLL_EARLY) added to the frequency table. > Proper rate is achieved by configuring the PLL and hence M/N/D values > are not configured But the clk_rcg2_mux_closest_ops also programs the parent for the clock. So from your description it isn't obvious what is wrong with the current _ops used for the clock. >>> >>> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> >>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> >>> Signed-off-by: devi priya <quic_devipriy@quicinc.com> >>> --- >>> drivers/clk/qcom/apss-ipq-pll.c | 1 + >>> drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- >>> 2 files changed, 8 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/clk/qcom/apss-ipq-pll.c >>> b/drivers/clk/qcom/apss-ipq-pll.c >>> index dd0c01bf5a98..75486a124fcd 100644 >>> --- a/drivers/clk/qcom/apss-ipq-pll.c >>> +++ b/drivers/clk/qcom/apss-ipq-pll.c >>> @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { >>> }, >>> .num_parents = 1, >>> .ops = &clk_alpha_pll_huayra_ops, >>> + .flags = CLK_IS_CRITICAL, >>> }, >>> }, >>> }; >>> diff --git a/drivers/clk/qcom/apss-ipq6018.c >>> b/drivers/clk/qcom/apss-ipq6018.c >>> index f2f502e2d5a4..0d0e7196a4dc 100644 >>> --- a/drivers/clk/qcom/apss-ipq6018.c >>> +++ b/drivers/clk/qcom/apss-ipq6018.c >>> @@ -33,15 +33,21 @@ static const struct parent_map >>> parents_apcs_alias0_clk_src_map[] = { >>> { P_APSS_PLL_EARLY, 5 }, >>> }; >>> +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { >>> + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, >>> + { } >>> +}; >>> + >>> static struct clk_rcg2 apcs_alias0_clk_src = { >>> .cmd_rcgr = 0x0050, >>> + .freq_tbl = ftbl_apcs_alias0_clk_src, >>> .hid_width = 5, >>> .parent_map = parents_apcs_alias0_clk_src_map, >>> .clkr.hw.init = &(struct clk_init_data){ >>> .name = "apcs_alias0_clk_src", >>> .parent_data = parents_apcs_alias0_clk_src, >>> .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), >>> - .ops = &clk_rcg2_mux_closest_ops, >>> + .ops = &clk_rcg2_ops, >>> .flags = CLK_SET_RATE_PARENT, >>> }, >>> }; > Best Regards, > Devi Priya
On 1/31/2023 3:10 PM, Dmitry Baryshkov wrote: > On 31/01/2023 11:17, Devi Priya wrote: >> Thanks for taking time to review the patch >> >> On 1/13/2023 8:50 PM, Konrad Dybcio wrote: >>> >>> >>> On 13.01.2023 15:36, devi priya wrote: >>>> Included CLK_IS_CRITICAL flag which helps to properly enable >>>> the APSS PLL during bootup. >>> Please describe the issue and not only the user-visible impact it >>> makes. Does the PLL get shut down by clk_ignore_unused? Maybe you >>> would be interested in the sync_state changes that landed in recent >>> -next that may solve it for you? >>> >>> I don't think it should be always-on, as you have an alternate source >>> for low power modes, adding CLK_IS_CRITICAL will keep the PLL enabled >>> even if you're not using it. >> Yeah, got it. Will drop the critical flag >>> >>>> clk_rcg2_ops should be used for APSS clock RCG, as other ops >>>> will not configure the RCG register >>> RCG register meaning RCG register*s*, meaning in this case M/N/D >>> which would be required for proper rate setting and not only input >>> switching (which arguably doesn't seem to be of much concern on a >>> single-parent clock)? This all is not obvious.. >>> >>> Konrad >> The source selection is done by configuring the RCGR config register >> with the source entry (P_APSS_PLL_EARLY) added to the frequency table. >> Proper rate is achieved by configuring the PLL and hence M/N/D values >> are not configured > > But the clk_rcg2_mux_closest_ops also programs the parent for the clock. > So from your description it isn't obvious what is wrong with the current > _ops used for the clock. > Okay, understood & agreed. Will re-verify it once and update it accordingly in V2 >>>> >>>> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com> >>>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com> >>>> Signed-off-by: devi priya <quic_devipriy@quicinc.com> >>>> --- >>>> drivers/clk/qcom/apss-ipq-pll.c | 1 + >>>> drivers/clk/qcom/apss-ipq6018.c | 8 +++++++- >>>> 2 files changed, 8 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/clk/qcom/apss-ipq-pll.c >>>> b/drivers/clk/qcom/apss-ipq-pll.c >>>> index dd0c01bf5a98..75486a124fcd 100644 >>>> --- a/drivers/clk/qcom/apss-ipq-pll.c >>>> +++ b/drivers/clk/qcom/apss-ipq-pll.c >>>> @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { >>>> }, >>>> .num_parents = 1, >>>> .ops = &clk_alpha_pll_huayra_ops, >>>> + .flags = CLK_IS_CRITICAL, >>>> }, >>>> }, >>>> }; >>>> diff --git a/drivers/clk/qcom/apss-ipq6018.c >>>> b/drivers/clk/qcom/apss-ipq6018.c >>>> index f2f502e2d5a4..0d0e7196a4dc 100644 >>>> --- a/drivers/clk/qcom/apss-ipq6018.c >>>> +++ b/drivers/clk/qcom/apss-ipq6018.c >>>> @@ -33,15 +33,21 @@ static const struct parent_map >>>> parents_apcs_alias0_clk_src_map[] = { >>>> { P_APSS_PLL_EARLY, 5 }, >>>> }; >>>> +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { >>>> + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, >>>> + { } >>>> +}; >>>> + >>>> static struct clk_rcg2 apcs_alias0_clk_src = { >>>> .cmd_rcgr = 0x0050, >>>> + .freq_tbl = ftbl_apcs_alias0_clk_src, >>>> .hid_width = 5, >>>> .parent_map = parents_apcs_alias0_clk_src_map, >>>> .clkr.hw.init = &(struct clk_init_data){ >>>> .name = "apcs_alias0_clk_src", >>>> .parent_data = parents_apcs_alias0_clk_src, >>>> .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), >>>> - .ops = &clk_rcg2_mux_closest_ops, >>>> + .ops = &clk_rcg2_ops, >>>> .flags = CLK_SET_RATE_PARENT, >>>> }, >>>> }; >> Best Regards, >> Devi Priya > Best Regards, Devi Priya
diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c index dd0c01bf5a98..75486a124fcd 100644 --- a/drivers/clk/qcom/apss-ipq-pll.c +++ b/drivers/clk/qcom/apss-ipq-pll.c @@ -33,6 +33,7 @@ static struct clk_alpha_pll ipq_pll = { }, .num_parents = 1, .ops = &clk_alpha_pll_huayra_ops, + .flags = CLK_IS_CRITICAL, }, }, }; diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c index f2f502e2d5a4..0d0e7196a4dc 100644 --- a/drivers/clk/qcom/apss-ipq6018.c +++ b/drivers/clk/qcom/apss-ipq6018.c @@ -33,15 +33,21 @@ static const struct parent_map parents_apcs_alias0_clk_src_map[] = { { P_APSS_PLL_EARLY, 5 }, }; +static const struct freq_tbl ftbl_apcs_alias0_clk_src[] = { + { .src = P_APSS_PLL_EARLY, .pre_div = 1 }, + { } +}; + static struct clk_rcg2 apcs_alias0_clk_src = { .cmd_rcgr = 0x0050, + .freq_tbl = ftbl_apcs_alias0_clk_src, .hid_width = 5, .parent_map = parents_apcs_alias0_clk_src_map, .clkr.hw.init = &(struct clk_init_data){ .name = "apcs_alias0_clk_src", .parent_data = parents_apcs_alias0_clk_src, .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src), - .ops = &clk_rcg2_mux_closest_ops, + .ops = &clk_rcg2_ops, .flags = CLK_SET_RATE_PARENT, }, };