Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2905905pxb; Sun, 15 Nov 2020 23:34:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn+xcNy41j2K/u47ap8fmzLJ1QCasSCR91/UyvjX5yJO2vtTxLcd1e5X44TPbe1Z9Oep0v X-Received: by 2002:a17:906:74c6:: with SMTP id z6mr13817524ejl.448.1605512081585; Sun, 15 Nov 2020 23:34:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605512081; cv=none; d=google.com; s=arc-20160816; b=nVMWccgT8TzH/RHT5/Zjt1EW/yEvtqmCmUxfUW/EpI+C2M70/Hx8eufRuvFb5wbcTE y51zD1VKUqq6slXLMavHgHC5JLvYyI0wws/ZbI/NlaDffKzZiFhtCDXwpBdea8AWjUe+ Tqo+q75MRgpo/OTzXQ5JUFJgxZXW/iXJldrw0s4Y+TGbgxM826LG3ms6SQBMQMU4LYt3 wKo09LE9regYFtV4SuCWU9TamFRA9CPAAdyEXIcrFz4zm9JgibAIi3ok8YLclQKPFucs 5py+fdcnvlU7mNNuvBgdBa+q2o2zZUTqvPRQ6mHF2cJmgv8IZ0wU8x1gISTyB5jJsOGt PR9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zLc5hyOiFhHMbkyOR3lrx9SwU5goymPuFvzG1M47f+U=; b=tPOy1nmnTrA6fumeA7ljjPkz5aYrX0RjgpQukOj/7z6WCtCPJejj9+SnWgjyYBxQCh tq0vmjeaOw6kBMXiK/vja4r4fGCwZl3HSyvjphUMM8Wg9+yuSjXMEPqKxrIcAtPGR7+H BqVT1bUAtOH3NTN1g/vIVPv9lrmEExkLcXXq2L4UJk/KrYurK8b6h09YVCo5+zP4AKE6 ODJy2jsefrtT1A0bmNrzBbP1MHy6mnqQ5GrqvfHSf3Notvd4k+1GTw4UhZ1ROzLTXh84 QyB9c60UbIHYQnnEJfSK6E0WdrbeKzL23GtkeXNsJU+2ztKB1nBN+YY+2iBUUpp+QEaw uw7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CtJyznWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si10829291ejy.399.2020.11.15.23.34.18; Sun, 15 Nov 2020 23:34:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CtJyznWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbgKPHae (ORCPT + 99 others); Mon, 16 Nov 2020 02:30:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:44984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727618AbgKPHae (ORCPT ); Mon, 16 Nov 2020 02:30:34 -0500 Received: from localhost (unknown [122.171.203.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0366C2225B; Mon, 16 Nov 2020 07:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605511834; bh=kuJZwKY/IYkjSZSOji4K+N/t3ZrSh9loZk56Bj/FUeg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CtJyznWc2TNkU+uX/kJ+1njGxc4ik9VYyaku3knQb+Sc7wCIFWEjccKXIaJ8rCGhF MyoPYr+lnROdN21gDm8JkGE2XtDdDFTpzm0PH152GnkKSyOzvEIZ68H97dNBk2+R8R odHAa4bRBO0PbcqAEx3C709yEQyg/iydFtw6o6ms= Date: Mon, 16 Nov 2020 13:00:29 +0530 From: Vinod Koul To: Kishon Vijay Abraham I Cc: Rob Herring , Philipp Zabel , Swapnil Kashinath Jakhade , Milind Parab , Yuti Suresh Amonkar , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 3/9] phy: ti: j721e-wiz: Don't configure wiz if its already configured Message-ID: <20201116073029.GI7499@vkoul-mobl> References: <20201103035556.21260-1-kishon@ti.com> <20201103035556.21260-4-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103035556.21260-4-kishon@ti.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03-11-20, 09:25, Kishon Vijay Abraham I wrote: > From: Faiz Abbas > > Serdes lanes might be shared between multiple cores in some usecases > and its not possible to lock PLLs for both the lanes independently > by the two cores. This requires a bootloader to configure both the > lanes at early boot time. > > To handle this case, skip all configuration if any of the lanes has > already been enabled. > > While we are here, also fix the wiz_init() to be called before the > of_platform_device_create() call. Let's do two patches for these two issues :-) Other than that, change lgtm, with exception of minor nit > Signed-off-by: Faiz Abbas > Signed-off-by: Kishon Vijay Abraham I > --- > drivers/phy/ti/phy-j721e-wiz.c | 36 +++++++++++++++++++++------------- > 1 file changed, 22 insertions(+), 14 deletions(-) > > diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c > index d57d29382ce4..9786e8aec252 100644 > --- a/drivers/phy/ti/phy-j721e-wiz.c > +++ b/drivers/phy/ti/phy-j721e-wiz.c > @@ -816,13 +816,14 @@ static int wiz_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct device_node *node = dev->of_node; > struct platform_device *serdes_pdev; > + bool already_configured = false; > struct device_node *child_node; > struct regmap *regmap; > struct resource res; > void __iomem *base; > struct wiz *wiz; > u32 num_lanes; > - int ret; > + int ret, val, i; > > wiz = devm_kzalloc(dev, sizeof(*wiz), GFP_KERNEL); > if (!wiz) > @@ -944,10 +945,26 @@ static int wiz_probe(struct platform_device *pdev) > goto err_get_sync; > } > > - ret = wiz_clock_init(wiz, node); > - if (ret < 0) { > - dev_warn(dev, "Failed to initialize clocks\n"); > - goto err_get_sync; > + for (i = 0; i < wiz->num_lanes; i++) { > + regmap_field_read(wiz->p_enable[i], &val); > + if (val & (P_ENABLE | P_ENABLE_FORCE)) { > + already_configured = true; > + break; > + } > + } > + > + if (!already_configured) { do you really need this variable and check, why not move the below into precceding block and do wiz_clock_init() and wiz_init() inside the if condition and drop the variable > + ret = wiz_clock_init(wiz, node); > + if (ret < 0) { > + dev_warn(dev, "Failed to initialize clocks\n"); > + goto err_get_sync; > + } > + > + ret = wiz_init(wiz); > + if (ret) { > + dev_err(dev, "WIZ initialization failed\n"); > + goto err_pdev_create; > + } > } > > serdes_pdev = of_platform_device_create(child_node, NULL, dev); > @@ -958,18 +975,9 @@ static int wiz_probe(struct platform_device *pdev) > } > wiz->serdes_pdev = serdes_pdev; > > - ret = wiz_init(wiz); > - if (ret) { > - dev_err(dev, "WIZ initialization failed\n"); > - goto err_wiz_init; > - } > - > of_node_put(child_node); > return 0; > > -err_wiz_init: > - of_platform_device_destroy(&serdes_pdev->dev, NULL); > - > err_pdev_create: > wiz_clock_cleanup(wiz, node); > > -- > 2.17.1 -- ~Vinod