Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp644087rdb; Fri, 26 Jan 2024 06:40:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5So5JsyzLrp1zf5ocaqi/PpLI930D76/wZGPHQ73w1WoRgRL6cs4OBMhRM7+Pl20tgMqd X-Received: by 2002:a05:622a:1b14:b0:42a:4b83:392b with SMTP id bb20-20020a05622a1b1400b0042a4b83392bmr2023137qtb.60.1706280032760; Fri, 26 Jan 2024 06:40:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706280032; cv=pass; d=google.com; s=arc-20160816; b=l4zPqmi2NXGW/X1vRXY1ecldjjbhMuLdIt2udqCtl0tksAq4zp4cmZZLh+MFIZLhFi pg113pZW2bqLF5p5qOeR5ctmLZSdCvPu20/SnI1MgURNtravi1tT2ufrbghiGW+cmzYW PMyxi0l1gfhc6GmjXNzHPQSLJwLgYT4UqjOToTxBrYGYD+/3uzDdyfvC+17kdsE8b4o6 qqk6G8o/fvcRqhTgJUsDL3QA/rfsR24ftnUXyOMA7upRnO7YT2MT/1gvkmzLtAKxW1bO GtVnGtXvMF++dJIjmcbPhvqxHNLodz0g2R+PE68drpGSNp2Ctaz7nUzKpTNnUxClrMaK F+kw== 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=qwKGf7qwzlJSl38EGsWN6oKmN7+Z3kA3VFlKRRwxvC0=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=R6SVR9sND5jVz11yFkrm/vmg+LTh0fDFaqMijinTeKhTKmGs7+xALhLd1XQ25lspNP RY1hcCErdUHKcHntSnUUSoLB+EWANUj7p1mVXKXpFd+OSmi+AdiNgI7X+MvtpF1U+yvg 7dXSzwJE4/KOOR+3BkzxWa5OMUjl0cYttoCTOOmMheOm31+2mgQDrPWAOi8wBLgbBNxG dSbxXRZmfnAkpAYhIUSTqEMATbHomtJbLmvZyugN56xn1pdblAOMtcsyKZXPc4M2j3hG 7qwR7r/2mfB6aCFm2lSMd5ps26xpHB1THrxP9ZMYQrd9sR5AecrUydqJnwWLCAeAKbVO Y94Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=o4O7mnoU; 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-40207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40207-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 r7-20020a05622a034700b0042a3254f129si1330738qtw.615.2024.01.26.06.40.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:40:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40207-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=o4O7mnoU; 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-40207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40207-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 828271C20F7D for ; Fri, 26 Jan 2024 14:40:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFC82200C6; Fri, 26 Jan 2024 14:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="o4O7mnoU" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 965A31EB49; Fri, 26 Jan 2024 14:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279879; cv=none; b=tgwDeDxwmdEdwqZy5mFK8gB2oTcR51B89anxXkcxHYx3tDWXstT5uAxxQTjnYgzqfuf6gxqlB27ZaDLRzk/A793pzqY7tOw06chJjvJKP6o9nJWwbRDjSusJ/vWPgZY9g22RdZXfvZ9Lo1XyY7L4b8JJM9dkGTmWbNC5jmq7+M8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279879; c=relaxed/simple; bh=Dk+XWEweUfX0F72hG59ByN7Y+QqMv2QuCtCnXlFa3pI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rRUzHfA5TsJA/uvn3OvUluuiRrh4+C2dNTipfYKLFoIOLZ3tKzZ5UGU1qev+XZaMsB/MVSuk6OwoghaUcqYxVxgaDJgxgQONwhJ9NgbCoJ7Ghf4GidWjfkyQLrpGQYmptGkpoYHsDQCCuXzQ9+6g0xzVYq14+7v00ad2ilzud/c= 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=o4O7mnoU; arc=none smtp.client-ip=217.70.183.194 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 AE57940013; Fri, 26 Jan 2024 14:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706279875; 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=o4O7mnoUq5A/6H+rHvxtjvciqbCFP15d6F6L6R5e1LnanZD8U3kKDuHisbUVzK3vKei3Ly rKMHdUOycj2B9TX483dMmKasyTHEnJJQs//vgQKRqio/mh30dDl0+mvZXXenU/CNf9a2FZ xBfbpIrePDnIVg80gEkcak9Wwnwkms0ZPb/NU7Ws5k2+qLXlUhh45kkBCHS7z0DmE0YJV7 seB2w+FTCbp5YN62lN5dpI+of6GnAGCDHzHqzMvWB8GTFnZ7iOB3nOTl1v8jxZi7NFLM7D +I9P7ECX2KpIx+YTmSvyF2NiJIpmCM6IHLs11oeM+AXDTqJUhBrY8YlJTfVeMQ== From: Thomas Richard Date: Fri, 26 Jan 2024 15:36:50 +0100 Subject: [PATCH v2 08/15] 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-v2-8-8e4f7d228ec2@bootlin.com> References: <20240102-j7200-pcie-s2r-v2-0-8e4f7d228ec2@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v2-0-8e4f7d228ec2@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