Re: [PATCH v2 2/4] of: support of_ensure_probed for top-level machine device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
>>
>> 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@xxxxxxxxxxx: 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";




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux