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.

AM5749: Setting Processor Speed under Embedded Linux

Expert 2430 points
Part Number: AM5749

The AM5749 can run at four speeds:  750 MHz, 1000 MHz, 1176 MHz, and 1500 MHz.  All my years of experience are with writing my own bare-metal code for the bootloader (and processor initialization code) and then running under SYS/BIOS, so when booting the AM57x via U-Boot/Linux from the SDK, at the user level (well, root user), how do I both check the current CPU speed and set the current CPU speed?

In your kernel, cpufreq does not exist under /sys/devices/system/cpu/cpu0 (nor for ./cpu1 for that matter) which is what I was told to check by someone else.

It's imperative that I am running at 1500 MHz when active (due to the real-time nature of my app), and it's preferable to down-clock to 750 MHz when I'm idle to reduce the chip's power consumption to reduce the heat.

  • Hi Alex,

    I am using ti-processor-sdk-linux-am57xx-evm-06.02.00.81 on AM574x-IDK.

    I am able to see all the nodes under /sys/devices/system/cpu/cpu0/cpufreq:

    cat /sys/deces/system/cpu/cpu0/cpufreq/
    affected_cpus                  cpuinfo_min_freq             scaling_available_frequencies  scaling_driver                 scaling_min_freq               
    cpuinfo_curreq               cpuinfo_transition_latency     scaling_availle_governors    scaling_governor               scaling_setspeed               
    cpuinfo_max_freq               relatecpus                   scaling_cur_freq               scaling_x_freq               stats/                         

    By default the cpufreq governor is set to ondemand you can check that by:
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    ondemand

    That means kernel has the control of switching OPPs based on demand. So if there is a high CPULOAD then
    ondemand governor in kernel switches the cpufreq to Top frequency(OPP) and when there is less load it will be at the lower frequencies.

    We can see all the supported governors using:
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
    conservative userspace powersave ondemand performance scheduti

    We can switch the governor to userspace so that we can control the frequencies from user space:
    echo userspace > /sys/deces/system/cpu/cpu0/cpufreq/scaling_available_frequencies

    Check the frequencies supported using:
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    1000000 1176000 1500000

    We can set the cpu frequency to any of the above using:
    echo 1500000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

    Then one can read back using:
    /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
    1500000
    or
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
    1500000


    Hope this gives you all the required information.

    If so please resolve the issue.

    BR,
    Keerthy

  • Adding the following line to your dts should re-enable cpufreq:

    &cpu0 {
    	vdd-supply = <&smps12_reg>;
    };
  • Okay, well, once I figure out how to rebuild the dtb file from the dts file (and, also, figure out how to get u-boot to use the new dtb file), I'll come back here and let you know if that resolves the issue.