mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: of_probe: create board's machine device at the earliest
@ 2022-09-05  7:02 Ahmad Fatoum
  2022-09-13  8:27 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2022-09-05  7:02 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We currently create devices for matching reserved memory entries and
firmware before creating the machine device. In a deep probe system, the
machine driver would be probed directly at registration and as such
needs to be probed before other devices are created, so it can disable
other devices if needed. Move the machine device registration to the
top, so board drivers can disabled reserved memory entries and firmware
if they need to.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/base.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 52e6a9294e11..6a51dd71793d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2503,6 +2503,12 @@ int of_probe(void)
 	if(!root_node)
 		return -ENODEV;
 
+	/*
+	 * We do this first thing, so board drivers can patch the device
+	 * tree prior to device creation if needed.
+	 */
+	of_platform_device_create_root(root_node);
+
 	/*
 	 * Handle certain compatibles explicitly, since we don't want to create
 	 * platform_devices for every node in /reserved-memory with a
@@ -2515,8 +2521,6 @@ int of_probe(void)
 	if (node)
 		of_platform_populate(node, NULL, NULL);
 
-	of_platform_device_create_root(root_node);
-
 	of_platform_populate(root_node, of_default_bus_match_table, NULL);
 
 	return 0;
-- 
2.30.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: of_probe: create board's machine device at the earliest
  2022-09-05  7:02 [PATCH] of: of_probe: create board's machine device at the earliest Ahmad Fatoum
@ 2022-09-13  8:27 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-09-13  8:27 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Sep 05, 2022 at 09:02:08AM +0200, Ahmad Fatoum wrote:
> We currently create devices for matching reserved memory entries and
> firmware before creating the machine device. In a deep probe system, the
> machine driver would be probed directly at registration and as such
> needs to be probed before other devices are created, so it can disable
> other devices if needed. Move the machine device registration to the
> top, so board drivers can disabled reserved memory entries and firmware
> if they need to.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/of/base.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 52e6a9294e11..6a51dd71793d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2503,6 +2503,12 @@ int of_probe(void)
>  	if(!root_node)
>  		return -ENODEV;
>  
> +	/*
> +	 * We do this first thing, so board drivers can patch the device
> +	 * tree prior to device creation if needed.
> +	 */
> +	of_platform_device_create_root(root_node);
> +
>  	/*
>  	 * Handle certain compatibles explicitly, since we don't want to create
>  	 * platform_devices for every node in /reserved-memory with a
> @@ -2515,8 +2521,6 @@ int of_probe(void)
>  	if (node)
>  		of_platform_populate(node, NULL, NULL);
>  
> -	of_platform_device_create_root(root_node);
> -
>  	of_platform_populate(root_node, of_default_bus_match_table, NULL);
>  
>  	return 0;
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-13  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05  7:02 [PATCH] of: of_probe: create board's machine device at the earliest Ahmad Fatoum
2022-09-13  8:27 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox