-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
driver: sleeptimer: siwx917: Add siwx91x Sleeptimer driver #87603
base: main
Are you sure you want to change the base?
Conversation
The following west manifest projects have changed revision in this Pull Request:
⛔ DNM label due to: 1 project with PR revision Note: This message is automatically posted and updated by the Manifest GitHub Action. |
349e9e6
to
4a67912
Compare
I was not able to checkout to that branch... ran into some issues. Wasn't able to access it. Thus created an another branch resolving the compliance issue |
You shouldn't need to create a new branch or PR to fix such issues, rather you should be able to just |
Noted. |
reg = <0x24048c00 0x78>; | ||
interrupts = <22 0>; | ||
interrupt-parent = <&nvic>; | ||
interrupt-names = "irq022"; |
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.
Can you provide a meaningful name for the user?
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.
IRQ_CONNECT(DT_IRQ(DT_RTC, irq), DT_IRQ(DT_RTC, priority),
CONCAT(DT_STRING_UPPER_TOKEN_BY_IDX(DT_RTC, interrupt_names, 0), _IRQHandler),
0, 0);
for 917 it requires to be _Handler instead...
dtsi we could keep it as systrc & in dts we could name it as irq022.. @jerome-pouiller what's your say on it?
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.
See my comment above: if the upstream is okay, we solve the issue by defining an alias to IRQ022_Handler
.
dts/arm/silabs/siwg917.dtsi
Outdated
interrupts = <22 0>; | ||
interrupt-parent = <&nvic>; | ||
interrupt-names = "irq022"; | ||
clock-frequency = <32768>; |
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.
You can use <DT_FREQ_K(32)>
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.
Use will take it up.. will be addressed
dts/arm/silabs/siwg917.dtsi
Outdated
compatible = "silabs,gecko-stimer"; | ||
reg = <0x24048c00 0x78>; | ||
interrupts = <22 0>; | ||
interrupt-parent = <&nvic>; |
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.
Is it required? Until now, we didn't specified the interrupt controller.
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.
I have updated the changes
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.
Agree with jérome, actually in the dtsi of other board, we do not used interrupt-parent, why it is needed ?
default n if SILABS_SLEEPTIMER_TIMER | ||
|
||
configdefault SYS_CLOCK_TICKS_PER_SEC | ||
default 1024 if SILABS_SLEEPTIMER_TIMER |
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.
@asmellby has found 1024 was not enough to pass Zephyr timer tests. Maybe:
configdefault SYS_CLOCK_TICKS_PER_SEC
default 128 if !TICKLESS_KERNEL && SILABS_SLEEPTIMER_TIMER
default 32768 if SILABS_SLEEPTIMER_TIMER
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.
When checked zephyr timer fails with the above configurations, where with 1024 it passes.
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.
which zephyr timer test have you done ?
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.
behaviour_timer test app
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.
32768 makes sense on EFR32, since that's what is used in SiSDK. Wiseconnect uses 1024 in FreeRTOS, though, so IMO it makes sense to keep it the same here.
@@ -3,6 +3,15 @@ | |||
|
|||
if SOC_FAMILY_SILABS_SIWX91X | |||
|
|||
configdefault SILABS_SLEEPTIMER_TIMER | |||
default y |
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.
SLEEPTIMER
has some drawbacks. Maybe default y if PM
?
@@ -151,5 +152,32 @@ if(CONFIG_WISECONNECT_NETWORK_STACK) | |||
) | |||
endif() # CONFIG_WISECONNECT_NETWORK_STACK | |||
|
|||
# Sleeptimer for 917 devices |
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 comment only repeats the code. Drop it.
soc/silabs/Kconfig.siwx91x
Outdated
bool | ||
select CODE_DATA_RELOCATION | ||
help | ||
Set if the Sleeptimer HAL module is used for SIWX91X. |
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.
Bad indentation
@@ -121,9 +121,15 @@ static int sleeptimer_init(void) | |||
sl_status_t status = SL_STATUS_OK; | |||
struct sleeptimer_timer_data *timer = &g_sleeptimer_timer_data; | |||
|
|||
#ifdef CONFIG_SOC_FAMILY_SILABS_SIWX91X |
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.
I am annoyed with that. A driver should be independent of the underlying SoC.
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.
IRQ_CONNECT(DT_IRQ(DT_RTC, irq), DT_IRQ(DT_RTC, priority),
CONCAT(DT_STRING_UPPER_TOKEN_BY_IDX(DT_RTC, interrupt_names, 0), _IRQHandler),
0, 0);
for efr it's been concat with _IRQHandler so I have defined with way for 91x..
Is there any other ways we could handle it?
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.
It seems wiseconnect define some aliases for compliance with cmsis:
#define UDMA0_IRQHandler IRQ033_Handler
#define UDMA1_IRQHandler IRQ010_Handler
#define I2S0_IRQHandler IRQ064_Handler
#define I2S1_IRQHandler IRQ014_Handler
#define I2C0_IRQHandler IRQ042_Handler
#define I2C1_IRQHandler IRQ061_Handler
#define I2C2_IRQHandler IRQ013_Handler
#define WDT_IRQHandler IRQ020_Handler
Do you think the upstream would be okay to add an alias for IRQ022?
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.
I'm certainly not sure, @asmellby could you please provide your 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.
I agree that if we can put such a define in an appropriate header, that would make it cleaner. It would honestly be even better if the function name for the ISR was part of the sleeptimer interface, but that's not the case.
I suggest putting the alias in soc/silabs/silabs_siwx91x/siwg917/soc.h for now.
@@ -16,6 +16,7 @@ zephyr_compile_definitions( | |||
SLI_SI91X_MCU_INTERFACE | |||
SLI_SI917 | |||
SLI_SI917B0 | |||
SLI_SI91X_ENABLE_OS |
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.
I have not been able to find documentation for this symbols. What it is doing?
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.
In sl_sleeptimer_hal_si91x_sysrtc.c as part of sleeptimer_hal_init_timer
#ifdef SLI_SI91X_ENABLE_OS
//Giving higher priority to SYSRTC to service wakeup
NVIC_SetPriority(NPSS_TO_MCU_SYRTC_INTR_IRQn, SYSRTC_IRQ_PRIORITY);
#endif
To enable OS --> Add SLI_SI91X_ENABLE_OS in preprocessor */
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.
Interrupts are normally managed by Zephyr. Typically, we have to apply the priority defined in the DT (interrupts = <22 0>
).
SL_CODE_COMPONENT_SLEEPTIMER=sleeptimer | ||
SL_CODE_COMPONENT_HAL_SYSRTC=hal_sysrtc | ||
) | ||
endif() # CONFIG_SOC_SILABS_SLEEPTIMER |
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 section is redundant with modules/hal_silabs/simplicity_sdk/CMakeLists.txt
. Maybe we should split the SOC_SILABS_SLEEPTIMER
symbol in smaller parts:
config SOC_SILABS_SLEEPTIMER
depends on SOC_SILABS_SIWX91X_SYSRTC || SOC_SILABS_S2_SYSRTC
@asmellby what is your opinion here?
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.
We need to clean up the HAL level Kconfig symbols in general. Symbols are being mixed between the GSDK and SiSDK HALs, and the scope of symbols is often tied to their use in Zephyr, rather than the feature they provide from the HAL. We should redo all the SiSDK symbols to properly map to SiSDK drivers, which will make them more easily composable and reusable for SiWx91x. But that should be a separate PR from this one.
4a67912
to
0116259
Compare
This commit enables the Sleeptimer driver support for the siwx917 device. Signed-off-by: S Mohamed Fiaz <fiaz.mohamed@silabs.com>
0116259
to
1e31504
Compare
if SOC_FAMILY_SILABS_SIWX91X | ||
source "soc/silabs/silabs_siwx91x/Kconfig" | ||
endif | ||
|
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.
I believe this addition is redundant with rsource "*/Kconfig"
above.
This commit enables the Sleeptimer driver support for the siwx917 device.