kernel: Device deferred initialization

Currently, all devices are initialized at boot time (following their
level and priority order). This patch introduces deferred
initialization: by setting the property `zephyr,deferred-init` on a
device on the devicetree, Zephyr will not initialized the device.

To initialize such devices, one has to call `device_init()`.

Deferred initialization is done by grouping all deferred devices on a
different ELF section. In this way, there's no need to consume more
memory to keep track of deferred devices. When `device_init()` is
called, Zephyr will scan the deferred devices section and call the
initialization function for the matching device. As this scanning is
done only during deferred device initialization, its cost should be
bearable.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
This commit is contained in:
Ederson de Souza 2024-01-05 13:29:20 -08:00 committed by Anas Nashif
commit eeebb4d911
4 changed files with 111 additions and 25 deletions

View file

@ -92,3 +92,9 @@ properties:
mbox-names:
type: string-array
description: Provided names of mailbox / IPM channel specifiers
zephyr,deferred-init:
type: boolean
description: |
Do not initialize device automatically on boot. Device should be manually
initialized using device_init().