Received: by 2002:ab2:5182:0:b0:1f4:61d5:3ad4 with SMTP id x2csp60791lqi; Fri, 5 Apr 2024 09:43:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUg2iQ5L0umKHpF0n4p0PQCU/Gi3qXXuu0sPqa6Sd9vlDejfeelbE2nQGDQC5eJ5ARjzXe9h9Pk8wBhqeoZF1VVkaABWVeMG0hethjYtA== X-Google-Smtp-Source: AGHT+IFTwUleoFdcgeWRcp0xZmtDeO75s/VTIeU7PJY2tQdOVSWWHjdo4OOa3+jRIvTCJrvEsINr X-Received: by 2002:a17:903:1ce:b0:1e0:73d:9172 with SMTP id e14-20020a17090301ce00b001e0073d9172mr4207979plh.23.1712335397331; Fri, 05 Apr 2024 09:43:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712335397; cv=pass; d=google.com; s=arc-20160816; b=pWRDVi4x6DDIzXb3AlGQxxDNkaTybdRsCxWDG5sTcrR2RnUZfjq4DZLnP51snEcRsT Uay6i0rYDCudOm7cMMfYkYIjubPUcS8rhwCCvXTQBE8DvjLLexMQY4Zk9TLRdCSQLVBL a17xS1SJ6Eh6yMB+GaKSC7ooENymugfwy60CSqmSEa55H1nGG2ej9WxlEH7y2khYHHS9 YxwsLw2ELjOEctycTGLMHeyE9b+89j0dlbkY7AgzTi3nOvVKRfGw3wXNaYZF5IdyDMZj ZygoWy7d47fU49kshYdPR+FbTOyDE11d3aS0SXmxvHe8foUSixWTjGgAkEwF1kbb5O7b hqgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bg9Rt/PqSp0mVNRc4CnJ83rN1b53oD5Z49G+bWrH3ks=; fh=7Lnth7Y25j5+vNUGqTvQV7szewHf6cIu2Of5E/0gm/0=; b=KncTZ1jCeFN4VVhicDBs+tFu3IphtDRt7DTmMESyqrI9GNCEe//y5zNFQ8ZO2Qrt5l nfPSkFtn1cWF72MdSl7TS4fjl8u8LxCT+O2viOtFtRJTP/kTfSkdUM3XwLrELC1R/wB8 zjpTdJN+aLAkq/TkaGrN6qcRxAx95pWOa6QOlD3Lg/A2TALKLs9InaorpG3DHF4yEjiC i8SVT1i/faQJqnp4xZtwJT320FZFmvQL3JYi2Jc8ri2rAEEBT3SKqerlXyFJtStQhSgx nlS1ddmckH9e+wY9IA2RzpWTIPPtrDZN7BCJam/MVfW5XDjevO9xJUzqpdcq0fpXUogo /2Pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r48kuiPi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-133357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mc11-20020a1709032b0b00b001def0abd873si1656131plb.198.2024.04.05.09.43.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 09:43:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r48kuiPi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-133357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133357-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BF1B8288153 for ; Fri, 5 Apr 2024 16:43:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51290171664; Fri, 5 Apr 2024 16:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r48kuiPi" 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 49697200CB; Fri, 5 Apr 2024 16:42:59 +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=1712335380; cv=none; b=dyCi4iehqPXuy+C8uSAnHIHQosdM5AbSr/evBwuFzWwWOtVukEbAHxPLA+SeENP/ylf3KWdGWuvVIKpI4oT5tyLtPCXR2d/4tDXZWK4gozprp6Ecb0JP3Qi1x9OgWwSTxKpn6iri4J9HuFMMpA/v20A3jgNebd7Zd0uGkL9r27g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712335380; c=relaxed/simple; bh=tzIzKG9cY5iB1cNbyOSerZNGuncnsSg9ri0aWSb8kwk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=flJqrapU9bUAQuLDQ6RpWmDI/+UK5y6maP2IDKzOsF9VEpzGHUR3eOkScVqrLjK8QDRToC8Qgrlbtmtp8/hWHg5fzf3B8ZExcsRGLeh5YilShc/fraOyOw/6V/eTcPWrBmvXcSZVf4+ZLtc/rKzjV2BdEEvOcvSuc8nZdR6a9Hk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r48kuiPi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15C5C433C7; Fri, 5 Apr 2024 16:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712335379; bh=tzIzKG9cY5iB1cNbyOSerZNGuncnsSg9ri0aWSb8kwk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r48kuiPiZk+YPXBGXE/t9V6lM/orfbdYF3HLBfM3IvOIKzRpBmoqkPh0kV3QulPsb RpETs988GevTLNLY8feR091/mWnHiHJ+TNRXJ8CyNDjLdPglNQd7ozHdCnPpglGzym QWgJA1H9c8ovLqRFWQIEWWdJKJNfDde8b5ADQduEShbl8SgLDI2FhYvPsYVLy5buYt 4fGzIHgftRydymvjBlXIeKkAXHVomC9lSv9XGguBVtMpbg2inY9G/Q38MM5SJHNKXY Z7eosNVB8cd/PiGsigrvivnFv5rwNePd5PlrM+IyFOwIMZ2n3D9CW4nq58rXVtOaxB RMNwFYglC8zLA== Date: Fri, 5 Apr 2024 22:12:54 +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 , 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 v4 07/18] phy: ti: phy-j721e-wiz: split wiz_clock_init() function Message-ID: References: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@bootlin.com> <20240102-j7200-pcie-s2r-v4-7-6f1f53390c85@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=us-ascii Content-Disposition: inline In-Reply-To: <20240102-j7200-pcie-s2r-v4-7-6f1f53390c85@bootlin.com> On 04-03-24, 16:35, Thomas Richard wrote: > The wiz_clock_init() function mixes probe and hardware configuration. > Rename the wiz_clock_init() to wiz_clock_probe() and move the hardware > configuration part in a new function named wiz_clock_init(). > > This hardware configuration sequence must be called during the resume > stage of the driver. Do you have phy patches dependent on rest, if not consider submitting them in a separate series > > Signed-off-by: Thomas Richard > --- > drivers/phy/ti/phy-j721e-wiz.c | 67 ++++++++++++++++++++++++------------------ > 1 file changed, 38 insertions(+), 29 deletions(-) > > diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c > index 5fea4df9404e..0e3cb1ed5a52 100644 > --- a/drivers/phy/ti/phy-j721e-wiz.c > +++ b/drivers/phy/ti/phy-j721e-wiz.c > @@ -1076,26 +1076,12 @@ static int wiz_clock_register(struct wiz *wiz) > return ret; > } > > -static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > +static void wiz_clock_init(struct wiz *wiz) > { > - const struct wiz_clk_mux_sel *clk_mux_sel = wiz->clk_mux_sel; > - struct device *dev = wiz->dev; > - struct device_node *clk_node; > - const char *node_name; > unsigned long rate; > - struct clk *clk; > - int ret; > - int i; > - > - clk = devm_clk_get(dev, "core_ref_clk"); > - if (IS_ERR(clk)) > - return dev_err_probe(dev, PTR_ERR(clk), > - "core_ref_clk clock not found\n"); > > - wiz->input_clks[WIZ_CORE_REFCLK] = clk; > - > - rate = clk_get_rate(clk); > - if (rate >= 100000000) > + rate = clk_get_rate(wiz->input_clks[WIZ_CORE_REFCLK]); > + if (rate >= REF_CLK_100MHZ) > regmap_field_write(wiz->pma_cmn_refclk_int_mode, 0x1); > else > regmap_field_write(wiz->pma_cmn_refclk_int_mode, 0x3); > @@ -1119,6 +1105,39 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > break; > } > > + if (wiz->input_clks[WIZ_CORE_REFCLK1]) { > + rate = clk_get_rate(wiz->input_clks[WIZ_CORE_REFCLK1]); > + if (rate >= REF_CLK_100MHZ) > + regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x1); > + else > + regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x3); > + unnecessary empty line > + } > + > + rate = clk_get_rate(wiz->input_clks[WIZ_EXT_REFCLK]); > + if (rate >= REF_CLK_100MHZ) > + regmap_field_write(wiz->pma_cmn_refclk_mode, 0x0); > + else > + regmap_field_write(wiz->pma_cmn_refclk_mode, 0x2); > +} > + > +static int wiz_clock_probe(struct wiz *wiz, struct device_node *node) > +{ > + const struct wiz_clk_mux_sel *clk_mux_sel = wiz->clk_mux_sel; > + struct device *dev = wiz->dev; > + struct device_node *clk_node; > + const char *node_name; > + struct clk *clk; > + int ret; > + int i; > + > + clk = devm_clk_get(dev, "core_ref_clk"); > + if (IS_ERR(clk)) > + return dev_err_probe(dev, PTR_ERR(clk), > + "core_ref_clk clock not found\n"); > + > + 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)) > @@ -1126,12 +1145,6 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > "core_ref1_clk clock not found\n"); > > wiz->input_clks[WIZ_CORE_REFCLK1] = clk; > - > - rate = clk_get_rate(clk); > - if (rate >= 100000000) > - regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x1); > - else > - regmap_field_write(wiz->pma_cmn_refclk1_int_mode, 0x3); > } > > clk = devm_clk_get(dev, "ext_ref_clk"); > @@ -1141,11 +1154,7 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node) > > wiz->input_clks[WIZ_EXT_REFCLK] = clk; > > - 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); > + wiz_clock_init(wiz); > > switch (wiz->type) { > case AM64_WIZ_10G: > @@ -1589,7 +1598,7 @@ static int wiz_probe(struct platform_device *pdev) > goto err_get_sync; > } > > - ret = wiz_clock_init(wiz, node); > + ret = wiz_clock_probe(wiz, node); > if (ret < 0) { > dev_warn(dev, "Failed to initialize clocks\n"); > goto err_get_sync; > > -- > 2.39.2 -- ~Vinod