This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM623: CPU frequency

Part Number: AM623

Tool/software:

Hi, TI expert!

Hi, TI expert! I have a development environment for am6234, with our own evaluation board.
The software SDK version is PROCESSOR-SDK-LINUX-RT-AM62X-11.00.09.04.

I would like to know two questions about the factory frequency of the CPU
1. The default CPU frequency now is 1250000000 Hz, but the maximum supported frequency for am6234 is 1.4GHz, as follows:


Why is the default frequency of SDK not set to 1.4GHz ?


2. If I want to change the CPU frequency to 1.4Ghz, how do I make the change?

Regards,
Li

  • Hi Li,

    You can change the CPU frequency from the terminal in Linux, typically without directly modifying the Device Tree Source (DTS) file at runtime. This is achieved through the CPUFreq subsystem in the Linux kernel and associated user-space tools.

    You can check the available frequencies by 

    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

    The CPU governor determines how the CPU frequency is managed. To manually set a specific frequency, you often need to switch to the userspace governor.

    to do that you can use the below command

    sudo sh -c "echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

    Once the userspace governor is active, you can write the desired frequency 

    sudo sh -c "echo 1400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

    Note:- if you need to change the CPU frequency permanently you need to modify the Device Tree Source (DTS) file for your AM623 board.

    Within the CPU's definition, you'll find an opp-table node. You need to add an entry for 1.4 GHz (1400000000 Hz)

    Eg:-

            opp-table {
                    /* Add 1.4GHz OPP for am625-sk board. Requires VDD_CORE to be at 0.85V */
                    opp-1400000000 {
                            opp-hz = /bits/ 64 <1400000000>;
                            opp-supported-hw = <0x01 0x0004>;
                            clock-latency-ns = <6000000>;
                    };
            };
    

  • Hi,

    If you uses kernel devicetree k3-am625-sk.dts as your reference, the default frequency would be 1.4GHz, but if you use k3-am62-lp-sk.dts as the reference, the default frequency would be 1.25GHz. Because k3-am625-sk.dts has "opp-140000000" defined in the opp-table node, but k3-am62-lp-sk.dts doesn't.

    1.4GHz is only supported with 0.85V VDD_CORE.

  • VDD_CORE is 0.85V, but the CPU frequency is still 1.25GHz:




    The relevant logs are as follows:

  • The software SDK version is PROCESSOR-SDK-LINUX-RT-AM62X-11.00.09.04.

    RT Linux doesn't have cpufreq enabled to improve realtime latency.

    I will check the source code tomorrow to show you how to modify the default frequency.


  • I can now perform frequency modulation operations normally.

    Why is the default frequency of SDK not set to 1.4GHz ?

    RT Linux doesn't have cpufreq enabled to improve realtime latency.

    I want to know why the default CPU frequency setting for the RT Linux SDK is 1.25Ghz instead of 1.4Ghz, and what is the reason behind this?

  • I can now perform frequency modulation operations normally.

    Have you enabled cpufreq in kernel config?

    I want to know why the default CPU frequency setting for the RT Linux SDK is 1.25Ghz instead of 1.4Ghz, and what is the reason behind this?

    The frequency is hard-coded in U-Boot code, only because the max freq for 0.75v VDD_CORE is 1.25HGz. We don't want the processor to run at 1.4GHz if the VDD_CORE is 0.75v. The default frequency can always be changed in U-Boot code to set to the value you want.

  • Have you enabled cpufreq in kernel config?

    Yes, after making the following modifications, the frequency of the system after startup is 1.4GHz

    diff --git a/arch/arm64/boot/dts/ti/k3-am62x-sk.dts b/arch/arm64/boot/dts/ti/k3-am62x-sk.dts
    index b7ee73d..33ca38e 100755
    --- a/arch/arm64/boot/dts/ti/k3-am62x-sk.dts
    +++ b/arch/arm64/boot/dts/ti/k3-am62x-sk.dts
    @@ -188,3 +188,33 @@
     &fss {
            bootph-all;
     };
    +
    +&a53_opp_table {
    +       opp-200000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +
    +       opp-400000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +
    +       opp-600000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +
    +       opp-800000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +
    +       opp-1000000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +
    +       opp-1250000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +
    +       opp-1400000000 {
    +               /delete-property/ opp-supported-hw;
    +       };
    +};
    \ No newline at end of file
    diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
    index af2b8e0..94cbeeb 100755
    --- a/arch/arm64/configs/defconfig
    +++ b/arch/arm64/configs/defconfig
    @@ -525,7 +525,30 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
     #
     # CPU Frequency scaling
     #
    -# CONFIG_CPU_FREQ is not set
    +CONFIG_CPU_FREQ=y
    +CONFIG_CPU_FREQ_GOV_ATTR_SET=y
    +CONFIG_CPU_FREQ_GOV_COMMON=y
    +CONFIG_CPU_FREQ_STAT=y
    +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
    +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
    +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
    +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
    +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
    +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
    +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
    +CONFIG_CPU_FREQ_GOV_POWERSAVE=y
    +CONFIG_CPU_FREQ_GOV_USERSPACE=y
    +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
    +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
    +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
    +
    +#
    +# CPU frequency scaling drivers
    +#
    +CONFIG_CPUFREQ_DT=m
    +CONFIG_CPUFREQ_DT_PLATDEV=y
    +# CONFIG_ARM_SCMI_CPUFREQ is not set
    +CONFIG_ARM_TI_CPUFREQ=y
     # end of CPU Frequency scaling
     # end of CPU Power Management
    

    But if I don't delete the "opp-supported-hw" attribute in the device tree, there will be the following error message

    By analyzing the following source code under the kernel, it can be known that the setting of "opp-supported-hw" is related to register 0x43000018

    Documentation/devicetree/bindings/opp/opp-v2-base.yaml
    drivers/cpufreq/ti-cpufreq.c

    The specific model of the chip we are currently using is AM6232ATCGHAALW, FCCSP-425, TI.

    The value of register 0x43000018 in Linux as follows

    My first question is, if we don't delete the opp-supported-hw in the device tree, how can we modify it to correctly configure the cpufreq driver so that the CPU frequency is 1.4Ghz when the system starts up?

    [    0.996124] cpu cpu0: _of_add_opp_table_v2: no supported OPPs
    [    0.996143] cpu cpu0: OPP table can't be empty
    [    0.996215] cpu cpu0: _of_add_opp_table_v2: no supported OPPs
    [    0.996221] cpu cpu0: OPP table can't be empty
    


    The frequency is hard-coded in U-Boot code, only because the max freq for 0.75v VDD_CORE is 1.25HGz. We don't want the processor to run at 1.4GHz if the VDD_CORE is 0.75v. The default frequency can always be changed in U-Boot code to set to the value you want.

    The second question is how to configure uboot so that the default frequency after system startup is 1.4GHz?

  • My first question is, if we don't delete the opp-supported-hw in the device tree, how can we modify it to correctly configure the cpufreq driver so that the CPU frequency is 1.4Ghz when the system starts up?

    My question is why you choose to use RT kernel when you need cpufreq? RT kernel should have cpufreq disabled due to RT latency requirement.

    The second question is how to configure uboot so that the default frequency after system startup is 1.4GHz?

    Please use the following U-Boot patch for SDK 11.x to set the default to 1.4GHz.

    diff --git a/arch/arm/dts/k3-am62-r5-sk-common.dtsi b/arch/arm/dts/k3-am62-r5-sk-common.dtsiev@vla:ti-u-boot.git$ 
    index 5da1b84a88f5..27a4034c3264 100644
    --- a/arch/arm/dts/k3-am62-r5-sk-common.dtsi
    +++ b/arch/arm/dts/k3-am62-r5-sk-common.dtsi
    @@ -24,7 +24,7 @@
                    clock-names = "gtc", "core";
                    assigned-clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
                    assigned-clock-parents = <&k3_clks 61 2>;
    -               assigned-clock-rates = <200000000>, <1200000000>;
    +               assigned-clock-rates = <200000000>, <1400000000>;
                    ti,sci = <&dmsc>;
                    ti,sci-proc-id = <32>;

  • My question is why you choose to use RT kernel when you need cpufreq? RT kernel should have cpufreq disabled due to RT latency requirement.

    Do you mean RT Linux should not dynamically adjust the CPU frequency while the system is working?
    Does that mean that if the CPU frequency of the RT Linux system remains fixed at 1.4Ghz, it is still possible?
    The customer wants the default CPU frequency to be 1.4GHz when running the RT Linux system.So I can only set the default frequency of the CPU to 1.4GHz by integrating the U-Boot patch above?

  • Do you mean RT Linux should not dynamically adjust the CPU frequency while the system is working?

    Yes.

    Does that mean that if the CPU frequency of the RT Linux system remains fixed at 1.4Ghz, it is still possible?

    When kernel has cpufreq disabled, the cpu frequency is the value set in uboot device tree.

    The customer wants the default CPU frequency to be 1.4GHz when running the RT Linux system.So I can only set the default frequency of the CPU to 1.4GHz by integrating the U-Boot patch above?

    Yes, with this U-Boot patch, U-Boot will set the A53 to 1.4GHz, and kernel won't change it if kernel has cpufreq disabled.