-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device (de)initialization use case #40385
Comments
Is device de/initialization only concerned with the FW structures, or also the HW state? Consider when application code inherits a running device initialized by boot code, and de-initialization is not an option. The simplest example of this is GPIOs, but it is effectively true of every HW block touched by boot code. Consider also the scope of de-initialization. Does it return the HW block to a reset state? Does it clear out all pending interrupts? Does it make sure no pending DMA transactions are left hanging? What state should the HW be left in before boot code calls the application code? |
This would be huge! I'm porting Zephyr to a board that has an odd SPI communication between the main controller and the ble chipset (nordic nrf52832). The BLE chipset (which I'm porting Zephyr) is the slave in the SPI bus, but it also uses the chipselect as a wake pin for the main controller. One dev has suggest the use of dynamic pinctrl, but currently, as we don't have de-initialization, I can't use that. |
Looking the requirements listed, the "Cross-over requirements" seem to only apply to the de-initialization use case. If the deferred initialization The deferred initialization could always be updated if de-initialization support is added later. I have a use case for supporting multiple board configurations with a single image. With deferred init, a devicetree could do the following:
The application can the chose the device to initialize:
I'm happy to create an RFC and draft PR for the deferred initialization only use case. |
A Discord thread: |
I'm also interested in such use case (more description here: #60209). I also tend to agree that deferred (on demand) initialization in user programs shall be separated from de-init of device, as it would fulfill above requirement and would be easier to implement. |
@carlescufi @keith-zephyr @tbursztyka - Has been there any ongoing development or at least some kind of a "road map" for the deferred initialization of drivers? |
We (Nordic) have plans to look at this in the near future @lmajewski. But we will welcome any help we can get! |
The "near future" :-) doesn't seem like a fixed date ... I would be interested in adding support for in-user application initialization of DTS disabled (but defined) devices on-demand (according to @keith-zephyr pseudo code example). For my use case (described at #60209 in details) - I don't need the de-initialization feature. @carlescufi - do you think that such approach (and tasks division) would be feasible? |
@carlescufi Can you add this discussion topic to the next Arch WG? Specifically, can we get some consensus on a roadmap for some of the device model changes (deferrred init, de-init, PM handling, etc). |
@lmajewski @keith-zephyr sorry, was on vacation. I will schedule this for next week's arch wg meeting (August 1st). There we can discuss how to decouple it from PM and how to plan the work. |
@carlescufi - is there any input or decision regarding this issue after the meeting? |
FYI this did not make it to last week meeting, let's tag it for one of the next ones. |
@carlescufi @fabiobaltieri - Is there any schedule for those meetings? Would it be possible to attend them ? (I do guess that those are held on discord?) |
if you set the status to "reserved", it will not be started in whatever init level it is put, this seems to work right now already, so we could just focus on exposing the init API and do the right thing for such reserved instances later in the boot process. |
@nashif Is there any work-in-progress code or sketch of proposed API design ? |
not yet. |
Thinking about this appraoch, while it appears to provide a solution that does not require us to define a new behaviour with something like "reserved", it might not give us what we want given how init of drivers is done right now. With status set to
So if we want to use |
Not mentioned yet that this is pretty much a must-have for power management too. In many microcontrollers peripherals get reset in power down modes and trying to re-initialise them with the current code is not really possible. |
ok, IMO we should close this issue and refer to the 2 issues being discuss in their respective open issues, otherwise it will continue to be confusing:
|
There seems to be a cross-over of uses-cases/requirements between 2 issues around device initialization, so gathering both here for tracking and discussion.
Let's summarize the requirements:
Add the ability to manually initialize a device:
This means adding 2 things:
Add the ability to de-initialize a device:
Cross-over requirements:
The text was updated successfully, but these errors were encountered: