dts/bindings/renesas,smartbond-lp-osc: Substitute calibration-interval

Substitute calibration-interval property with kconfig option
SMARTBOND_LP_OSC_CALIBRATION_INTERVAL

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
This commit is contained in:
Ioannis Damigos 2024-05-17 17:29:21 +03:00 committed by Carles Cufí
commit ffa5b30c33
4 changed files with 14 additions and 17 deletions

View file

@ -8,3 +8,14 @@ config CLOCK_CONTROL_SMARTBOND
depends on SOC_FAMILY_RENESAS_SMARTBOND depends on SOC_FAMILY_RENESAS_SMARTBOND
help help
Enable driver for Clock Control subsystem found in SmartBond Enable driver for Clock Control subsystem found in SmartBond
if CLOCK_CONTROL_SMARTBOND
config SMARTBOND_LP_OSC_CALIBRATION_INTERVAL
int "Low-power oscillators calibration interval"
default 1
range 1 10
help
Time in seconds between calibration of low power clock RC32K and RCX.
endif # CLOCK_CONTROL_SMARTBOND

View file

@ -30,9 +30,7 @@ struct lpc_clock_state {
.rc32k_freq = DT_PROP(DT_NODELABEL(rc32k), clock_frequency), .rc32k_freq = DT_PROP(DT_NODELABEL(rc32k), clock_frequency),
}; };
#define CALIBRATION_INTERVAL (DT_NODE_HAS_STATUS(DT_NODELABEL(rcx), okay) ? \ #define CALIBRATION_INTERVAL CONFIG_SMARTBOND_LP_OSC_CALIBRATION_INTERVAL
DT_PROP(DT_NODELABEL(rcx), calibration_interval) : \
DT_PROP(DT_NODELABEL(rc32k), calibration_interval))
#ifdef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME #ifdef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
extern int z_clock_hw_cycles_per_sec; extern int z_clock_hw_cycles_per_sec;
@ -91,7 +89,7 @@ static void smartbond_start_rc32k(void)
CRG_TOP->CLK_RC32K_REG |= CRG_TOP_CLK_RC32K_REG_RC32K_ENABLE_Msk; CRG_TOP->CLK_RC32K_REG |= CRG_TOP_CLK_RC32K_REG_RC32K_ENABLE_Msk;
} }
lpc_clock_state.rc32k_started = true; lpc_clock_state.rc32k_started = true;
if (!lpc_clock_state.rc32k_ready && (CALIBRATION_INTERVAL > 0)) { if (!lpc_clock_state.rc32k_ready) {
if (!k_work_is_pending(&calibration_work.work)) { if (!k_work_is_pending(&calibration_work.work)) {
k_work_schedule(&calibration_work, k_work_schedule(&calibration_work,
K_MSEC(1000 * CALIBRATION_INTERVAL)); K_MSEC(1000 * CALIBRATION_INTERVAL));
@ -106,7 +104,7 @@ static void smartbond_start_rcx(void)
da1469x_clock_lp_rcx_enable(); da1469x_clock_lp_rcx_enable();
lpc_clock_state.rcx_started = true; lpc_clock_state.rcx_started = true;
} }
if (!lpc_clock_state.rcx_ready && (CALIBRATION_INTERVAL > 0)) { if (!lpc_clock_state.rcx_ready) {
if (!k_work_is_pending(&calibration_work.work)) { if (!k_work_is_pending(&calibration_work.work)) {
k_work_schedule(&calibration_work, k_work_schedule(&calibration_work,
K_MSEC(1000 * CALIBRATION_INTERVAL)); K_MSEC(1000 * CALIBRATION_INTERVAL));

View file

@ -46,7 +46,6 @@
rc32k: rc32k { rc32k: rc32k {
compatible = "renesas,smartbond-lp-osc"; compatible = "renesas,smartbond-lp-osc";
clock-frequency = <DT_FREQ_K(32)>; clock-frequency = <DT_FREQ_K(32)>;
calibration-interval = <1>;
#clock-cells = <0>; #clock-cells = <0>;
status = "okay"; status = "okay";
}; };
@ -60,7 +59,6 @@
rcx: rcx { rcx: rcx {
compatible = "renesas,smartbond-lp-osc"; compatible = "renesas,smartbond-lp-osc";
clock-frequency = <DT_FREQ_K(15)>; clock-frequency = <DT_FREQ_K(15)>;
calibration-interval = <1>;
#clock-cells = <0>; #clock-cells = <0>;
status = "disabled"; status = "disabled";
}; };

View file

@ -13,16 +13,6 @@ include:
- clock-frequency - clock-frequency
properties: properties:
calibration-interval:
type: int
default: 1
description: |
Time in seconds between calibration of low power clock RCX or RC32K.
For XTAL32K this value is not used.
If set to 0 calibration will not be performed. This can be applied
when XTAL32K is enabled for low power clock and RCX or RC32K is used
for watchdog and strict timing is not required.
settle-time: settle-time:
type: int type: int
default: 8000 default: 8000