mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Riesch <michael.riesch@wolfvision.net>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v2 2/4] of: support of_ensure_probed for top-level machine device
Date: Mon, 13 Mar 2023 08:05:04 +0100	[thread overview]
Message-ID: <a08214bb-8cb0-8fd4-d8c7-3dbbd7e5165a@wolfvision.net> (raw)
In-Reply-To: <dc4ee9c6-e336-7073-c0a1-5f076f7429e4@pengutronix.de>

Hi Ahmad,

On 3/10/23 17:19, Ahmad Fatoum wrote:
> On 10.03.23 15:46, Michael Riesch wrote:
>> Hi Ahmad,
>>
>> On 2/10/23 17:53, Ahmad Fatoum wrote:
>>> Creation of a machine device for the top-level node has special casing
>>> in of_probe(). Export of_platform_device_create_root(), so it's possible
>>> to ensure probe of the machine device. This is required when doing
>>> of_devices_ensure_probed_by_dev_id with the machine compatible.
>>>
>>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>>
>> This patch breaks my board code that calls
>> of_device_ensure_probed_by_alias() in the probe() of the board driver.
>> The function always returns -ENODEV.
>>
>> Do I have to adjust my (downstream) board code somehow?
> 
> Not sure. I'd need to reproduce. Is there an easy way to adjust a mainline
> board to get the same behavior? Is your downstream board code inside a
> board driver probe function or is it raw in an initcall?

I can sketch a patch that triggers this behavior on a Radxa ROCK3.
Similar to my board code, this happens in the scope of a board probe
function. Please find the sketch below.

Basing on the current next:

Board: Radxa ROCK3 Model A
deep-probe: supported due to radxa,rock3a
board-rock3 machine: of_device_ensure_probed_by_alias returned -19

With 2b46c9df976c ("of: support of_ensure_probed for top-level machine
device") reverted:

Board: Radxa ROCK3 Model A
deep-probe: supported due to radxa,rock3a
rk808 rk8090: chip id: 0x8090
rockchip_saradc fe720000.saradc@fe720000.of: registered as saradc
board-rock3 machine: of_device_ensure_probed_by_alias returned 0

Thanks and best regards,
Michael

> [...]
---- %< snip ----------------------------------------------------

diff --git a/arch/arm/boards/radxa-rock3/board.c
b/arch/arm/boards/radxa-rock3/board.c
index 4b4e0613d3..771777d4ea 100644
--- a/arch/arm/boards/radxa-rock3/board.c
+++ b/arch/arm/boards/radxa-rock3/board.c
@@ -15,6 +15,7 @@ static int rock3_probe(struct device *dev)
        enum bootsource bootsource = bootsource_get();
        int instance = bootsource_get_instance();
        const struct rock3_model *model;
+       int ret;

        model = device_get_match_data(dev);

@@ -30,6 +31,9 @@ static int rock3_probe(struct device *dev)
                                "/dev/mmc1");
        rk3568_bbu_mmc_register("sd", 0, "/dev/mmc0");

+       ret = of_device_ensure_probed_by_alias("saradc");
+       dev_info(dev, "of_device_ensure_probed_by_alias returned %d\n",
ret);
+
        return 0;
 }

diff --git a/arch/arm/dts/rk3568-rock-3a.dts
b/arch/arm/dts/rk3568-rock-3a.dts
index 25a0c05737..b8dc46c706 100644
--- a/arch/arm/dts/rk3568-rock-3a.dts
+++ b/arch/arm/dts/rk3568-rock-3a.dts
@@ -6,6 +6,10 @@
 #include "rk356x.dtsi"

 / {
+       aliases {
+               saradc = &saradc;
+       };
+
        chosen: chosen {
                environment-sd {
                        compatible = "barebox,environment";



  reply	other threads:[~2023-03-13  7:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 16:53 [PATCH v2 1/4] of: base: factor out of_merge_nodes from of_copy_node Ahmad Fatoum
2023-02-10 16:53 ` [PATCH v2 2/4] of: support of_ensure_probed for top-level machine device Ahmad Fatoum
2023-03-10 14:46   ` Michael Riesch
2023-03-10 16:19     ` Ahmad Fatoum
2023-03-13  7:05       ` Michael Riesch [this message]
2023-03-13 14:43         ` Ahmad Fatoum
2023-02-10 16:53 ` [PATCH v2 3/4] boards: qemu-virt: ensure board driver probe at postcore_initcall level Ahmad Fatoum
2023-02-10 16:53 ` [PATCH v2 4/4] boards: qemu-virt: support passing in FIT public key Ahmad Fatoum
2023-02-10 17:32   ` Jan Lübbe
2023-02-13  8:45   ` Sascha Hauer
2023-02-17 13:03     ` Ahmad Fatoum
2023-03-09 12:47       ` Ahmad Fatoum
2023-03-10  9:51 ` [PATCH v2 1/4] of: base: factor out of_merge_nodes from of_copy_node Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a08214bb-8cb0-8fd4-d8c7-3dbbd7e5165a@wolfvision.net \
    --to=michael.riesch@wolfvision.net \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox