-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
RFC: Enable device by using dts, not Kconfig #10621
Comments
Thanks for this proposal. Indeed STM32 GPIO driver should be moved to dts information usage. About using using dts to select instances to activate, there has been discussions about that (you could check issue #8499 which lists all the open points) already and for now decision is to keep it as Kconfig responsibility, mainly because there there is a UI available for Kconfig (menuconfig) and not for dts. |
I'm reviving this old issue to continue discussion on how to handle per-instance Kconfigs. I can see the following options:
Thoughts on these? Did I miss anything? Edit: option 3. also relates to #19448 (which in turn relates to #24318). I'm being intentionally vague when I say "let node status properties control" -- we need to consider if going with 3. requires refinements to the way status works. cc @carlescufi @MaureenHelm @henrikbrixandersen @erwango @mnkp @galak @anangl @pabigot @nashif |
I feel like the ship has sailed on #1. I'd argue that #2 should not be allowed and that we are moving towards #3 already. For example - here's a rough idea for serial drivers, the majority of cases that are under 15 lines are just singletons to enable/disable the driver.
|
I would definitely go for 3) as well. I would like to stress, however, that it must still be possible to disable a driver (not its instances, those should be handled through devicetree) through Kconfig. |
+1 |
+1 |
DEV-REVIEW: In general no issues with the general direction here (option #3), need to deal with some issues associated with mis-matched configuration between removal of Kconfig and what dts enables, also some power mgmt issues in that we might enable things sub-optimally now (we can look to use reference count here as well as warning checks for various controllers enabled w/o any deps). @mbolivar-nordic to add general policy to DTS docs. |
Instantiate RTT UART instances from devicetree nodes instead of from Kconfig symbols. While RTT is implemented using software, not hardware, it is emulating a hardware device, and thus should be configured through devicetree. This allows the simulated UART device to be selected via devicetree aliases and chosen nodes. The following devicetree snippet will instantiate RTT channels 0 and 2 as UART devices. ``` / { rtt0: rtt_terminal { compatible = "segger,rtt-uart"; label = "rtt_terminal"; status = "okay"; }; rtt2: rtt_secondary { compatible = "segger,rtt-uart"; label = "rtt_app_specific"; status = "okay"; }; }; ``` Fixes the RTT portion of #10621. Signed-off-by: Jordan Yates <[email protected]>
I think we can safely call this issue closed at this point 🎉 If anyone is aware of a device driver that isn't allocating instances from devicetree, I think we should treat that as a bug or deficiency in that particular driver. |
Fair, there are still some driver classes like IEEE 802154 that dont utilize devicetree, but I'm fine w/closing this and opening specific bugs for those drivers. |
Yeah, I've been looking at the list in #10516 to understand what's still left to do. I think that tracker covers the remaining work although a lot of drivers have moved around or gotten deleted since that initial list. |
The most drivers use Kconfig to select which device compiled and which not currently. eg:
(CONFIG_GPIO_STM32_PORTA is a variable defined in Kconfig)
And the 'status = "ok"' in dts seems useless because the drivers doesn't need the defines generated from dts. Drivers use the peripheral's base address, irq number and other informations provide by HAL.
In the above code, GPIOA_BASE,_STM32_PERIPH_GPIOA... are provided by stm32cube.
How about replace this informations by using the marcos generated from dts? Remove all Kconfig variables such as CONFIG_GPIO_STM32_PORTB, use the peripheral base address generated from dts to determined which device should compiled.
Here is a example in drivers/spi/spi-sam.c:
So we don't need select which spi port we used in Kconfig, can use dts select spi port directly.
The text was updated successfully, but these errors were encountered: