Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2424826rdb; Tue, 14 Nov 2023 23:33:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpRY5e1yrnlM7W8Bs/emXrX5zRjdCwJTCnR1weSEBt+2+e27VIdtFGFlPia//R3xs9s2kr X-Received: by 2002:a17:90b:1c0c:b0:280:74fc:ac2c with SMTP id oc12-20020a17090b1c0c00b0028074fcac2cmr11127404pjb.13.1700033609324; Tue, 14 Nov 2023 23:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700033609; cv=none; d=google.com; s=arc-20160816; b=0IsuL3+gFIMlJRanrGb3Jvd1wg89AiMYAFNNQAIjuaC4FMGImgTfW59sOO/Jp84j5j X9wcAAX8z/GXVlreMZffpe+S5wnh2qsatEjO43RLI37z57uHxoIHa09cLAU15SatRM+n AW+udh1CcOGZ7naxa1MEU6s9jfy5PcIKBa+0D7g5AjS38LlbGFi2yVALboRF6H64AL2u pbAZNJeGlRB9K1+n/jERm8ryBwRKuoZbl76i1L3r4KwkXpwIUhQvg7OCZlfxqeG6A9UJ RZUI+3hrIHSL6HSGQz+RLFn2CbNb3kxezPZxb7rvRBInvR5GfnVJ74sO1oF0MeGk3USz /KqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:content-language :thread-index:content-transfer-encoding:mime-version:message-id:date :subject:in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=WaeOfoNTbfhSobyw3fHef25B5qOSM0ie2Tlm8/7W3FA=; fh=jso3cjszFI/cBINZayHcTrOVqMWO9Br6k+DhaeWjMz8=; b=kzyA7FWOVsDZtj3DvwRN3ybNb3fS9l2oAqAyR5Ytycy1XALOyicqRhO7zZfxY+09m7 C+Azaps5CvS3HyiRByw1IQ+vfbnSNQF0GUQOF8XggkhR0RKQD7ZD0D5/wJ8I7Vky2SP+ mTDvPNpK/E+RbjCec5d+qvu5bx5sVVz7Y+xbgwB/mRWKd8H7zP0imT/Cg0408ctRcSOm Um9kknczvLScjhWmFG+2eRg1tA523B2x0Bw0vLyWkpmYddVphPq62yrK1cokxsImi02I MsPBSEugrHrPGIX3yQkDUUPLTShi7wkannKWbPnTvz8ONX3ddFazPnszQ7FkFOX/98jH 3igQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qWVzVo2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h17-20020a17090ac39100b0028001292940si14433036pjt.68.2023.11.14.23.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 23:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qWVzVo2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D59E1812D21B; Tue, 14 Nov 2023 23:33:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234630AbjKOHdU (ORCPT + 99 others); Wed, 15 Nov 2023 02:33:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjKOHdT (ORCPT ); Wed, 15 Nov 2023 02:33:19 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05673C1 for ; Tue, 14 Nov 2023 23:33:12 -0800 (PST) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20231115073311epoutp0196c31a7aa6e15526c32020360496c871~Xu4s_cwIT0462904629epoutp01s for ; Wed, 15 Nov 2023 07:33:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20231115073311epoutp0196c31a7aa6e15526c32020360496c871~Xu4s_cwIT0462904629epoutp01s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1700033591; bh=WaeOfoNTbfhSobyw3fHef25B5qOSM0ie2Tlm8/7W3FA=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=qWVzVo2fq5JeNWTYMDRT7qFQ3g3J8xsuo5UCcIkFbuj0HzBVmNFPX3t3hZwB+AAJt kllr4igbyZim6+mXjMPZ14jKIeJnHqcsYN42Ydww/sQU7UbY/TSoZIYvUFiMGYux0m K9N/7vuK4OayQmP8B5pYdFf5szJbTiwOFIldHgVs= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20231115073310epcas5p3c4fe7c3d699636bc9624c0dc62c695d5~Xu4sioTCH2420624206epcas5p3U; Wed, 15 Nov 2023 07:33:10 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.179]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4SVZdc5jQKz4x9Q7; Wed, 15 Nov 2023 07:33:08 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 03.36.08567.43474556; Wed, 15 Nov 2023 16:33:08 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20231115063748epcas5p4fe34caf919fc11d8f22e4cf8cd34f543~XuIWiCYsX0656906569epcas5p4A; Wed, 15 Nov 2023 06:37:48 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231115063748epsmtrp116632c61935100634a84817343149e82~XuIWhRhmg1243112431epsmtrp1T; Wed, 15 Nov 2023 06:37:48 +0000 (GMT) X-AuditID: b6c32a44-617fd70000002177-14-65547434c348 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F1.28.08755.C3764556; Wed, 15 Nov 2023 15:37:48 +0900 (KST) Received: from FDSFTE462 (unknown [107.122.81.248]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231115063746epsmtip25dc2e9b186050cabb5c13a51eabd0048~XuIUmmknM0739707397epsmtip2Q; Wed, 15 Nov 2023 06:37:46 +0000 (GMT) From: "Shradha Todi" To: "'Alim Akhtar'" , , , , , , Cc: , , , , In-Reply-To: <029a01da1334$dc1016c0$94304440$@samsung.com> Subject: RE: [PATCH] PCI: exynos: Adapt to clk_bulk_* APIs Date: Wed, 15 Nov 2023 12:07:44 +0530 Message-ID: <000a01da178e$3f3e18c0$bdba4a40$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFlrvPEaqAl+ZjspMpXVx4MiN0lSgK7wbyrAgqzZeuxPYqDUA== Content-Language: en-in X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAJsWRmVeSWpSXmKPExsWy7bCmhq5JSUiqwbcOHYsH87axWSxpyrBY 8WUmu8Xe11vZLRp6frNabHp8jdXi8q45bBZn5x1ns5hxf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5IzTbuWzO hJpHzpINd/xzrXd8OXSswvTSRyXvuXbFDXF3NydPMfsntnG9hZfm2iaV+wXMK5rrvTazKbEU ZyQaajEXFScCAGdMFJk7AwAA X-CMS-MailID: 20231115063748epcas5p4fe34caf919fc11d8f22e4cf8cd34f543 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231009062222epcas5p36768b75c13c7c79965b5863521361a64 References: <20231009062216.6729-1-shradha.t@samsung.com> <029a01da1334$dc1016c0$94304440$@samsung.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 23:33:28 -0800 (PST) > -----Original Message----- > From: Alim Akhtar =5Bmailto:alim.akhtar=40samsung.com=5D > Sent: 09 November 2023 23:18 > To: 'Shradha Todi' ; jingoohan1=40gmail.com; > lpieralisi=40kernel.org; kw=40linux.com; robh=40kernel.org; > bhelgaas=40google.com; krzysztof.kozlowski=40linaro.org > Cc: linux-pci=40vger.kernel.org; linux-arm-kernel=40lists.infradead.org; = linux- > samsung-soc=40vger.kernel.org; linux-kernel=40vger.kernel.org; > pankaj.dubey=40samsung.com > Subject: RE: =5BPATCH=5D PCI: exynos: Adapt to clk_bulk_* APIs >=20 > Hi Shradha >=20 > > -----Original Message----- > > From: Shradha Todi > > Sent: Monday, October 9, 2023 11:52 AM > > To: jingoohan1=40gmail.com; lpieralisi=40kernel.org; kw=40linux.com; > > robh=40kernel.org; bhelgaas=40google.com; krzysztof.kozlowski=40linaro.= org; > > alim.akhtar=40samsung.com > > Cc: linux-pci=40vger.kernel.org; linux-arm-kernel=40lists.infradead.org= ; > > linux- samsung-soc=40vger.kernel.org; linux-kernel=40vger.kernel.org; > > pankaj.dubey=40samsung.com; Shradha Todi > > Subject: =5BPATCH=5D PCI: exynos: Adapt to clk_bulk_* APIs > > > > There is no need to hardcode the clock info in the driver as driver > > can rely on the devicetree to supply the clocks required for the > > functioning of the peripheral. Get rid of the static clock info and > > obtain the platform supplied clocks. The total number of clocks > > supplied is obtained using the > > devm_clk_bulk_get_all() API and used for the rest of the clk_bulk_* API= s. > > > > Signed-off-by: Shradha Todi > > --- > > drivers/pci/controller/dwc/pci-exynos.c =7C 46 > > ++++++------------------- > > 1 file changed, 11 insertions(+), 35 deletions(-) > > > > diff --git a/drivers/pci/controller/dwc/pci-exynos.c > > b/drivers/pci/controller/dwc/pci-exynos.c > > index 9e42cfcd99cc..023cf41fccd7 100644 > > --- a/drivers/pci/controller/dwc/pci-exynos.c > > +++ b/drivers/pci/controller/dwc/pci-exynos.c > > =40=40 -54,8 +54,8 =40=40 > > struct exynos_pcie =7B > > struct dw_pcie pci; > > void __iomem *elbi_base; > > - struct clk *clk; > > - struct clk *bus_clk; > > + struct clk_bulk_data *clks; > > + int clk_cnt; > > struct phy *phy; > > struct regulator_bulk_data supplies=5B2=5D; > > =7D; > > =40=40 -65,30 +65,18 =40=40 static int exynos_pcie_init_clk_resources(s= truct > > exynos_pcie *ep) > > struct device *dev =3D ep->pci.dev; > > int ret; > > > > - ret =3D clk_prepare_enable(ep->clk); > > - if (ret) =7B > > - dev_err(dev, =22cannot enable pcie rc clock=22); > > + ret =3D devm_clk_bulk_get_all(dev, &ep->clks); > > + if (ret < 0) > You can checking only for -ve value, what if devm_clk_bulk_get_all() ret= urn > 0? >=20 Thanks for the review=21 Return value of 0 means there were no clocks to get but it does not indicat= e failure. It can mean that the device does not need any clock handling in the driver. =22 clk_bul= k_prepare_enable=22 takes care of num_clks being 0 and returns success anyway. I have seen other driv= ers handling in a similar way. > > return ret; > > - =7D > > > > - ret =3D clk_prepare_enable(ep->bus_clk); > > - if (ret) =7B > > - dev_err(dev, =22cannot enable pcie bus clock=22); > > - goto err_bus_clk; > > - =7D > > + ep->clk_cnt =3D ret; > > > > - return 0; > > - > > -err_bus_clk: > > - clk_disable_unprepare(ep->clk); > > - > > - return ret; > > + return clk_bulk_prepare_enable(ep->clk_cnt, ep->clks); > > =7D > > > > static void exynos_pcie_deinit_clk_resources(struct exynos_pcie *ep) = =7B > > - clk_disable_unprepare(ep->bus_clk); > > - clk_disable_unprepare(ep->clk); > > + clk_bulk_disable_unprepare(ep->clk_cnt, ep->clks); > > =7D > > > > static void exynos_pcie_writel(void __iomem *base, u32 val, u32 reg) > > =40=40 - > > 332,17 +320,9 =40=40 static int exynos_pcie_probe(struct platform_devic= e > > *pdev) > > if (IS_ERR(ep->elbi_base)) > > return PTR_ERR(ep->elbi_base); > > > > - ep->clk =3D devm_clk_get(dev, =22pcie=22); > > - if (IS_ERR(ep->clk)) =7B > > - dev_err(dev, =22Failed to get pcie rc clock=5Cn=22); > > - return PTR_ERR(ep->clk); > > - =7D > > - > > - ep->bus_clk =3D devm_clk_get(dev, =22pcie_bus=22); > > - if (IS_ERR(ep->bus_clk)) =7B > > - dev_err(dev, =22Failed to get pcie bus clock=5Cn=22); > > - return PTR_ERR(ep->bus_clk); > > - =7D > > + ret =3D exynos_pcie_init_clk_resources(ep); > > + if (ret < 0) > > + return ret; > > > > ep->supplies=5B0=5D.supply =3D =22vdd18=22; > > ep->supplies=5B1=5D.supply =3D =22vdd10=22; > > =40=40 -351,10 +331,6 =40=40 static int exynos_pcie_probe(struct > > platform_device > > *pdev) > > if (ret) > > return ret; > > > > - ret =3D exynos_pcie_init_clk_resources(ep); > > - if (ret) > > - return ret; > > - > > ret =3D regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep- > > >supplies); > > if (ret) > > return ret; > > =40=40 -369,8 +345,8 =40=40 static int exynos_pcie_probe(struct > > platform_device > > *pdev) > > > > fail_probe: > > phy_exit(ep->phy); > > - exynos_pcie_deinit_clk_resources(ep); > > regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies); > > + exynos_pcie_deinit_clk_resources(ep); > > > > return ret; > > =7D > > -- > > 2.17.1 >=20