Skip to contentSkip to conversation

dm: core: Add DM_FLAG_PROBE_AFTER_BIND flag

PATCH In review Marek Vasut 4 participants 17 messages Apr 22, 2022 – Apr 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dm: core: Add DM_FLAG_PROBE_AFTER_BIND flag

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
---
 drivers/core/root.c | 24 +++++++++++++++++++++++-
 include/dm/device.h |  3 +++
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/core/root.c +23 -1
index e09c12f4d6e..17dd1205a32 100644
@@ -361,6 +361,28 @@ void *dm_priv_to_rw(void *priv)
 }
 #endif
 
+static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only)
+{
+	u32 mask = DM_FLAG_PROBE_AFTER_BIND;
+	u32 flags = dev_get_flags(dev);
+	struct udevice *child;
+	int ret;
+
+	if (pre_reloc_only)
+		mask |= DM_FLAG_PRE_RELOC;
+
+	if ((flags & mask) == mask) {
+		ret = device_probe(dev);
+		if (ret)
+			return ret;
+	}
+
+	list_for_each_entry(child, &dev->child_head, sibling_node)
+		dm_probe_devices(child, pre_reloc_only);
+
+	return 0;
+}
+
 /**
  * dm_scan() - Scan tables to bind devices
  *
@@ -393,7 +415,7 @@ static int dm_scan(bool pre_reloc_only)
 	if (ret)
 		return ret;
 
-	return 0;
+	return dm_probe_devices(gd->dm_root, pre_reloc_only);
 }
 
 int dm_init_and_scan(bool pre_reloc_only)
include/dm/device.h +3 -0
index e0f86f5df9f..e7dd90399f9 100644
@@ -80,6 +80,9 @@ struct driver_info;
  */
 #define DM_FLAG_VITAL			(1 << 14)
 
+/* Device must be probed after it was bound */
+#define DM_FLAG_PROBE_AFTER_BIND	(1 << 15)
+
 /*
  * One or multiple of these flags are passed to device_remove() so that
  * a selective device removal as specified by the remove-stage and the
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/3 led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

Calling device_probe() from uclass .post_bind() callback has all kinds of odd side-effects, e.g. device instances not being available just yet. Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances which need to be probe()d in order to configure the LED default state with this flag and let the DM core do the device_probe() at the right time instead.

Fixes 72675b063b6 ("led: Configure LED default-state on boot")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
---
 drivers/led/led-uclass.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/led/led-uclass.c +3 -1
index 5d7bf40896b..2ce72933b6c 100644
@@ -98,7 +98,9 @@ static int led_post_bind(struct udevice *dev)
 	 * In case the LED has default-state DT property, trigger
 	 * probe() to configure its default state during startup.
 	 */
-	return device_probe(dev);
+	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+	return 0;
 }
 
 static int led_post_probe(struct udevice *dev)
Signature · 1 line
2.35.1
Reviewed-by Tested-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

Hi Marek

Quoted 23 lines · Marek Vasut

Calling device_probe() from uclass .post_bind() callback has all kinds of odd side-effects, e.g. device instances not being available just yet. Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances which need to be probe()d in order to configure the LED default state with this flag and let the DM core do the device_probe() at the right time instead.

Fixes 72675b063b6 ("led: Configure LED default-state on boot")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
---
 drivers/led/led-uclass.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/led/led-uclass.c +0 -0
index 5d7bf40896b..2ce72933b6c 100644

drivers/led/led-uclass.c static int led_post_bind(struct udevice *dev) · line 106

Quoted 10 lines
drivers/led/led-uclass.c +3 -1
@@ -98,7 +98,9 @@ static int led_post_bind(struct udevice *dev)
 	 * In case the LED has default-state DT property, trigger
 	 * probe() to configure its default state during startup.
 	 */
-	return device_probe(dev);
+	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+	return 0;
 }
 
 static int led_post_probe(struct udevice *dev)

Tested on stm32mp157c-dk2 board
Thanks
Patrice

#3 lore raw

