-
Notifications
You must be signed in to change notification settings - Fork 802
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
[rtl, aon_timer] Reset core.prescale_count on wkup_ctrl write #25616
[rtl, aon_timer] Reset core.prescale_count on wkup_ctrl write #25616
Conversation
30f7697
to
ca3ed02
Compare
ca3ed02
to
fbe6303
Compare
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 think the RTL now looks right to me. Would you mind adding some documentation on the new behavior. Specifically that any write to the wkup_ctrl register now resets the prescalar including the enable bit.
Can you try this instead to fix the lint errors:
|
The AON timer core has an internal counter `prescale_count_q` which is not reset upon each write to wkup_ctrl. This causes issues if the WKUP timer is re-configured to a lower prescaler value than it was before, and the `prescale_count_q` variable is greater than the new prescaler value, forcing the `prescale_count_q` counter to overflow itself causing a non-spec compliant behavior. In order to mitigate the above, the internal `prescale_count_q` is reset after wkup_ctrl write. Thus, the aon timer is forced to count from scratch the new intended prescaler value. Signed-off-by: Antonio Martinez Zambrana <[email protected]>
fbe6303
to
1f75cdf
Compare
Yep - I'll create a PR adding this new behavior to the doc. Will add you as a reviewer and link here. Also, just pushed the changes adding |
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.
HW looks good to me.
Signed-off-by: Antonio Martinez Zambrana <[email protected]>
@marnovandermaas I've moved the doc commit here as you suggested |
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 looks correct to me, thanks for pursuing this fix.
CHANGE AUTHORIZED: hw/ip/aon_timer/data/aon_timer.hjson |
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 looks sensible to me. Thanks for sorting it out. (I wrote two versions of "isn't this wrong because...", and then realised that the change is correct!)
CHANGE AUTHORIZED: hw/ip/aon_timer/data/aon_timer.hjson The only change to behaviour comes from the change to |
The AON timer core has an internal counter
prescale_count_q
which is not reset upon each write to wkup_ctrl.This causes issues if the WKUP timer is re-configured to a lower prescaler value than it was before, and the
prescale_count_q
variable is greater than the new prescaler value, forcing theprescale_count_q
counter to overflow itself causing a non-spec compliant behavior.In order to mitigate the above, the internal
prescale_count_q
is reset after wkup_ctrl write. Thus, the aon timer is forced to count from scratch the new intended prescaler value.Docs PR is #25904