drivers: clock_control: Add condition to verify the CPU clock config

- Add a condition to check the clock supplying the CPU to match with
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
- Correct CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for EK-RA4W1

Signed-off-by: Tran Van Quy <quy.tran.pz@renesas.com>
This commit is contained in:
Tran Van Quy 2025-01-03 10:00:52 +07:00 committed by Benjamin Cabé
commit fc831ead04
2 changed files with 15 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
# Enable GPIO
CONFIG_GPIO=y

View file

@ -23,6 +23,20 @@ static volatile uint32_t *mstp_regs[] = {
static volatile uint32_t *mstp_regs[] = {};
#endif
#if !defined(CONFIG_PM)
/* If a CPU clock exists in the system, it will be the source for the CPU */
#if BSP_FEATURE_CGC_HAS_CPUCLK
#define sys_clk DT_NODELABEL(cpuclk)
#else
#define sys_clk DT_NODELABEL(iclk)
#endif
#define SYS_CLOCK_HZ (BSP_STARTUP_SOURCE_CLOCK_HZ / DT_PROP(sys_clk, div))
BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == SYS_CLOCK_HZ,
"CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC must match the configuration of the clock "
"supplying the CPU ");
#endif
static int clock_control_renesas_ra_on(const struct device *dev, clock_control_subsys_t sys)
{
struct clock_control_ra_subsys_cfg *subsys_clk = (struct clock_control_ra_subsys_cfg *)sys;