Re: [PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

In reply to Marek Vasut
Quoted 16 lines · Marek Vasut

Calling device_probe() from uclass .post_bind() callback has all kinds of odd side-effects, e.g. device instances not being available just yet. Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances which need to be probe()d in order to configure the LED default state with this flag and let the DM core do the device_probe() at the right time instead.

Fixes 72675b063b6 ("led: Configure LED default-state on boot")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
Quoted 3 lines
---
 drivers/led/led-uclass.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

This breaks all of the sandbox tests, which perhaps need another update for what you've changed here? I already had to tweak them once in 72675b063b6e ("led: Configure LED default-state on boot"). But my perhaps incorrect read then was that the dts / test weren't quite right to start with. Perhaps that's still the case however?

Signature · 1 line
Tom
#4 lore raw

Re: [PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

Quoted 22 lines · Tom Rini
Quoted 16 lines · Marek Vasut

Calling device_probe() from uclass .post_bind() callback has all kinds of odd side-effects, e.g. device instances not being available just yet. Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances which need to be probe()d in order to configure the LED default state with this flag and let the DM core do the device_probe() at the right time instead.

Fixes 72675b063b6 ("led: Configure LED default-state on boot")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
Quoted 3 lines
---
  drivers/led/led-uclass.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 5 lines

This breaks all of the sandbox tests, which perhaps need another update for what you've changed here? I already had to tweak them once in 72675b063b6e ("led: Configure LED default-state on boot"). But my perhaps incorrect read then was that the dts / test weren't quite right to start with. Perhaps that's still the case however?

Pick these two test fixes:

[PATCH 1/2] test: dm: led: Fix LED enumeration
[PATCH 2/2] test: dm: pinmux: Get LED2 udevice in the pinmux test

#5 lore raw

Re: [PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

Calling device_probe() from uclass .post_bind() callback has all kinds of odd side-effects, e.g. device instances not being available just yet. Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances which need to be probe()d in order to configure the LED default state with this flag and let the DM core do the device_probe() at the right time instead.

Quoted 9 lines
Fixes 72675b063b6 ("led: Configure LED default-state on boot")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#6 lore raw

PATCH 3/3 led: gpio: Check device compatible string to determine the top level node

In reply to Marek Vasut

Since 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing"), all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio") to determine whether this is a top-level node, since it is only the top level node which is compatible with "leds-gpio", the GPIO LEDs subnodes are not.

Fixes 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
---
 drivers/led/led_gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/led/led_gpio.c +1 -2
index 958dbd31e77..23156907593 100644
@@ -57,12 +57,11 @@ static enum led_state_t gpio_led_get_state(struct udevice *dev)
 
 static int led_gpio_probe(struct udevice *dev)
 {
-	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
 	struct led_gpio_priv *priv = dev_get_priv(dev);
 	int ret;
 
 	/* Ignore the top-level LED node */
-	if (!uc_plat->label)
+	if (device_is_compatible(dev, "gpio-leds"))
 		return 0;
 
 	ret = gpio_request_by_name(dev, "gpios", 0, &priv->gpio, GPIOD_IS_OUT);
Signature · 1 line
2.35.1
Reviewed-by Tested-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] led: gpio: Check device compatible string to determine the top level node

Hi Marek

Quoted 25 lines · Marek Vasut

Since 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing"), all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio") to determine whether this is a top-level node, since it is only the top level node which is compatible with "leds-gpio", the GPIO LEDs subnodes are not.

Fixes 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
---
 drivers/led/led_gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/led/led_gpio.c +0 -0
index 958dbd31e77..23156907593 100644
@@ -57,12 +57,11 @@ static enum led_state_t gpio_led_get_state(struct udevice *dev)
 
 static int led_gpio_probe(struct udevice *dev)
 {

drivers/led/led_gpio.c static enum led_state_t gpio_led_get_state(struct udevice *dev) · line 67

Quoted 10 lines
drivers/led/led_gpio.c +1 -2
-	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
 	struct led_gpio_priv *priv = dev_get_priv(dev);
 	int ret;
 
 	/* Ignore the top-level LED node */
-	if (!uc_plat->label)
+	if (device_is_compatible(dev, "gpio-leds"))
 		return 0;
 
 	ret = gpio_request_by_name(dev, "gpios", 0, &priv->gpio, GPIOD_IS_OUT);

Tested on stm32mp157c-dk2 board
Thanks
Patrice

#8 lore raw

Re: [PATCH 3/3] led: gpio: Check device compatible string to determine the top level node

In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

Since 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing"), all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio") to determine whether this is a top-level node, since it is only the top level node which is compatible with "leds-gpio", the GPIO LEDs subnodes are not.

Quoted 9 lines
Fixes 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing")
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
Reviewed-by Tested-by on v1 1/3
#9 lore raw
In reply to Marek Vasut

Hi Marek

Quoted 66 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>
---
 drivers/core/root.c | 24 +++++++++++++++++++++++-
 include/dm/device.h |  3 +++
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/core/root.c +23 -1
index e09c12f4d6e..17dd1205a32 100644
@@ -361,6 +361,28 @@ void *dm_priv_to_rw(void *priv)
 }
 #endif
 
+static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only)
+{
+	u32 mask = DM_FLAG_PROBE_AFTER_BIND;
+	u32 flags = dev_get_flags(dev);
+	struct udevice *child;
+	int ret;
+
+	if (pre_reloc_only)
+		mask |= DM_FLAG_PRE_RELOC;
+
+	if ((flags & mask) == mask) {
+		ret = device_probe(dev);
+		if (ret)
+			return ret;
+	}
+
+	list_for_each_entry(child, &dev->child_head, sibling_node)
+		dm_probe_devices(child, pre_reloc_only);
+
+	return 0;
+}
+
 /**
  * dm_scan() - Scan tables to bind devices
  *
@@ -393,7 +415,7 @@ static int dm_scan(bool pre_reloc_only)
 	if (ret)
 		return ret;
 
-	return 0;
+	return dm_probe_devices(gd->dm_root, pre_reloc_only);
 }
 
 int dm_init_and_scan(bool pre_reloc_only)
include/dm/device.h +0 -0
index e0f86f5df9f..e7dd90399f9 100644

include/dm/device.h struct driver_info; · line 88

Quoted 9 lines
include/dm/device.h +3 -0
@@ -80,6 +80,9 @@ struct driver_info;
  */
 #define DM_FLAG_VITAL			(1 << 14)
 
