Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp825597pxb; Tue, 9 Feb 2021 13:35:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLgHhm4JFj5iwNYgf/wFDpZHNo7sk4TLJ5HstZhcSKAFFhKRTEptkRHyKYzHdfWmw9u2U2 X-Received: by 2002:a05:6402:5206:: with SMTP id s6mr83755edd.92.1612906557372; Tue, 09 Feb 2021 13:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612906557; cv=none; d=google.com; s=arc-20160816; b=mVj/MOw5657bcvJuU1YSaarDEsYk4AC/bWKwQHzyMCPecmRYlulwC4m5xKQilYQeql 6B6pqdAZBugVMBYO1znX3ibjKNySVE0A82deGb8zUXzAs4cRsgZq5azzh/4/w+uMxsal jqVftyoyCxn3CdmmaNpuGrX6jHAeCjOw8YN73FKtXWB1Fj0Y4KQEJNP07dnrnqSnEKXI Ns+HXDBzxKD3L+7tsNe/27J1J0p+8K1KcJ+u4IekH8i4hhKEBH7k7WlauggeldWgldE3 /beeV/lcUIKG16PC5DYAbdAmFiQWzlC81E7LB5O8UlyjdPZ7En9hnUFHyRnR6BH22IF9 67zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dnLZ5tZYOr2/DrCvzy7WC9kdKIuRuK5/a3YzC0k6AGk=; b=Gv6J4Wo1e3bL/byUSBueiPaEI133nvLQnx00s//XFK48Ri7UUL+JSWeGcDz2JEQMVo EJMfYJmQWurc7beVq1A3ymoQPzlyOc+0alUKOBMtcGEoz9LrxwgJwsHVUDMWjWxASmso IgcD8/E26fhtodjDzse6OHA8e6ukWKh9i+s62u6HxZ85RmV7y6mU1RFzyeUxJrfKwV47 xpaX0TIlzI8Uint0/6b1X+kLl54hNqZAICXYNynH2MykND35RhJ34XdwtHcBWl4ArxDY 2icxXRPfSAxO5+RmcORxZI1Nf9GE1627QsghMdjxUmlrkBYgIjj24y/3+jIiQHY++Nb6 7M3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=e75g3AG1; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si14289771eju.695.2021.02.09.13.35.33; Tue, 09 Feb 2021 13:35:57 -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=@google.com header.s=20161025 header.b=e75g3AG1; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233878AbhBIVcN (ORCPT + 99 others); Tue, 9 Feb 2021 16:32:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233626AbhBITIC (ORCPT ); Tue, 9 Feb 2021 14:08:02 -0500 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D0AC061222 for ; Tue, 9 Feb 2021 11:07:09 -0800 (PST) Received: by mail-yb1-xb2a.google.com with SMTP id p193so5519191yba.4 for ; Tue, 09 Feb 2021 11:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dnLZ5tZYOr2/DrCvzy7WC9kdKIuRuK5/a3YzC0k6AGk=; b=e75g3AG15IROUt3EtTUpNR5CPAOw+UST8Ng0iHoQXWrMeTmZfJAjTMHzhLoHrjmtcq I8BVMXR3Gi4FnjuRiyh/G10QEgk1uRYNF9FMcqcHGXScpFVwjUDRikws9kloUJnFgHvA TIiMRJ60jHP+cCzAxbVKos3Kn91VZG4wccCdsKem7tmgj6BgXSdB3+dIpEfwlALKnU8Y No+RsrBHRpOc0RQBxLLfBzBjC8ViT7upgVcgYh4L07HjAwPepXzcDXcLEiQ9s2/9GfkH iS5gnMnEiJ+Grll8pGcV+WaJ//4RtAzAZRye1kLeUiDZeaUOUs/g4VH2nNSxaglH00lq fIiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dnLZ5tZYOr2/DrCvzy7WC9kdKIuRuK5/a3YzC0k6AGk=; b=Exbyhe7BGzY4DZ1X2Is/y8AhB74FRNi7pe/NUfajLdvt7EFJQCIgGCbJNPFOLlBqOP L0eCNzHt5t7mIikdW/HJbT4DZ8eBnwUJI8LC0h2dun2iZ9jwJs60KMNxnDtnW3KvJ/7y D8XDGYoh708ysMZ4+u5l9BP5HGTixIOo+2222GqQUbp/XOdSmZvfcTvgNmVTfPpmEvZJ ei1S4cyQB4rdy3UuU89BWYk28/jAAB5U+StGgqE6/rXD8QL9tzqicTakDZxQeylFJUkq 8IacMokbd1OfdaIwmjVylpqMpCzG9CkjJaXV4uViH+MbqkZVKAavaP6FkcMvAF1ZWH5M EZhA== X-Gm-Message-State: AOAM532dzkJpcPt2QPrjtBRGNGhlieVu5WjQUjqYbaEZRsWs4PDUd8G3 y9cgbn/SotTygLOGT0Dgf54qmggdH0+MGpjdMZsgWA== X-Received: by 2002:a25:3345:: with SMTP id z66mr35525707ybz.466.1612897628934; Tue, 09 Feb 2021 11:07:08 -0800 (PST) MIME-Version: 1.0 References: <20210128104446.164269-1-tudor.ambarus@microchip.com> <161285731192.418021.10555916396092570051@swboyd.mtv.corp.google.com> In-Reply-To: From: Saravana Kannan Date: Tue, 9 Feb 2021 11:06:32 -0800 Message-ID: Subject: Re: [PATCH] clk: at91: sama5d2: Mark device OF_POPULATED after setup To: Tudor Ambarus Cc: Stephen Boyd , Michael Turquette , Nicolas.Ferre@microchip.com, Alexandre Belloni , Ludovic Desroches , Claudiu Beznea , mirq-linux@rere.qmqm.pl, Greg Kroah-Hartman , linux-clk , linux-arm-kernel , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 9, 2021 at 7:21 AM wrote: > > Hi, Saravana, > > On 2/9/21 11:11 AM, Saravana Kannan wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > On Mon, Feb 8, 2021 at 11:55 PM Stephen Boyd wrote: > >> > >> 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=on 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; > >>> > >>> Hi Tudor, > >>> > >>> Thanks for looking into this. > >>> > >>> 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. > >>> > >>> 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 > >>> */ > >>> > >>> 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. > >>> > >> > >> I see > >> > >> drivers/power/reset/at91-sama5d2_shdwc.c: { .compatible = "atmel,sama5d2-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? > > > > You are right. I assumed that when Tudor was setting OF_POPULATED, > > No, there's a single driver that binds to that compatible. > > > they didn't want to create a struct device and they knew it was right > > for their platform. > > > > However... > > $ git grep "atmel,sama5d2-pmc" > > arch/arm/boot/dts/sama5d2.dtsi: compatible = > > "atmel,sama5d2-pmc", "syscon"; > > arch/arm/mach-at91/pm.c: { .compatible = "atmel,sama5d2-pmc", > > .data = &pmc_infos[1] }, > > drivers/clk/at91/pmc.c: { .compatible = "atmel,sama5d2-pmc" }, > > drivers/clk/at91/sama5d2.c:CLK_OF_DECLARE_DRIVER(sama5d2_pmc, > > "atmel,sama5d2-pmc", sama5d2_pmc_setup); > > drivers/power/reset/at91-sama5d2_shdwc.c: { .compatible = > > "atmel,sama5d2-pmc" }, > > > > Geez! How many drivers are there for this one device. Clearly not all > > of them are going to bind. But I'm not going to dig into this. You can > > From this entire list only the drivers/clk/at91/sama5d2.c driver binds to the > "atmel,sama5d2-pmc" compatible, the rest are just using the compatible to > map the PMC memory. > > > reject this patch. I expect this series [1] to take care of the issue > > Tudor was trying to fix. > > > > Tudor, > > > > Want to give this series [1] a shot? > > The series at [1] doesn't apply clean neither on next-20210209, nor on > driver-core-next. On top of which sha1 should I apply them? It's on top of driver-core-next: 4731210c09f5 gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default > Anyway, I think the patch at [2] is still needed, regardless of the outcome > of [1]. Right, [2] is still a good clean up based on your comment above. -Saravana > > > > [1] - https://lore.kernel.org/lkml/20210205222644.2357303-1-saravanak@google.com/ > > [2] https://lore.kernel.org/lkml/20210203154332.470587-1-tudor.ambarus@microchip.com/ > > Cheers, > ta >