Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp295133pxb; Mon, 8 Feb 2021 23:58:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlCS8UO6kLEB6d4tqSbZVGFMnsULLT0F2jlv4nd2WoUjs+wuEdKuaswda9AJaiqF3nakby X-Received: by 2002:aa7:cc18:: with SMTP id q24mr20941801edt.82.1612857535904; Mon, 08 Feb 2021 23:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612857535; cv=none; d=google.com; s=arc-20160816; b=LYjN2xe94N9sn32x0b9hvp0Mcs4vY5D5jbuwYrBcdDI7zWQVP0/E0Whi7ZQbIdNR5A 0lrCCVOHm665ksc4lGuE+VrCiC7RHGCiKAfcMOY8EImt33rVnx15cO7pAvP7wBTqjKlH D2jfiwXoTD2k/ZaHkXwA3nMfEL9FVfcmiFHLK9L5F9xMAmnZ7Erse6dAUSd0bz7Mf1nr /qxNETR55k/Jb9xbRxXQlka0g/kViH1A+gRINUbgWlH3RepgL7tbga54lZOUZ9/If4rB iyALLjcf9nza5VqpX5qtWhb9bIDMW2ySoBfll8UhUc4OP5y6ERaApQ22ZcGx2T9WC5Zi 4zYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=a1AUnxd4sG9mQpSxLQXeifdVpC2RzE5PBg4LG/ELf08=; b=NIC6HcYw5Z5nRM4NpjoZEmRAh0VVcb2O/lVyTHtFS+xzHMDPOZlZgGFNzKsiWXWp1m WlOMAtlR0n2XjwPGpH8DPIQzfCoc63m5ijd1LFtgJBfcx27mlvoVKzhC2qx+Hixi+O7S 3yWZ2j1ZZUC8qy6oGLhKzYLyRUYaCooywz5vGduhe8N1cskckRAkZI7hcj5KPTXPsKLS +J887b/eW5CrDFBpiFNbZVvc9r8z/E1hzbjuKnkwYX7ybzoZUo7uL3IWWqNNlcaV7zj1 1L2+35saIW4SApBDRleRyviUl+DYeExH7hiJJXZcPi78EGx5WAff3MoHtxX6tkDHDqJW UCXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NFgHngv8; 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 jz15si13155736ejb.290.2021.02.08.23.58.31; Mon, 08 Feb 2021 23:58:55 -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=k20201202 header.b=NFgHngv8; 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 S229671AbhBIHzz (ORCPT + 99 others); Tue, 9 Feb 2021 02:55:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:38426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbhBIHzy (ORCPT ); Tue, 9 Feb 2021 02:55:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4BBFE64E6F; Tue, 9 Feb 2021 07:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612857313; bh=H95e5VIxFGRYJjLg6UbSArCbHJ9oIF5vqaL9Q5bAX8Y=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=NFgHngv8ebO5+5WphQUJHSGcLMS+MhhJk+zP0WmdOPzHL9e7ClTidmEUnYBkm9c4M 0TQjn1RgtDxUPTgL23Xqmac7j3Qa2EIuhqWKRLcd56+zy9uafozNaCzFCqgEyE/Jhm S6q4Y0soN9jBxyyeb4etK+L0+CDQ8cuvbC2pUdAO+fy06vqQH/UW6T3rxaxWTQa9V3 FNnpfGTuNNg5ydoWS81iOICL0seauXBLCmYhOrzZf2ZpH38P2HM6vOepZkrvp2WxbL c+TJrHwVp0ic2nM1lT0IhbMuaT7aY49msaJrpJzAuC2AeuK/tRXIJz8boDEuIR/2zK x8InH4C6/+2wQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20210128104446.164269-1-tudor.ambarus@microchip.com> Subject: Re: [PATCH] clk: at91: sama5d2: Mark device OF_POPULATED after setup From: Stephen Boyd Cc: Michael Turquette , nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, claudiu.beznea@microchip.com, mirq-linux@rere.qmqm.pl, Greg Kroah-Hartman , linux-clk@vger.kernel.org, linux-arm-kernel , LKML To: Saravana Kannan , Tudor Ambarus Date: Mon, 08 Feb 2021 23:55:11 -0800 Message-ID: <161285731192.418021.10555916396092570051@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Saravana Kannan (2021-01-28 09:01:41) > On Thu, Jan 28, 2021 at 2:45 AM Tudor Ambarus > wrote: > > > > The sama5d2 requires the clock provider initialized before timers. > > We can't use a platform driver for the sama5d2-pmc driver, as the > > platform_bus_init() is called later on, after time_init(). > > > > As fw_devlink considers only devices, it does not know that the > > pmc is ready. Hence probing of devices that depend on it fail: > > probe deferral - supplier f0014000.pmc not ready > > > > Fix this by setting the OF_POPULATED flag for the sama5d2_pmc > > device node after successful setup. This will make > > of_link_to_phandle() ignore the sama5d2_pmc device node as a > > dependency, and consumer devices will be probed again. > > > > Fixes: e590474768f1cc04 ("driver core: Set fw_devlink=3Don by default") > > Signed-off-by: Tudor Ambarus > > --- > > I'll be out of office, will check the rest of the at91 SoCs > > at the begining of next week. > > > > drivers/clk/at91/sama5d2.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c > > index 9a5cbc7cd55a..5eea2b4a63dd 100644 > > --- a/drivers/clk/at91/sama5d2.c > > +++ b/drivers/clk/at91/sama5d2.c > > @@ -367,6 +367,8 @@ static void __init sama5d2_pmc_setup(struct device_= node *np) > > > > of_clk_add_hw_provider(np, of_clk_hw_pmc_get, sama5d2_pmc); > > > > + of_node_set_flag(np, OF_POPULATED); > > + > > return; >=20 > Hi Tudor, >=20 > Thanks for looking into this. >=20 > I already accounted for early clocks like this when I designed > fw_devlink. Each driver shouldn't need to set OF_POPULATED. > drivers/clk/clk.c already does this for you. >=20 > I think the problem is that your driver is using > CLK_OF_DECLARE_DRIVER() instead of CLK_OF_DECLARE(). The comments for > CLK_OF_DECLARE_DRIVER() says: > /* > * Use this macro when you have a driver that requires two initialization > * routines, one at of_clk_init(), and one at platform device probe > */ >=20 > In your case, you are explicitly NOT having a driver bind to this > clock later. So you shouldn't be using CLK_OF_DECLARE() instead. >=20 I see=20 drivers/power/reset/at91-sama5d2_shdwc.c: { .compatible =3D "atmel,sa= ma5d2-pmc" }, so isn't that the driver that wants to bind to the same device node again? First at of_clk_init() time here and then second for the reset driver?