+/* Device must be probed after it was bound */
+#define DM_FLAG_PROBE_AFTER_BIND	(1 << 15)
+
 /*
  * One or multiple of these flags are passed to device_remove() so that
  * a selective device removal as specified by the remove-stage and the

Tested on stm32mp157c-dk2 board
Thanks
Patrice

#10 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

So why not add an init_leds function to init_sequence_r?

--Sean

#11 lore raw
Quoted 10 lines · Sean Anderson
Quoted 7 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

So why not add an init_leds function to init_sequence_r?

Because this flag is generic solution and not hack specific to LEDs.

#12 lore raw
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Sean Anderson
Quoted 4 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

So why not add an init_leds function to init_sequence_r?

Because this flag is generic solution and not hack specific to LEDs.

Isn't init_sequence_r the generic solution? Every device gets probed that way (or directly as a result of a command).

--Sean

#13 lore raw
Quoted 11 lines · Sean Anderson
Quoted 10 lines · Marek Vasut
Quoted 9 lines · Sean Anderson
Quoted 7 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

So why not add an init_leds function to init_sequence_r?

Because this flag is generic solution and not hack specific to LEDs.

Isn't init_sequence_r the generic solution?

No, init_sequence_r is just a list of functions that gets called early on during boot to bring U-Boot up. One of the functions is initr_dm(), DM init, which brings up the driver model. The init_sequence_r has nothing to do with driver binding or probing though, that's the DM job.

Quoted 1 line

Every device gets probed that way (or directly as a result of a command).

No device probe gets triggered via init_sequence_r. There are many ad-hoc device_probe() calls in the various init_sequence_r function implementation, but that's all there because there is no better way to implement that within the DM framework so far. Now there is, with this flag, so those workarounds can also be cleaned up.

#14 lore raw
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Sean Anderson
Quoted 13 lines · Marek Vasut
Quoted 10 lines · Sean Anderson
Quoted 7 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

So why not add an init_leds function to init_sequence_r?

Because this flag is generic solution and not hack specific to LEDs.

Quoted 8 lines
Quoted 1 line

Isn't init_sequence_r the generic solution?

No, init_sequence_r is just a list of functions that gets called early on during boot to bring U-Boot up. One of the functions is initr_dm(), DM init, which brings up the driver model. The init_sequence_r has nothing to do with driver binding or probing though, that's the DM job.

Quoted 1 line

Every device gets probed that way (or directly as a result of a command).

No device probe gets triggered via init_sequence_r.
There are many ad-hoc device_probe() calls in the various init_sequence_r function implementation,

Every device in U-Boot is probed in one of three ways

- As a dependency of another device (clocks, pinmuxes, gpios, etc.)
- Directly on the command line (most boot devices)
- From an init_sequence (timers, watchdogs, serial, PCI, gpio hogs, etc.)

The goal of course being to minimize the amount of probed devices. This of course requires having some things at the "root" of the tree. In Linux, everything bound is probed until nothing more can be probed. In that sense, under Linux everything is the "root" of the tree. But for U-Boot the second two options specify the "roots."

Some of the things in init_sequence are ad-hoc, especially the non-DM stuff. LEDs are pretty ad-hoc, last I checked, but that's mainly because there are 2-3 separate non-DM ways to control LEDs.

Quoted 1 line

but that's all there because there is no better way to implement that within the DM framework so far. Now there is, with this flag, so those workarounds can also be cleaned up.

This *is* within the DM framework. Adding a flag which is set on bound devices has the same effect as dm_mux_init does when called from initr_dm_devices. The only difference is implementation. So why is this better?

--Sean

#15 lore raw
Quoted 23 lines · Sean Anderson
Quoted 22 lines · Marek Vasut
Quoted 11 lines · Sean Anderson
Quoted 10 lines · Marek Vasut
Quoted 9 lines · Sean Anderson
Quoted 7 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

So why not add an init_leds function to init_sequence_r?

Because this flag is generic solution and not hack specific to LEDs.

Isn't init_sequence_r the generic solution?

No, init_sequence_r is just a list of functions that gets called early on during boot to bring U-Boot up. One of the functions is initr_dm(), DM init, which brings up the driver model. The init_sequence_r has nothing to do with driver binding or probing though, that's the DM job.

Quoted 1 line

Every device gets probed that way (or directly as a result of a command).

Quoted 8 lines
Quoted 2 lines

No device probe gets triggered via init_sequence_r.
There are many ad-hoc device_probe() calls in the various init_sequence_r function implementation,

Every device in U-Boot is probed in one of three ways

- As a dependency of another device (clocks, pinmuxes, gpios, etc.)
- Directly on the command line (most boot devices)
- From an init_sequence (timers, watchdogs, serial, PCI, gpio hogs, etc.)

In short, the DM does lazy initialization of devices to boot quickly and waste few resources.

Quoted 1 line

The goal of course being to minimize the amount of probed devices.

This was never the goal. The probe() is called when needed, that's all.

Quoted 7 lines

This of course requires having
some things at the "root" of the tree. In Linux, everything bound is probed until nothing more can be probed. In that sense, under Linux everything is the "root" of the tree. But for U-Boot the second two options specify the "roots."

Some of the things in init_sequence are ad-hoc, especially the non-DM stuff. LEDs are pretty ad-hoc, last I checked, but that's mainly because there are 2-3 separate non-DM ways to control LEDs.

I'm not sure I understand this part, but maybe see

doc/develop/driver-model/design.rst

that should clarify the design decisions behind the DM.

Quoted 3 lines
Quoted 1 line

but that's all there because there is no better way to implement that within the DM framework so far. Now there is, with this flag, so those workarounds can also be cleaned up.

This *is* within the DM framework.

No, init_sequence_r/init_sequence_f is U-Boot init sequence. The DM init is only one step in that init sequence. Please do not conflate those two concepts.

Quoted 2 lines

Adding a flag which is set on bound devices has the same effect as dm_mux_init does when called from initr_dm_devices.

This cannot scale, you would have to add a huge list of such functions to init_sequence_r/init_sequence_f probably for each uclass, which would each do some sort of ad-hoc device_probe(), outside of DM. And neither of those functions would have easy access to the context of each driver instance, so they would have to work around that somehow (that's usually done by wasting cycles on traversing DT again or other such heuristics).

Quoted 2 lines

The only difference is implementation. So
why is this better?

See above. Also, this implementation is within the context of DM, i.e. driver/uclass bind call sets this flag for driver instances which for some reason need to be probe()d. The reason can be inferred from the driver instance context, e.g. because the DT node matching the driver instance contains some DT property, this flag is set, and the DM core probes the driver instead of only binding it. No need for any ad-hoc workarounds in init code.

#16 lore raw
In reply to Marek Vasut
Quoted 8 lines · Marek Vasut

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind().

Quoted 8 lines
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
Cc Sean Anderson <[email protected]>
Cc Simon Glass <[email protected]>
Cc Steven Lawrance <[email protected]>

Applied to u-boot/master, thanks!

Signature · 1 line
Tom