Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp628289rdb; Mon, 15 Jan 2024 08:18:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEINHMDR0hrUKN3pc2MPZGRY6+JAZgli+tAYDQvE/unAF1xzKYyFWTDUpGdFa/UGEh/jOOl X-Received: by 2002:a05:620a:b84:b0:783:4c2b:cd31 with SMTP id k4-20020a05620a0b8400b007834c2bcd31mr5391645qkh.44.1705335505350; Mon, 15 Jan 2024 08:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705335505; cv=none; d=google.com; s=arc-20160816; b=SlxDXgr/3vbgi/O3KzefFKA4WMXMjcU0DSzXEK+5Rx0RkjjcROHB6GJ/+0YKJ8k9Lr VlW3JriXe2Kb4qrO+Lp2ElxodxflpCCqhsKDo9Di01dPs3iazGiSMX8qzb+ZndlstbQf fcbTguTRNHkg2h2QA/eCJSkSX4G1h01h0FkGMeRg/C8sOfHWrAdKkUCNcrK+B4QS2IY2 6gr1rJMC0b3d1PqLf7jE1o78lVzM8RSFaBEYCDRVOmLAsb2sJyLsc08aZlGzKZ5hqyY/ HNI7mGyK4PveAqCY1V9SXMfQg/YxHSHV07/tg9KGP7QWQ27dlqrZQjktiNr85pfR+tme ZGjA== ARC-Message-Signature: i=1; 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=qwKGf7qwzlJSl38EGsWN6oKmN7+Z3kA3VFlKRRwxvC0=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=QM3r5kjFKvPxbXRLd6b7VrnXlUC++N8/BPmfX3GsuN0gzjTtgwLSxmqJbUCGIELJKO KlTTMQaajAnlcjtHb0p6W7GqKdAUweYVnP6F5THc11UQyh97WpsCS2g5E/1VHlynOEkm kwbAZVd6B9rL/g8lUdYEGIsuKVqIM0usInBzhoRdRvKE/iAId1IXTvx1u+qTOZYZOz30 ZzbNc7MHkEMR/b92UoR/7VR9LE3xKXcGaEZzgfZONpSgLbSXJOclTlntU+JpSg9S2TIK XPV+YQ/b+xsKVG97bl4ONSYI7EQCe5pZ9Ft0QCx9K+c7QLwgeR1PFVfPQfD1DcQrjt1B DXxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Nyn6Z7nS; spf=pass (google.com: domain of linux-kernel+bounces-26238-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26238-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i15-20020a05620a248f00b007833b37ea5csi8867068qkn.270.2024.01.15.08.18.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 08:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26238-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Nyn6Z7nS; spf=pass (google.com: domain of linux-kernel+bounces-26238-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26238-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 06F541C2165E for ; Mon, 15 Jan 2024 16:18:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A666318E27; Mon, 15 Jan 2024 16:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Nyn6Z7nS" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 5CB2717BA0; Mon, 15 Jan 2024 16:16:24 +0000 (UTC) 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 5A97BC0014; Mon, 15 Jan 2024 16:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1705335383; 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=qwKGf7qwzlJSl38EGsWN6oKmN7+Z3kA3VFlKRRwxvC0=; b=Nyn6Z7nS4rpPrtcLEUkTF9AAgHB7htljXQCy+nyVz7Y/WDZKFIZ+B9Ry1SSldbMdvKl+ib AJcGsDJnar6WP+Nu5EVq49AY9dZ51z4Sydg6D6lWZFsLxozf+d6OliKbMCKVQYPSvM6yYD ztNFRagdPrThYH6N3QYZPRIifO90got8tY1XwISASqORDilOCeevf0nysbCbYro5OarwFY k3uy5zRU3eHZx90T+1ENgPQkW5TpzwfXbUjJWV82BamdC3HBiEuRuWx+Wqo2seucK8I8/8 iFuZnSkdpejBFw5Y0p7k5A5xv2VI9sO+JFnQKQYkqEaLgt57sxDDiJ48qrPR0g== From: Thomas Richard Date: Mon, 15 Jan 2024 17:14:48 +0100 Subject: [PATCH 07/14] 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-v1-7-84e55da52400@bootlin.com> References: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@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 , Tom Joseph , 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 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index a75c96385c57..94298ad9f875 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -2681,18 +2681,22 @@ static int cdns_torrent_reset(struct cdns_torrent_phy *cdns_phy) return 0; } -static int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy) +static int cdns_torrent_of_get_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"); + cdns_phy->clk = devm_clk_get(cdns_phy->dev, "refclk"); if (IS_ERR(cdns_phy->clk)) { - dev_err(dev, "phy ref clock not found\n"); + dev_err(cdns_phy->dev, "phy ref clock not found\n"); return PTR_ERR(cdns_phy->clk); } + return 0; +} + +static int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy) +{ + unsigned long ref_clk_rate; + int ret; + ret = clk_prepare_enable(cdns_phy->clk); if (ret) { dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); @@ -2776,6 +2780,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