From patchwork Wed Mar 10 15:45:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 396733 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp483346jai; Wed, 10 Mar 2021 07:47:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpcu6UmslI5BNI9V4Lk/0W6XP4IG9/h4jsgb9irjxLwdEcg0FGR1YaVZkVBVTr3Y5cZ5l8 X-Received: by 2002:a05:6402:3495:: with SMTP id v21mr3998368edc.117.1615391238246; Wed, 10 Mar 2021 07:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615391238; cv=none; d=google.com; s=arc-20160816; b=cy3PCXYAuG2wbABis3G82NR4wyeR2iQQrj+oZi/GD4qsNWJ7im2Cz/A/iqugF4aDPO 49SAKVJGyY2SinErQR6mVubQ4HIZ+E//Wk1Lmb75gmgY1KF94n+Wy2e+KibHg4l2I1N6 qRH2PwXoSc2YM6UL3ROpegVgsP374WpzR/wdEpC70JAMyK21vhpUWaNFHsAXOADd+w9t dPNo3xa4LqmV0nYA4n0H0BwM4uxjRYOja7HnPNp3uO5s1SXDnTFaHRwTv+0/xofucTkI WLI5WEl5ALYNuX3tp+/K4CMVOysblfbtk/e01njT4yMUTjbJ01Z+dzsAiAHqSzFMrS5h /FKQ== 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=1m1jaw1QKhWt1my5TiZgSyHmcvod41lJIai7xVZR3M8=; b=UWKRwhtIgLLbf4uXx7OnAtFNnWQCArrCBrNcuZk0bYTgz7OahVWB+EZo4aK79Zi5oc odAqxM7DGiE+UGZg9jsSuzeCosioTOarRxUFACPOUy5FcH2o6+jVVkTuUc0o4QEWFTl0 jA2cNQ7Vkn7bA7uiAegM4eIe7pYC44uOWlFBjgQA/fYXmPirfpKEp07r+xQc7Qa3/MMS lOMNzNusgedKTSSyF8LO0k/zpdY4J9T2ujwDYw7q8beH/V/GV0/JNGR9C/quBLQZrxGM qB8vAkR+7lO9lmVE73sKsylY0/veSERABI88DdIxmIfbO05ulW1j7+OUMnP0WwYrbY4l eEfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=AimgfEuf; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 t3si4576077ejy.142.2021.03.10.07.47.18; Wed, 10 Mar 2021 07:47:18 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-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=AimgfEuf; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233224AbhCJPqn (ORCPT + 6 others); Wed, 10 Mar 2021 10:46:43 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47722 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232617AbhCJPq1 (ORCPT ); Wed, 10 Mar 2021 10:46:27 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12AFkL6u067707; Wed, 10 Mar 2021 09:46:21 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615391181; bh=1m1jaw1QKhWt1my5TiZgSyHmcvod41lJIai7xVZR3M8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=AimgfEufkI2q4yZEXpKgflNl4tqimqAVFDZwJ14MYlp8z2tY7ZMeko7CStc9h4DB7 YYXKp3D/51KntvxnEczwKXCahpKhyhNES6hVRU3i5uQYO4wXialI95VFob6FaCjyjS tYh3kixgeAH7aCDcqdhwGOIiTp3RNh3Vyuq23dnc= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12AFkLfl088150 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Mar 2021 09:46:21 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 10 Mar 2021 09:46:21 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Wed, 10 Mar 2021 09:46:21 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 12AFk2KT066370; Wed, 10 Mar 2021 09:46:18 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v6 05/13] phy: cadence: cadence-sierra: Move all clk_get_*() to a separate function Date: Wed, 10 Mar 2021 21:15:50 +0530 Message-ID: <20210310154558.32078-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210310154558.32078-1-kishon@ti.com> References: <20210310154558.32078-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. Group all devm_clk_get_optional() to a separate function. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 57 +++++++++++++++--------- 1 file changed, 35 insertions(+), 22 deletions(-) -- 2.17.1 Reviewed-by: Swapnil Jakhade diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index f7ba0ed416bc..7bf1b4c7774a 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -477,6 +477,38 @@ static int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, + struct device *dev) +{ + struct clk *clk; + int ret; + + clk = devm_clk_get_optional(dev, "phy_clk"); + if (IS_ERR(clk)) { + dev_err(dev, "failed to get clock phy_clk\n"); + return PTR_ERR(clk); + } + sp->clk = clk; + + clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); + if (IS_ERR(clk)) { + dev_err(dev, "cmn_refclk_dig_div clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->cmn_refclk_dig_div = clk; + + clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); + if (IS_ERR(clk)) { + dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->cmn_refclk1_dig_div = clk; + + return 0; +} + static int cdns_sierra_phy_probe(struct platform_device *pdev) { struct cdns_sierra_phy *sp; @@ -487,7 +519,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) unsigned int id_value; int i, ret, node = 0; void __iomem *base; - struct clk *clk; struct device_node *dn = dev->of_node, *child; if (of_get_child_count(dn) == 0) @@ -524,11 +555,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sp); - sp->clk = devm_clk_get_optional(dev, "phy_clk"); - if (IS_ERR(sp->clk)) { - dev_err(dev, "failed to get clock phy_clk\n"); - return PTR_ERR(sp->clk); - } + ret = cdns_sierra_phy_get_clocks(sp, dev); + if (ret) + return ret; sp->phy_rst = devm_reset_control_get(dev, "sierra_reset"); if (IS_ERR(sp->phy_rst)) { @@ -542,22 +571,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) return PTR_ERR(sp->apb_rst); } - clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); - if (IS_ERR(clk)) { - dev_err(dev, "cmn_refclk_dig_div clock not found\n"); - ret = PTR_ERR(clk); - return ret; - } - sp->cmn_refclk_dig_div = clk; - - clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); - if (IS_ERR(clk)) { - dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); - ret = PTR_ERR(clk); - return ret; - } - sp->cmn_refclk1_dig_div = clk; - ret = clk_prepare_enable(sp->clk); if (ret) return ret;