Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4753594pxu; Mon, 21 Dec 2020 23:08:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2R6u/NzC5n8pANhCVz3ovowUu3JhuL9hR6+WcM3DnT27Xwd3RfUop+++Fn4QIYMcQ84z5 X-Received: by 2002:a17:906:1a4e:: with SMTP id j14mr18548618ejf.507.1608620924058; Mon, 21 Dec 2020 23:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608620924; cv=none; d=google.com; s=arc-20160816; b=Y+CdTkuHkLKxrmuqmPpq6qP5Fbok1LwOc6fsziAOQbAuT4f3UYctqrbxDuQwgWRyPv RRZvofn1TxPS4DzxdImusTWz+g+KTKIFtBNONdVgDFWxLND8J8QujznWYiRDnXHRkz93 eBAmetyd6VFjWYFSLLmMIuRyLYNmn+R65fBgO1SoZ5ygv+s6o6i0UoAL3GQZ1gyzsM1Z bwL4QCC6Q25DJeFiw30qFSvhGwzWj30jyDC/biqp5Ex4jijjVb9A4Y9wFS2TzFv67Yzi 8kZpgWuKP10O8CDDmdN6qHi0h8ncIlZy0XtcqbDUMDzu0ajORRZj8PFLKZr53afsIdnj 4F+A== 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=vQYJz6q3QwL2K0Sik8ruQUMB1sjj3ErMTyA3nnEGtE0=; b=qLwhARTQOycd7f/xX1t/AYeoUmQRz61Tk2KYDPcVRGqkbeR1JW0bwc8HCrkX8HtRDo YVJp1kC1zJl6Nvl80kMrmsMjgcR+S0Wtns9gRyUSYr0OsnxYbou0t++/L5NTytJDMoi8 WDVGLmbiGk1NQJmaoiq+6nNL6PuHNqc4WCwdExsA2UIVpji6eDkr8mtJseiJ1vjnTgMD AXLR0lQpuu0VsLL3u29ilDO7fApITW1P0/OV8pxvMqWERsUqsAqsE3vFxyzyumArN9Oh 4dKwu//fAhCAgzxUbKrGyqiD2lDDCNct6s1PmB3kF7opcR+rpoXtQLkm4q9yXqyvVwI6 D33w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gJo3j3MD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si10714540ejd.199.2020.12.21.23.08.21; Mon, 21 Dec 2020 23:08:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gJo3j3MD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726316AbgLVHHI (ORCPT + 99 others); Tue, 22 Dec 2020 02:07:08 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:54062 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbgLVHHI (ORCPT ); Tue, 22 Dec 2020 02:07:08 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0BM763o4064278; Tue, 22 Dec 2020 01:06:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1608620763; bh=vQYJz6q3QwL2K0Sik8ruQUMB1sjj3ErMTyA3nnEGtE0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gJo3j3MDLLrFUJMtlQxO+dcRmmFN0ZE8FTm2sEsH7VVHt/JgptyGuJ0+v7XbLOxV/ GezppDkKvC6EPwEVKcFsN9aBZUql7OP9ZHe9yImAdCuQHYEfhhrNsYZMIEsTbtyPtW Kv8AzYf2oq++DLtSWXbooV1kXuY2URlLddnMZ1rk= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0BM7633W032169 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Dec 2020 01:06:03 -0600 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 22 Dec 2020 01:06:02 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 22 Dec 2020 01:06:02 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0BM75N7J050344; Tue, 22 Dec 2020 01:05:59 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Swapnil Jakhade , , , CC: Nishanth Menon , Philipp Zabel Subject: [PATCH v2 10/14] phy: cadence: sierra: Enable pll_cmnlc and pll_cmnlc1 clocks Date: Tue, 22 Dec 2020 12:35:16 +0530 Message-ID: <20201222070520.28132-11-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222070520.28132-1-kishon@ti.com> References: <20201222070520.28132-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get pll_cmnlc and pll_cmnlc1 optional clocks and enable them. This will enable REFRCV/1 in case the pll_cmnlc/1 takes input from REFRCV/1 respectively. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 56 +++++++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 2a509be80c80..553971683f2d 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -267,6 +267,8 @@ struct cdns_sierra_phy { struct clk *clk; struct clk *cmn_refclk_dig_div; struct clk *cmn_refclk1_dig_div; + struct clk *pll_cmnlc; + struct clk *pll_cmnlc1; int nsubnodes; u32 num_lanes; bool autoconf; @@ -874,9 +876,59 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, } sp->cmn_refclk1_dig_div = clk; + clk = devm_clk_get_optional(dev, "pll_cmnlc"); + if (IS_ERR(clk)) { + dev_err(dev, "pll_cmnlc clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->pll_cmnlc = clk; + + clk = devm_clk_get_optional(dev, "pll_cmnlc1"); + if (IS_ERR(clk)) { + dev_err(dev, "pll_cmnlc1 clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->pll_cmnlc1 = clk; + return 0; } +static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp) +{ + int ret; + + ret = clk_prepare_enable(sp->clk); + if (ret) + return ret; + + ret = clk_prepare_enable(sp->pll_cmnlc); + if (ret) + goto err_pll_cmnlc; + + ret = clk_prepare_enable(sp->pll_cmnlc1); + if (ret) + goto err_pll_cmnlc1; + + return 0; + +err_pll_cmnlc: + clk_disable_unprepare(sp->clk); + +err_pll_cmnlc1: + clk_disable_unprepare(sp->pll_cmnlc); + + return 0; +} + +static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp) +{ + clk_disable_unprepare(sp->pll_cmnlc1); + clk_disable_unprepare(sp->pll_cmnlc); + clk_disable_unprepare(sp->clk); +} + static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, struct device *dev) { @@ -961,7 +1013,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) goto unregister_pll_mux; - ret = clk_prepare_enable(sp->clk); + ret = cdns_sierra_phy_enable_clocks(sp); if (ret) goto unregister_pll_mux; @@ -1038,7 +1090,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) reset_control_put(sp->phys[i].lnk_rst); of_node_put(child); clk_disable: - clk_disable_unprepare(sp->clk); + cdns_sierra_phy_disable_clocks(sp); reset_control_assert(sp->apb_rst); unregister_pll_mux: cdns_sierra_pll_mux_unregister(sp, dn); -- 2.17.1