Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A547C678D4 for ; Wed, 1 Mar 2023 23:53:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbjCAXxW (ORCPT ); Wed, 1 Mar 2023 18:53:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCAXxU (ORCPT ); Wed, 1 Mar 2023 18:53:20 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2BA2107 for ; Wed, 1 Mar 2023 15:53:19 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id a9so5658844plh.11 for ; Wed, 01 Mar 2023 15:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1677714798; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4UxHdhijEmH2EyOtzBINRHdLM65Pg4RR1uX5oWHJrGs=; b=iPAqlLP8wwKKO1WdZ9KFnFOEEXb3jqCD4xiFYMj8I5h7L2FZJFLV7XbQtWKWi0wZfP k/ypbOQ8iABno+EV3MAX0pkXD23QER5kEgGQYCZHeMDKxWhflUNZ9haRkBXqGvn1IigX DA8ipR0sGVFIlzUHEJiLhF+fcb6FtbqO3aZudsc7UXrMgeTb2V7PlwBXE38R4R68Dg88 CpMrqZ0bt5NSTvo1UQnuH5Do+9VHosSKNcDVOFB7nhRQsEXgqVl18Vez8Q9mRryQZv6N 2b2He5XXnDzDmZMCtLbH7py5tdRx51pi8rRl7+wT+eQpfxzSsAKoXFjRSdh/bXOhFJcW tiig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677714798; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4UxHdhijEmH2EyOtzBINRHdLM65Pg4RR1uX5oWHJrGs=; b=AqaEpTt4aHndfKj7EW5PIwCGmOm9gjrBzhUb02v4YrJYIPUvmMyyruAe9ozQSYqgk/ MDJSzga4uIpyTw6PXSshy6gvIbz3iLQMoFRvwzT2q4AjhPKo6S6DeB3M19wk/Rg3mCh8 1x8QEVIhrZibtwYRYbH7YcpLEazx0wFFezYByoynbMTrUmDQ+HsLvEBV0r2pcs1z4Ebs 8f5HdKzuCh8qeArj6uWpEWLqCTVxCYBhBwQOK3LEtzis/0rILAHx3zUjcI+gBcgnrEOO JT2V+i3xhk+dluJd7KJaubhGgjtFIzTvYIYJoW7raven6dFSMbbaNGhm875ncr1U5Pb6 Evvw== X-Gm-Message-State: AO0yUKWG58ADyQsNekHLSVVnvnXNdfctFsyUn9+6VccAa7iDE79ra8X9 QJ6DeV4AxrEOR1v4Y6h8KSIzbS2okmd1IrUV3+FL/g== X-Google-Smtp-Source: AK7set8OEP8qZ1fXhp8dBKMmkZESQT0zLW4ve3iPhJpUSUr5plbBBdGZeGBMNl9ORkTSS3FmOLJAAq3lrDXAhUnoAo0= X-Received: by 2002:a17:903:2601:b0:19a:fdca:e3e9 with SMTP id jd1-20020a170903260100b0019afdcae3e9mr3055313plb.10.1677714798260; Wed, 01 Mar 2023 15:53:18 -0800 (PST) MIME-Version: 1.0 References: <20230301012506.1401883-1-saravanak@google.com> <31ae9957edf319416d4551f14eba2071.sboyd@kernel.org> <7cca9a24b24d849565cd6a4f40ddbee9.sboyd@kernel.org> In-Reply-To: From: Saravana Kannan Date: Wed, 1 Mar 2023 15:52:41 -0800 Message-ID: Subject: Re: [PATCH v1] clk: Mark a fwnode as initialized when using CLK_OF_DECLARE* macros To: Stephen Boyd Cc: Greg Kroah-Hartman , Michael Turquette , Linus Walleij , kernel-team@android.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 1, 2023 at 2:45=E2=80=AFPM Stephen Boyd wrot= e: > > Quoting Saravana Kannan (2023-03-01 13:25:13) > > On Wed, Mar 1, 2023 at 12:48=E2=80=AFPM Stephen Boyd = wrote: > > > > > > Quoting Stephen Boyd (2023-03-01 12:40:03) > > > > Quoting Saravana Kannan (2023-02-28 17:25:06) > > > > > The CLK_OF_DECLARE macros sometimes prevent the creation of struc= t > > > > > devices for the device node being handled. It does this by > > > > > setting/clearing OF_POPULATED flag. This can block the probing of= some > > > > > devices because fw_devlink will block the consumers of this node = till a > > > > > struct device is created and probed. > > > > > > > > Why can't you use CLK_OF_DECLARE_DRIVER()? > > > > > > Ah I misunderstood. CLK_OF_DECLARE() _always_ prevents the creation o= f a > > > struct device for the device node being handled. The 'sometimes' thre= w > > > me off. > > > > The "sometimes" is because dependending on the macro we go back and > > clear the flag. > > Ok. Maybe instead of this paragraph you can explain the problem being > fixed, specifically ux500 container node not being marked as > "initialized" and that preventing consumer devices from probing. That > would help the reviewer understand the specific problem you're solving. Ack > > > > > > > > > > > > > > > > > Set the appropriate fwnode flags when these device nodes are init= ialized > > > > > by the clock framework and when OF_POPULATED flag is set/cleared.= This > > > > > will allow fw_devlink to handle the dependencies correctly. > > This is the "what" and not the "why". > > > > > > > How is this different from commit 3c9ea42802a1 ("clk: Mark fwnodes wh= en > > > their clock provider is added/removed")? Do you have some user of > > > CLK_OF_DECLARE() that isn't registering an OF clk provider? > > > > So it looks like drivers don't always register the same node used for > > CLK_OF_DECLARE() as the clock provider. So, this is covering for the > > case when that's not true. > > Please add this information to the commit text. Otherwise the patch > looks entirely unnecessary. Ack. > If the node used for CLK_OF_DECLARE() isn't the same as the node as the > clock provider then how are we certain that the CLK_OF_DECLARE() probe > function has actually registered a clk provider? Whether it's registered or not, we can't wait for a struct device to be created for it. That's what the flag is about. device link can't work without devices. > Should we simply remove the calls to fwnode_dev_initialized() in the OF > clk provider functions Not all clock providers are going through CLK_OF_DECLARE(). There are so many ways to register a clock provider. So it's good to cover all those cases and leave those existing calls in. > and put the call in CLK_OF_DECLARE() (and > specifically _not_ CLK_OF_DECLARE_DRIVER) as this patch does? Between the time the clk provider is initialized and a new struct device being created, we still don't want to block consumers from probing because they might be dependent on the already registered early clocks. So, we should set the flag in the DRIVER case too. And then we clear it once it has been initialized because we allow the struct device to be populated and it's okay to wait for those. > What about > bindings that are registering clks early with CLK_OF_DECLARE_DRIVER() > and then probing something like a reset controller later with a platform > device created by an MFD matching the same compatible as the > CLK_OF_DECLARE_DRIVER() compatible? I think I answered it above? -Saravana