Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp544682rdb; Thu, 15 Feb 2024 07:54:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWG2Ae8cW82FiFbsdFSCAjtlWQmm03uV44TdTS5Lu7Q7+Qx5gFR/tgrNe16dr36f1878Vjh50+SICYcmmfIzpdfokpo0x903fw6HksxIw== X-Google-Smtp-Source: AGHT+IE7oYXsadIurl1dRDrSpJlce3zEr/wsuacLz49oVD22kiiqUCidAHr3YVtY+qC4nDgh/b8a X-Received: by 2002:a17:90a:ff09:b0:299:2454:9746 with SMTP id ce9-20020a17090aff0900b0029924549746mr842281pjb.22.1708012474952; Thu, 15 Feb 2024 07:54:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708012474; cv=pass; d=google.com; s=arc-20160816; b=IFa/XFF3eexLTF3AEi7tEigAjplt/WKlKQNe68a3uh0LnGSNJbFiYS5Qq4J+lNihXW NMEhkkDJwG8W4Tuu+XjGtKldYzJVrAMCOW6MEp7SfWnBC306FRNfttDlb2ZOKXxrTf1J dEiIaoPYD6LXjq1UQ2YDvy71eXEXW/qEOu1spJyaSV3Cml3KtdBemBQZHJfeAqIMbCz8 NMwrDG/9hxQch5xEPXhvl/2LOdVDesZFeXCePeVSVLNUB5vVrsdpGt1H+96QSEhxe9/Q loq862Y1dQ983c17EkuAA4XRh+mQQQvJyHuwD0HSzo+A625mOixHmZ3+vRxFxsltyr3d oqGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=EQj8fkDqiCncYkbq3rqvKqeGNPNTXUz4lWxpr6Y6suo=; fh=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=UFcVhiZLK7PTEiQZFJKJd43hUVsSyNTywIUUmS3HPkaj30oPkVMHRQL7Ks5YTJYvOG FHZ/i9oUSXjLFjheN6YRnybC/T71wAPco5oeq/raWahZm6ayKSk7FLMRmG9kQT562yLZ 09PFpN+jXYnhoQqJDs8MUtLT6Rvx7SmM+LJjQD9JBDiMr44M+m1rjqpKwFfSSd86i5hz X9sAAhl4+t9bMNs2nMyOyAwzt1zikR0FGDUuRWB+QosLAXz4o0JNFBmJmoVHrSsIUU3n /51kfYelolDbrYfMN0sn5mjYOeoDJjL7bp3LVdRZBy5uDpVNL2MhEVbR7lfwUVCfzjoT mJBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="UDiws/Sj"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id om7-20020a17090b3a8700b00298f693c1f9si1463544pjb.32.2024.02.15.07.54.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:54:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="UDiws/Sj"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E4B7CB2B4E0 for ; Thu, 15 Feb 2024 15:21:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF51F135A41; Thu, 15 Feb 2024 15:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UDiws/Sj" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 539F0134CCC; Thu, 15 Feb 2024 15:18:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010295; cv=none; b=spH6XkeqqB6sv/6jRQwb3KHGDC75m1SU6ryeiSVucBEYF9PbNzLSyIq73UEnMt3+tuiOelY6bhpjip8VH/rB3HavIz1WBQVnqIefKBN9LMJ3KJ6aDutfkRG/d/MqYjW9DqqtUWnBb3bCHwi4O5XC+f+wYZlPiZhd+sSkAMgCxdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010295; c=relaxed/simple; bh=oJ9NHVIeGASP4//4Yhvz3aSZx6p5bLAELnAcAKZPGic=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ozEB6NPq9ehEXuIgX6NntN97SMsONsCyzK3ZrpejvbAqsmOlGOFQzyUK2IopWl9mBKAZDwRGob8dUuyKyQJskf4oNWuxOC88ybV2ePuA/wKriKK1lWx/Z8gKGJUN4IxXLbnmyL9wehULedtr1trD4sryHHEeNCroLqzr31F07Ko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=UDiws/Sj; arc=none smtp.client-ip=217.70.183.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 9FE6E24000D; Thu, 15 Feb 2024 15:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708010290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EQj8fkDqiCncYkbq3rqvKqeGNPNTXUz4lWxpr6Y6suo=; b=UDiws/SjWesPdNffMn2bHZI5uY7/Dr/iLgrz0mbUng6Y/CkR88vM9/q3/ROqauOm7USTx1 8LvrR//w1kOPNTrulzu2HdHY+xUo+/FfplD/jj3YHb+N4AnwFHaygD68bejfY9RaToGIpi W6oLksh/lSnoIk/zrtcFbyYgturyDn0UZUoAy1NkIfgBIzfVlCjqkllOJLJeHELNC62F6w mUBrAB0bbyGxX36m/Km7D5yNI7BlkZiytRgVIz6RaAFY2hW9B2qCMddQNj17N10pscxamt X/yyuSpNXboa++2kJtw/gGTCpInol8oV82XaMCgz13kKsbXyGOO6J6KLmTbDEA== From: Thomas Richard Date: Thu, 15 Feb 2024 16:17:55 +0100 Subject: [PATCH v3 10/18] phy: cadence-torrent: extract calls to clk_get from cdns_torrent_clk Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240102-j7200-pcie-s2r-v3-10-5c2e4a3fac1f@bootlin.com> References: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Tony Lindgren , Haojian Zhuang , Vignesh R , Aaro Koskinen , Janusz Krzysztofik , Andi Shyti , Peter Rosin , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-phy@lists.infradead.org, linux-pci@vger.kernel.org, gregory.clement@bootlin.com, theo.lebrun@bootlin.com, thomas.petazzoni@bootlin.com, u-kumar1@ti.com, Thomas Richard X-Mailer: b4 0.12.0 X-GND-Sasl: thomas.richard@bootlin.com Extract calls to clk_get from cdns_torrent_clk into a separate function. It needs to call cdns_torrent_clk at resume without looking up the clock. Based on the work of Théo Lebrun Signed-off-by: Thomas Richard --- drivers/phy/cadence/phy-cadence-torrent.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index a75c96385c57..803a76acf2fd 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -2681,18 +2681,21 @@ static int cdns_torrent_reset(struct cdns_torrent_phy *cdns_phy) return 0; } +static int cdns_torrent_of_get_clk(struct cdns_torrent_phy *cdns_phy) +{ + cdns_phy->clk = devm_clk_get(cdns_phy->dev, "refclk"); + if (IS_ERR(cdns_phy->clk)) + return dev_err_probe(cdns_phy->dev, PTR_ERR(cdns_phy->clk), + "phy ref clock not found\n"); + + return 0; +} + static int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy) { - struct device *dev = cdns_phy->dev; unsigned long ref_clk_rate; int ret; - cdns_phy->clk = devm_clk_get(dev, "refclk"); - if (IS_ERR(cdns_phy->clk)) { - dev_err(dev, "phy ref clock not found\n"); - return PTR_ERR(cdns_phy->clk); - } - ret = clk_prepare_enable(cdns_phy->clk); if (ret) { dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); @@ -2776,6 +2779,10 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) if (ret) return ret; + ret = cdns_torrent_of_get_clk(cdns_phy); + if (ret) + goto clk_cleanup; + regmap_field_read(cdns_phy->phy_pma_cmn_ctrl_1, &already_configured); if (!already_configured) { -- 2.39.2