Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1939367lqg; Mon, 4 Mar 2024 08:09:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXEx2ivoQgbo0815okmweQhkJcc7o7idVveyoR6M7xLeOc1Tzwt/3FzmH7CSXIjxvfro52dro0SJ3GP4U3ctj0C17wNd8n7pe/UoM4jfw== X-Google-Smtp-Source: AGHT+IEX2Ko6iHRIq0oarCp0E+cQSrAlFnuIDIsLRhPeYMj2dTLdRuUBq7AVOU4H8FLAf26PRO/j X-Received: by 2002:a17:902:ec90:b0:1dd:911:19b1 with SMTP id x16-20020a170902ec9000b001dd091119b1mr6683883plg.19.1709568598473; Mon, 04 Mar 2024 08:09:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709568598; cv=pass; d=google.com; s=arc-20160816; b=EtssIfAGrNNiojKChfMZRWR9Jg0pUgZF3rlgs4MIYBDCFUlYH+rqqnvbXBehQ7iC/R FrOtQ4z2fTEkV3Y/ZFiML3cBmPXxdm0OdT7SjfXx5RWK/QiCMCjyZ5LUrm7pQYQAxL6Y Irk8OLheLjGXu4tjJQkt5RkXUl6azAvP7GpGCzAESFtJGmTrWXMGJObN7ZEFi+yVzRWw DIYexTjXormcCPRJzxfLSJIRGPDFKpXFS1XFylrcxI8Ns8TIZ5knipWGChzVEqeXMUdm 1Wu03zMmZgYzTwrtMbi9cM4+vpUw+Rm38O3wQDJWcgqWqZi7DPwzkPhWmIVYr96F/XXX xdtQ== 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=sztGcTF1zNnT//0yUibe2G7ihiKGeSnHpVbJVpHAUPU=; fh=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=mWzpM7vMaqZzf50JfrMBpT6bQhDUkT2Yj+Hzpu1ICWwyFe4Z8XoJ4DRVeEuemt+Vqp V6NLAo4HjGuU4px96HZO1wcZFrbWBssMh1q62aab0gGZHRD/NM7oTsaRkrpKii7yiRvQ lizb5WVopvsEzv/a9FLe7G2nkWw3Blw4mI+aJtt/CXZOUvhaic2euVHeYu0qYZWvTnGT oCGTuFeU74VtDXVAYyB06gqhhCTDgrgmCfgDHJM8fZRL2PXeCcPGFXNU7syavax4ftSi LY+F8yZach5jWPNCmpLSAVwC6gwaZD65/UXf7+98AV6vKYWN8zp+XOmlu2VH4ZzTn+Kl AspA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XhUhcsxz; 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-90848-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90848-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 q7-20020a170902a3c700b001dc8edc57a0si8047034plb.632.2024.03.04.08.09.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:09:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90848-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=XhUhcsxz; 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-90848-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90848-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 95BE6B2B3F4 for ; Mon, 4 Mar 2024 15:39:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8C8C5490E; Mon, 4 Mar 2024 15:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XhUhcsxz" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 7FA95535D1; Mon, 4 Mar 2024 15:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566589; cv=none; b=MGUO5/Np5LjEscrvL3+Mlt4xR5rurzHFsSwW10e0h9YHJfCKN620Ht5JXcFMu8IAyD6Gv3tXRYFZV8Vcq76Z0h+kPmtfhIgY7HREfwWLhLTAm/ezvHisvkCGyVa6gPUUpscFyo+msOyIC281e+sk+toy3cu7cFmaxMWhCP5ijxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566589; c=relaxed/simple; bh=qXrncApu3ZH2u++c1fiMA0V7EGCJUkhdKcLX17WxyVY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E9ASO3ChamqT4DOzqEsZJd8sk18R+jMHHqvTNhQqFHikJBvotWR1v4jO0ZOKBTpJFj/sc+qPmBHD6BIuQOaojZ4JU7syFEmIJ8B4NbAARiT957yy3KyF1ol/VR6cdl2OqsRKV2VJluGtFHVfmEon6sGrRGfSchLCp1gpB2nnB6I= 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=XhUhcsxz; arc=none smtp.client-ip=217.70.183.201 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 5B7AE1BF20A; Mon, 4 Mar 2024 15:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709566586; 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=sztGcTF1zNnT//0yUibe2G7ihiKGeSnHpVbJVpHAUPU=; b=XhUhcsxz5kqKybZ+IslbKDjzFBEMPd3pYU8SMD9mtQJOmvIF2Oe4kdsywdRL7c0/txh+OT C1VUnu18E7+RX/0hxOvd7tTkBa5fsBOpPAXi/ur7w34iqzsnK/fYQVGEpnGEfZR6Xh2g3x 1BLQiJz2eAzdKGP4TtbpEI4+Z5mDW5CaCLRUnUWRkzIbXxVSgBAjgyLZ8tjrw43qgDXS4o gUwlLOag6tSHf56Nu8f4idZeMEIMCTTPD4dZLfpxJBI69kbqULvWheg6kkm/Q2GIVQj+ne XetoYoxbYZmJtYFW2zNH3eyDpy1+0efrvgWEgg4IqAcXoraaRAH+xl9xIACw2g== From: Thomas Richard Date: Mon, 04 Mar 2024 16:35:52 +0100 Subject: [PATCH v4 09/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-v4-9-6f1f53390c85@bootlin.com> References: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@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. Co-developed-by: Théo Lebrun Signed-off-by: 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