-
Notifications
You must be signed in to change notification settings - Fork 7.5k
drivers: counter: migrate AGT counter to use FSP function #87881
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: counter: migrate AGT counter to use FSP function #87881
Conversation
thenguyenyf
commented
Mar 31, 2025
- Migrate the AGT counter implementation to use FSP r_agt APIs
- Add support for AGT 32bit
- Add ztests/samples support for Renesas RA boards
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
b4be15e
to
d8d59cc
Compare
756a8ad
to
a8dd5ee
Compare
Last push just to rebase and solve conflict |
a8dd5ee
to
5d21d8b
Compare
5d21d8b
to
6e0f79c
Compare
Hello @duynguyenxa , @thaoluonguw , @nordic-krch . Could you please take a look? |
6e0f79c
to
3a515b0
Compare
return -ENOTSUP; | ||
err = R_AGT_Start(&data->agt_ctrl); | ||
if (err != FSP_SUCCESS) { | ||
LOG_ERR("counter start failed"); |
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.
@thenguyenyf , small nit, use upper for first letter
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 fixed it
int ret = 0; | ||
|
||
if (cfg->ticks > config->info.max_top_value) { | ||
LOG_ERR("top value exceed maximum value"); |
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.
diito
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 fixed it
return -EBUSY; | ||
ret = renesas_ra_agt_period_set(dev, cfg->ticks); | ||
if (ret != 0) { | ||
LOG_ERR("counter period set failed"); |
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.
ditto
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 fixed it
if (reset) { | ||
err = R_AGT_Reset(&data->agt_ctrl); | ||
if (err != FSP_SUCCESS) { | ||
LOG_ERR("counter reset failed"); |
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.
ditto
int ret = 0; | ||
|
||
if (counter_renesas_ra_agt_get_top_value(dev) < guard) { | ||
LOG_ERR("invalid guard rate"); |
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.
ditto
/* No divider can be used when count source is AGT_CLOCK_AGT_UNDERFLOW */ | ||
err = R_AGT_InfoGet(&data->agt_ctrl, &info); | ||
if (err != FSP_SUCCESS) { | ||
LOG_ERR("counter get freq failed"); |
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.
ditto
return FSP_SUCCESS; | ||
} | ||
if (counter_renesas_ra_agt_get_value(dev, &now) != 0) { | ||
LOG_WRN("error in counter alarm"); |
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.
ditto
hi @thenguyenyf , the |
8cd48ec
to
317daa7
Compare
Modify the expected ticks check to adapt with a downward counter instance Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Migrate renesas,ra-agt-counter implementation to use hal_renesas. Add additional AGT_CLOCK_SUBCLOCK count source. Add constraint for counter resolution to 32 or 16 bit variant. Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Add device node for AGT counter support on Renesas RA family Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Enable test support for renesas,ra-agt-counter Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Add overlay to enable counter node for Renesas RA devices Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Because this is a common testing scenario, almost any counter instance should be able to run. Some counter instances cannot run this sample should be filtered by platform_exclude or filter keywords. Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
317daa7
to
230860d
Compare
Hello @thaoluonguw , @duynguyenxa , @nordic-krch . Could you please take a look? |
|
- s32z2xxdc2/s32z270/rtu1 | ||
- s32z2xxdc2@D/s32z270/rtu0 | ||
- s32z2xxdc2@D/s32z270/rtu1 | ||
- lp_em_cc2340r5 |
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.
Hi @thenguyenyf
This PR is causing CI errors: https://github.com/zephyrproject-rtos/zephyr/actions/runs/15273910745/job/42955888437?pr=90662
Please provide a fix or return platform_allow.