-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
drivers: syscon: Set default for CONFIG_SYSCON to y #38762
Conversation
For reference, https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3177749 is the change that integrates syscon. If we don't have this default value for CONFIG_SYSCON then we would need to also make changes to all the boards under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using simple changing the default for CONFIG_SYSCON
to y
in the soc/<arch>/<soc>/Kconfig.defconfig.series
for the SoCs containing a SYSCON device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ugly. What about using something like
default y if $(dt_compat_enabled,$(DT_COMPAT_SYSCON))
or something like that
My initial approach was actually to collapse the two into a single config SYSCON (which in a way is very similar to what you said @carlocaione). It would remove
Would that work for you? I was thinking it was too big of a change and decided to go with the minimal approach originally. |
This will require changes if we bring in a SoC specific SYSCON driver in the future. I think we need to keep the "top-level" Kconfig for enabling SYSCON support and then have the drivers underneath that (as it is today). |
I see what you're saying, I would argue that CONFIG_SYSCON then is obsolete. We could do something similar to the logging template where CONFIG_SYSCON is enabled automatically if CONFIG_SYSCON_GENERIC is enabled (eventually other implementations). Should I update the PR so it's easier to see? |
As far as I can tell, this would go against how all other drivers (except maybe interrupt controllers, where we recently had issues due to this exact construct (no top-level gating, see #37910 (comment))) handles Kconfig. |
Note that currently CONFIG_SYSCON=y is required. There's an ongoing PR (zephyrproject-rtos/zephyr#38762) to remove that requirement in favor of simply detecting an enabled node in DT via the compatible string. BRANCH=none BUG=b:179900857, b:165777478, b:200642229 TEST=zmake testall Signed-off-by: Yuval Peress <[email protected]> Change-Id: Idad1f53afbda503e0e0b2fdf2931d5267a391d4d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3177749 Reviewed-by: Sam Hurst <[email protected]>
ddf7c27
to
8426328
Compare
Ping, I went ahead with the original suggestion of defaulting the CONFIG_SYSCON the same as CONFIG_GENERIC_SYSCON. Thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense to default the syscon drivers menu based on the devicetree settings.
Downstream users with custom drivers can do similar, and use zephyr_library_amend()
to place a custom driver in the lib.
Just a minor nit.
Currently for large projects with many boards, using the syscon driver is a bit of a pain. It has the convinience of using dt_compat_enabled for CONFIG_GENERIC_SYSCON but that only works if CONFIG_SYSCON is also enabled. Set the default for CONFIG_SYSCON to use the compat string. This makes using syscon much simpler since all a developer needs to do is add it to the devicetree and set the status to "okay". Signed-off-by: Yuval Peress <[email protected]>
Accidentally force pushed the wrong commit, all better now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial comment still stands:
How about using simple changing the default for
CONFIG_SYSCON
toy
in thesoc/<arch>/<soc>/Kconfig.defconfig.series
for the SoCs containing a SYSCON device?
Why does this need to be handled differently than all other drivers classes?
But wouldn't that result in the same issue that @mbolivar-nordic tries to cleanup here ? Having a
Maybe we need to rethink how we enable drivers in general and where we place them in libraries. |
While I agree with @henrikbrixandersen I wanted to point out that something similar is already used in zephyr, see https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/i2c/Kconfig.stm32#L7 |
I think there's precedence for most different ways to enable things. I would propose that we create an issue to discuss this and once there are several comments on it we can bring it up at the weekly dev meeting? |
Ping |
Feel free to bring this to the next dev-meeting. Add a label for that in this case. |
Done |
Discussed at dev meeting, no longer needed. |
Currently for large projects with many boards, using the syscon driver
is a bit of a pain. It has the convinience of using dt_compat_enabled
for CONFIG_GENERIC_SYSCON but that only works if CONFIG_SYSCON is
also enabled.
Set the default for CONFIG_SYSCON=y so that the driver can be enabled
by simply setting the devicetree node to
status = "okay";
Signed-off-by: Yuval Peress [email protected]