doc: dm: clarify activation.
PATCH 1/1 doc: dm: clarify activation.
Explain when devices should get activated.
--- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
doc/develop/driver-model/design.rst +20 -2
@@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^ -When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses are +different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated.
Signature · 1 line
2.37.1
Hi Michal,
Quoted 7 lines · Michal Suchanek
Explain when devices should get activated.
Signed-off-by Michal Suchanek <[email protected]>--- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
Much appreciated!
one note below
Quoted 6 lines
doc/develop/driver-model/design.rst +0
-0
doc/develop/driver-model/design.rst fall afoul of this rule. · line 801
Quoted 10 lines
doc/develop/driver-model/design.rst +5
-2@@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^ -When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses are
or the device code (e.g. device_get_child())
BTW probing a child probes all its parents automatically (that is said elsewhere I think).
Quoted 19 lines
doc/develop/driver-model/design.rst +15
-1+different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated. --
Quoted 2 lines
2.37.1
Regards,
Simon
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 7 lines · Michal Suchanek
Explain when devices should get activated.
Signed-off-by Michal Suchanek <[email protected]>--- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>Much appreciated!
one note below
Quoted 9 lines
doc/develop/driver-model/design.rst +0
-0@@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^
Quoted 9 lines
doc/develop/driver-model/design.rst fall afoul of this rule. · line 801
Quoted 7 lines
doc/develop/driver-model/design.rst +5
-2-When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses areor the device code (e.g.
device_get_child())
Can you elaborate a bit more, please?
This change is the reasult of some previous discussion about the device activation with Marek.
The device activation is really difficult to understand for people who did not participate in designing the DM, and is probably quite specific to U-Boot.
Quoted 3 lines
BTW probing a child probes all its parents automatically (that is said elsewhere I think).
Yes, right below this part.
Thanks
Michal
Quoted 25 lines
Quoted 20 lines
doc/develop/driver-model/design.rst +15
-1+different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated. --Quoted 2 lines
2.37.1
Regards,
Simon
Hi Michal,
Quoted 38 lines · Michal Suchánek
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 7 lines · Michal Suchanek
Explain when devices should get activated.
Signed-off-by Michal Suchanek <[email protected]>--- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>Much appreciated!
one note below
Quoted 9 lines
doc/develop/driver-model/design.rst +0
-0@@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^Quoted 9 lines
doc/develop/driver-model/design.rst fall afoul of this rule. · line 801
Quoted 7 lines
doc/develop/driver-model/design.rst +5
-2-When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses areor the device code (e.g.
device_get_child())
Quoted 1 line
Can you elaborate a bit more, please?
I mean that we can use 'device' code to probe, as well as the 'uclass' code. The function I cite is an example of that, but actually a better one is device_find_global_by_ofnode()
Quoted 7 lines
This change is the reasult of some previous discussion about the device activation with Marek.
The device activation is really difficult to understand for people who did not participate in designing the DM, and is probably quite specific to U-Boot.
OK, well good to have it. I wish more people would do what you have done here, i.e. go back and update the docs to clarify things that you found confusing / inadequate.
Quoted 10 lines
Quoted 4 lines
BTW probing a child probes all its parents automatically (that is said elsewhere I think).
Yes, right below this part.
Thanks
Michal
OK
Regards,
Simon
Quoted 26 lines
Quoted 26 lines
Quoted 21 lines
doc/develop/driver-model/design.rst +15
-1+different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated. --Quoted 2 lines
2.37.1
Regards,
Simon
Quoted 31 lines · Simon Glass
Hi Michal,
Quoted 28 lines · Michal Suchánek
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 7 lines · Michal Suchanek
Explain when devices should get activated.
Signed-off-by Michal Suchanek <[email protected]>--- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>Much appreciated!
one note below
Quoted 9 lines
doc/develop/driver-model/design.rst +0
-0@@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
doc/develop/driver-model/design.rst fall afoul of this rule. · line 801
Quoted 7 lines
doc/develop/driver-model/design.rst +5
-2-When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses are
When merging I will put the following here:
The device should be probed by the uclass code or generic device code (e.g. device_find_global_by_ofnode()). Uclasses differ but two common use cases can be seen:
Best regards
Heinrich
Quoted 64 lines
Quoted 4 lines
Quoted 2 lines
or the device code (e.g.
device_get_child())Can you elaborate a bit more, please?
I mean that we can use 'device' code to probe, as well as the 'uclass' code. The function I cite is an example of that, but actually a better one is
device_find_global_by_ofnode()Quoted 7 lines
This change is the reasult of some previous discussion about the device activation with Marek.
The device activation is really difficult to understand for people who did not participate in designing the DM, and is probably quite specific to U-Boot.
OK, well good to have it. I wish more people would do what you have done here, i.e. go back and update the docs to clarify things that you found confusing / inadequate.
Quoted 10 lines
Quoted 4 lines
BTW probing a child probes all its parents automatically (that is said elsewhere I think).
Yes, right below this part.
Thanks
Michal
OK
Regards,
SimonQuoted 26 lines
Quoted 26 lines
Quoted 21 lines
doc/develop/driver-model/design.rst +15
-1+different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated. --Quoted 2 lines
2.37.1
Regards,
Simon
Hello,
Quoted 42 lines · Heinrich Schuchardt
Quoted 31 lines · Simon Glass
Hi Michal,
Quoted 28 lines · Michal Suchánek
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 7 lines · Michal Suchanek
Explain when devices should get activated.
Signed-off-by Michal Suchanek <[email protected]>--- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>Much appreciated!
one note below
Quoted 9 lines
doc/develop/driver-model/design.rst +0
-0@@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
doc/develop/driver-model/design.rst fall afoul of this rule. · line 801
Quoted 7 lines
doc/develop/driver-model/design.rst +5
-2-When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses areWhen merging I will put the following here:
Quoted 3 lines
The device should be probed by the uclass code or generic device code (e.g.
device_find_global_by_ofnode()). Uclasses differ but two common use cases can be seen:
I wanted to look at this direct device lookup, and send a v2 when I am done with it. I am currently trying to figure out how (if at all) the pins and clocks required by i2c devices are activated, and I suppose this direct lookup would be related.
Noneteless, if you can fix up the patch right away that's great.
Thanks
Michal
Quoted 70 lines
Best regards
Heinrich
Quoted 64 lines
Quoted 4 lines
Quoted 2 lines
or the device code (e.g.
device_get_child())Can you elaborate a bit more, please?
I mean that we can use 'device' code to probe, as well as the 'uclass' code. The function I cite is an example of that, but actually a better one is
device_find_global_by_ofnode()Quoted 7 lines
This change is the reasult of some previous discussion about the device activation with Marek.
The device activation is really difficult to understand for people who did not participate in designing the DM, and is probably quite specific to U-Boot.
OK, well good to have it. I wish more people would do what you have done here, i.e. go back and update the docs to clarify things that you found confusing / inadequate.
Quoted 10 lines
Quoted 4 lines
BTW probing a child probes all its parents automatically (that is said elsewhere I think).
Yes, right below this part.
Thanks
Michal
OK
Regards,
SimonQuoted 26 lines
Quoted 26 lines
Quoted 21 lines
doc/develop/driver-model/design.rst +15
-1+different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated. --Quoted 2 lines
2.37.1
Regards,
Simon