Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp307020rdb; Mon, 22 Jan 2024 23:19:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVZnhS3YF9TpvmjYrb4YMUfxk+kxo5NxmmaCqRp5cTpEKBOhbDLvIXf3c1efbyA7ODqjUl X-Received: by 2002:a05:651c:150f:b0:2cc:6fe2:4ddc with SMTP id e15-20020a05651c150f00b002cc6fe24ddcmr2860288ljf.3.1705994346048; Mon, 22 Jan 2024 23:19:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705994346; cv=pass; d=google.com; s=arc-20160816; b=feS1q3OX2OuYnjhz/GOvcnFEtlii0WoLNQKqm3PdN/mTDAFJoRPskLziUmwfwE5HYv mwn8XmJKc7xOSx3HiKrMqjZgIjqI5WwKhSxsFOwXgn8Nq+UqfybcQ9A2079O7zfX8Eq/ 5Yi2EZnyIDThcoy1ZdZbEiPjgt2/Z7+B9etedLEAKERGAm7BMZRl/R3A+oV5VhXK5tmy TAbKHnSjuIMDmGEYubSSjZViHXP5PPmU9TpIVsBVdWvrvUWPHMRPPpmykz1uVhEelERu Tf7/v478nlBaJviUdgSEQ13Jdlbo0onBLUm8IXqw1EkpZtFdkzajxM7ZQDUkwXdvb8O9 ZpcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=H3xnWjreEIPynaNrt/ZRk+5XU0ksjBtfNnsvLoqsvqY=; fh=XVBKcof/CkhdWatJ/BZvFhMShpYGwC6r3OPjeJm6+j8=; b=bMfE/evfNlRcDl37ZSRA3QlS2gBHBHnC2GEPjkUtF/YFXDeCwGImPENFlhIghBjetU /WHljiIBJFAq105XkjGRJp8m17j88p9gqn3EAkpcAKoTbrDYStqkp29kpS6OcP4UbMiq PpxnSgVbmNGDmkeBHHqltmbszF03Aiw8pFKSp9+zz7TdaXOMP9ikXI6esjkAADCmLk9q wuvCTzv4UT5VdFcUa07YjHQGZs4EtV517HquXZcc7SWEEismwUjOHIUWYLo/L70MxpGO o5Dil69fhqHNkd7gt54JSN7WPnDHynqCiRY81nHyJtPMVc3a3SSYEsiF1Vnu5UmPnn7h QVBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P+BjxU0T; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o6-20020a056402444600b0055c863de112si299740edb.571.2024.01.22.23.19.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 23:19:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P+BjxU0T; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C71841F23758 for ; Tue, 23 Jan 2024 07:19:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A5AC55E5E; Tue, 23 Jan 2024 07:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P+BjxU0T" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.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 39CB652F7E; Tue, 23 Jan 2024 07:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705994316; cv=none; b=qAnzk1XcdbWd8TEAah+ozAKTPZhipih+tUjaNjYcutxtfj1HNCHVrqQb6gDJTCqZ+058aAmD7rIdzaiVN29o8zzsoqaizzK/QUn2kgL147hjRMNNSnvVWOaFJDsQ26jl8gdi+ANrnUBrwlVUDdQztB9Dut75BbU72v85SmDsaGI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705994316; c=relaxed/simple; bh=TTjPVKSuyim+Y5YMrAL6bgP1bnNaR126K293xNj8wus=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UDmyhJW9T7k5bN7/Bp5fD0XfzSUJKtnwRMgofoIqry87H82o2vyymHwNARWO+sULdA4UmoQTIfyz5gMRRYyPvvEDX68hTzUqa+3gxVDA5MtEUWJflMMVF4eQM/r1hrLNdMwx7jRO3+ArhZdGZnb1NB2Ck22bFcG+pP99D/gK+CA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P+BjxU0T; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E8BC433A6; Tue, 23 Jan 2024 07:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705994315; bh=TTjPVKSuyim+Y5YMrAL6bgP1bnNaR126K293xNj8wus=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P+BjxU0TR2OpXB4waPzTZj1kTTGDgUdfUuxRh7lU3N0AOex+AnlIqKpSBZ5g/OwxB UbQyfRyI5U6o0uEZK7E3aIl0/IuMuuhmzeBnIiXVwrqPz1KvhvyYcFnyyA/V8Gs0WM GRdWsDUTTOvZOLHVz62FXOkW87+k6D5UBQMweVNfNn4tzAHmlPvaEfB2gN1UHuxbV/ 7JfT2gRpZZ8wl1tnHPRvrS/6KdaKW3NQSYdElD6rpyT0qWK3TaGxq06mAttAq85YuN aqeQjeaqXwYmYNX/zfQhVdoKiFi4eF7y35V6mSYkWlmKtBD4JkwDa4nYtpiShQ4to4 wTvdM6T0eigbg== Date: Tue, 23 Jan 2024 12:48:31 +0530 From: Vinod Koul To: Thomas Richard Cc: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Tony Lindgren , Haojian Zhuang , Vignesh R , Aaro Koskinen , Janusz Krzysztofik , Andi Shyti , Peter Rosin , Kishon Vijay Abraham I , Philipp Zabel , Tom Joseph , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , 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 Subject: Re: [PATCH 05/14] phy: ti: phy-j721e-wiz: make wiz_clock_init callable multiple times Message-ID: References: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@bootlin.com> <20240102-j7200-pcie-s2r-v1-5-84e55da52400@bootlin.com> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240102-j7200-pcie-s2r-v1-5-84e55da52400@bootlin.com> On 15-01-24, 17:14, Thomas Richard wrote: > For suspend and resume support, wiz_clock_init needs to be called > multiple times. > Add a parameter to wiz_clock_init to be able to skip clocks > registration. > > Based on the work of Th?o Lebrun > > Signed-off-by: Thomas Richard > --- > drivers/phy/ti/phy-j721e-wiz.c | 60 +++++++++++++++++++++++++----------------- > 1 file changed, 36 insertions(+), 24 deletions(-) > > diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c > index fc3cd98c60ff..09f7edf16562 100644 > --- a/drivers/phy/ti/phy-j721e-wiz.c > +++ b/drivers/phy/ti/phy-j721e-wiz.c > @@ -1076,7 +1076,7 @@ static int wiz_clock_register(struct wiz *wiz) > return ret; > } > > -static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > +static int wiz_clock_init(struct wiz *wiz, struct device_node *node, bool probe) > { > const struct wiz_clk_mux_sel *clk_mux_sel = wiz->clk_mux_sel; > struct device *dev = wiz->dev; > @@ -1087,14 +1087,36 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > int ret; > int i; > > - clk = devm_clk_get(dev, "core_ref_clk"); > - if (IS_ERR(clk)) { > - dev_err(dev, "core_ref_clk clock not found\n"); > - ret = PTR_ERR(clk); > - return ret; > + if (probe) { > + clk = devm_clk_get(dev, "core_ref_clk"); > + if (IS_ERR(clk)) { > + dev_err(dev, "core_ref_clk clock not found\n"); > + ret = PTR_ERR(clk); > + return ret; > + } > + wiz->input_clks[WIZ_CORE_REFCLK] = clk; > + > + if (wiz->data->pma_cmn_refclk1_int_mode) { > + clk = devm_clk_get(dev, "core_ref1_clk"); > + if (IS_ERR(clk)) { > + dev_err(dev, "core_ref1_clk clock not found\n"); > + ret = PTR_ERR(clk); > + return ret; > + } > + wiz->input_clks[WIZ_CORE_REFCLK1] = clk; > + } > + > + clk = devm_clk_get(dev, "ext_ref_clk"); > + if (IS_ERR(clk)) { > + dev_err(dev, "ext_ref_clk clock not found\n"); > + ret = PTR_ERR(clk); > + return ret; > + } > + wiz->input_clks[WIZ_EXT_REFCLK] = clk; > } > - wiz->input_clks[WIZ_CORE_REFCLK] = clk; > > + > + clk = wiz->input_clks[WIZ_CORE_REFCLK]; > rate = clk_get_rate(clk); > if (rate >= 100000000) > regmap_field_write(wiz->pma_cmn_refclk_int_mode, 0x1); > @@ -1121,14 +1143,7 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > } > > if (wiz->data->pma_cmn_refclk1_int_mode) { > - clk = devm_clk_get(dev, "core_ref1_clk"); > - if (IS_ERR(clk)) { > - dev_err(dev, "core_ref1_clk clock not found\n"); > - ret = PTR_ERR(clk); > - return ret; > - } > - wiz->input_clks[WIZ_CORE_REFCLK1] = clk; > - > + clk = wiz->input_clks[WIZ_CORE_REFCLK1]; > rate = clk_get_rate(clk); > if (rate >= 100000000) > regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x1); > @@ -1136,20 +1151,17 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x3); > } > > - clk = devm_clk_get(dev, "ext_ref_clk"); > - if (IS_ERR(clk)) { > - dev_err(dev, "ext_ref_clk clock not found\n"); > - ret = PTR_ERR(clk); > - return ret; > - } > - wiz->input_clks[WIZ_EXT_REFCLK] = clk; > - > + clk = wiz->input_clks[WIZ_EXT_REFCLK]; > rate = clk_get_rate(clk); > if (rate >= 100000000) > regmap_field_write(wiz->pma_cmn_refclk_mode, 0x0); > else > regmap_field_write(wiz->pma_cmn_refclk_mode, 0x2); > > + /* What follows is about registering clocks. */ > + if (!probe) > + return 0; > + > switch (wiz->type) { > case AM64_WIZ_10G: > case J7200_WIZ_10G: > @@ -1592,7 +1604,7 @@ static int wiz_probe(struct platform_device *pdev) > goto err_get_sync; > } > > - ret = wiz_clock_init(wiz, node); > + ret = wiz_clock_init(wiz, node, true); You are calling it one once? So what am I missing -- ~Vinod