Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1579600pxb; Mon, 8 Mar 2021 00:42:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvmFlxWgxmm2m8qwdzfPsoj8QYDTQt7cRY0l+ndYf2ZUAm3cdJ3zOLXqoJy8Z1yFNztXt3 X-Received: by 2002:a50:f314:: with SMTP id p20mr20816280edm.236.1615192965453; Mon, 08 Mar 2021 00:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615192965; cv=none; d=google.com; s=arc-20160816; b=JUZeTecELwk8i+cJ4WCtEDYWgXI174oVnkFVo+udDgt3C/mx8ymaR2bJ29KiVmuAYh uAgcLpG5WALe/jWZk/SX3+uOLGryWLoQ6BYJdXEXocwbwH973FUy8Nuzym09jCBnCg9R ikEGKkyDN/NTG/NZUvYhkwmKbWmi5P0MGhLfDIZtMESfIByzWZJQjK3Yp3auxv6szIga we50PwkMhEmQDfLZWsnulhWP+bmMJ/28k1DgjooAhKZj1MF7fsdOKSHbWHnWqdU7G4Fl 3JSBKLYZs5MgmvEvLNKBFFddveRu6YqnCBXdwSC3QoBBunWOMPDFCD70i7mCQLet9jHC 50BQ== 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=+Y00hdZP+qH3GUjqo1BgTa5yanHKcZM8l+fdCNkwrBk=; b=OW1Aw4s7oMBZOZJyUP+8WQzYrMpTXn3UTX0rp4jhorhlAkshg6e5ZOb7pMEV3ZU9HP rkEbPxIUL7sGUG0wBKn+Iw1xqJZ9BptCxnNPz5kHcfdvQMcUxPZ8oLXpfjHigFAIlkVD Ec78UX1N8xLAGcXr9OpnFhV9CoelXN3xhLy+aXrtSe2LVnlk7Z04yKFH2/on6M0Dxxa0 SB85lzykffW2Ya4BuVihxJnmsoVjQDqhPw+0g6gNIi1anXxlqJHcXtJlwUCoIV+ert5e rZy32Fs3y10W4kwnhQ9Afahg0h1Vnr+RCJHE+yBNMzAiq33X6dI9rUPMTpLIu/Hc57AC GwjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gA3eY+1+; 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 lt10si6602926ejb.16.2021.03.08.00.42.22; Mon, 08 Mar 2021 00:42:45 -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=gA3eY+1+; 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 S234420AbhCHFI5 (ORCPT + 99 others); Mon, 8 Mar 2021 00:08:57 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36338 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234352AbhCHFIc (ORCPT ); Mon, 8 Mar 2021 00:08:32 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12858Rar077337; Sun, 7 Mar 2021 23:08:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615180107; bh=+Y00hdZP+qH3GUjqo1BgTa5yanHKcZM8l+fdCNkwrBk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gA3eY+1+ymr21oGfHhAxPHO806Ci6caZG8eWEsHwXX2WusNGv0fVh5YbUhPqNtLJC RiJd2UYUcCD5/9umsRCObXPQHc/xPVHZxux3KCp+ix497pTWdg7B5i7FBDCTU5HbSB mT3JkH7W64HaSTGrHzfyx/w7INIrzkQ9krba7Ozg= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12858RL2068871 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 7 Mar 2021 23:08:27 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Sun, 7 Mar 2021 23:08:27 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE111.ent.ti.com (157.170.170.22) 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; Sun, 7 Mar 2021 23:08:27 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 12857aLB086547; Sun, 7 Mar 2021 23:08:24 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v5 13/13] phy: cadence: sierra: Enable pll_cmnlc and pll_cmnlc1 clocks Date: Mon, 8 Mar 2021 10:37:32 +0530 Message-ID: <20210308050732.7140-14-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210308050732.7140-1-kishon@ti.com> References: <20210308050732.7140-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 | 40 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index b80afc11dd5c..16adc6dff04e 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -768,6 +768,40 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp) +{ + int ret; + + ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); + if (ret) + goto err_pll_cmnlc; + + ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); + if (ret) + goto err_pll_cmnlc1; + + return 0; + +err_pll_cmnlc: + clk_disable_unprepare(sp->input_clks[PHY_CLK]); + +err_pll_cmnlc1: + clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); + + return ret; +} + +static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp) +{ + clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); + clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); + clk_disable_unprepare(sp->input_clks[PHY_CLK]); +} + static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, struct device *dev) { @@ -848,7 +882,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) goto unregister_clk; - ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); + ret = cdns_sierra_phy_enable_clocks(sp); if (ret) goto unregister_clk; @@ -925,7 +959,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->input_clks[PHY_CLK]); + cdns_sierra_phy_disable_clocks(sp); reset_control_assert(sp->apb_rst); unregister_clk: cdns_sierra_clk_unregister(sp); @@ -941,6 +975,7 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev) reset_control_assert(phy->apb_rst); pm_runtime_disable(&pdev->dev); + cdns_sierra_phy_disable_clocks(phy); /* * The device level resets will be put automatically. * Need to put the subnode resets here though. @@ -950,7 +985,6 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev) reset_control_put(phy->phys[i].lnk_rst); } - clk_disable_unprepare(phy->input_clks[PHY_CLK]); cdns_sierra_clk_unregister(phy); return 0; -- 2.17.1