zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.49k stars 6.42k forks source link

Add timebase-frequency property on hardware description #37685

Open nandojve opened 3 years ago

nandojve commented 3 years ago

Is your feature request related to a problem? Please describe. Current Zephyr timebase is defined at CONFIG_SYS_CLOCK_TICKS_PER_SEC. The RISC-V add timebase-frequency in /cpus, see risc-v/cpus.yaml . Add a way to define hardware tick at devicetree.

Describe the solution you'd like Add at /cpus devicetree node the property timebase-frequency with desired system tick value per second. Same semantic already defined at CONFIG_SYS_CLOCK_TICKS_PER_SEC.

/dts-v1/;

/ {
    cpus {
        timebase-frequency = <1000000>;

        cpu0: cpu@0 {
        ...
        };

        cpu1: cpu@1 {
        ...
        };

        ...
    };
};

This could be auto generated if it is introduced as mandatory. A default value could be defined and documented when this property doesn't exits.

Describe alternatives you've considered Keep current CONFIG_SYS_CLOCK_TICKS_PER_SEC .

Additional context Original motivation #37420.

stephanosio commented 3 years ago

cc @galak @andyross @dcpleung