Skip to content

drivers: counter: rts5912: add support timer32 counter driver #86388

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

Merged

Conversation

Titan-Realtek
Copy link
Contributor

Port rts5912 timer32 counter driver on Zephyr

struct counter_rts5912_config {
struct counter_config_info info;
void (*config_func)(void);
struct timer32_type *base_address;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the volatile attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

@Titan-Realtek Titan-Realtek force-pushed the driver_timer32_rts5912 branch from 8503cc3 to d088fca Compare March 27, 2025 22:42

#ifndef ZEPHYR_SOC_REALTEK_RTS5912_REG_TMR32_H
#define ZEPHYR_SOC_REALTEK_RTS5912_REG_TMR32_H

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Titan, here may should be ZEPHYR_SOC_REALTEK_RTS5912_REG_TIMER_H
Thanks!

* the counter values are changed so that interrupts are triggered
* when the counters reach zero.
*/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Titan,
please help to check if these header included is all used in this driver, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@Titan-Realtek Titan-Realtek force-pushed the driver_timer32_rts5912 branch from d088fca to e0038fa Compare March 31, 2025 04:03
#include "reg/reg_system.h"
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/clock_control/clock_control_rts5912.h>
#include <zephyr/logging/log.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Titan,
please help to check if these header included is all used in this driver, thanks!

sorry for that I misquote the range of header in last comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <zephyr/kernel.h>
#include <zephyr/drivers/counter.h>
#include <soc.h>
#include <errno.h>
#include <stdbool.h>
#include "reg/reg_timer.h"
#include "reg/reg_system.h"
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/clock_control/clock_control_rts5912.h>
#include <zephyr/logging/log.h>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@Titan-Realtek Titan-Realtek force-pushed the driver_timer32_rts5912 branch 2 times, most recently from 9f5c72e to 41bf570 Compare March 31, 2025 04:54
clocks = <&sccon RTS5912_SCCON_PERIPH_GRP1 PERIPH_GRP1_TMR5_CLKPWR>;
clock-names = "tmr32";
max-value = <0xFFFFFFFF>;
clock-frequency = <25000000>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@Titan-Realtek Titan-Realtek force-pushed the driver_timer32_rts5912 branch from 41bf570 to c28e38b Compare April 8, 2025 01:42
keith-zephyr
keith-zephyr previously approved these changes Apr 9, 2025
Port rts5912 timer32 counter driver on Zephyr

Signed-off-by: Titan Chen <[email protected]>
@Titan-Realtek Titan-Realtek force-pushed the driver_timer32_rts5912 branch from c5c1cf2 to 4b87c4d Compare April 10, 2025 01:58
@keith-zephyr
Copy link
Collaborator

@nordic-krch please take a look.

@JasonLin-RealTek JasonLin-RealTek self-requested a review April 21, 2025 14:25
@kartben kartben merged commit 2bca8d4 into zephyrproject-rtos:main Apr 22, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants