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.

Linux/OMAP-L138: How to set ARM CPU Frequency for Linux

Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138, DA8XX

Tool/software: Linux

Hello,

I am attempting to set the CPU frequency to 456MHz, but have been unable to find where this is set.  I have tried enabling CPU Frequency Scaling in the linux kernel config, but I have had no luck actually using the CPUFreq driver.  This wiki page 

seems to indicate that CPUFreq is not supported on OMAP-L138.  I tried what was recommended by this forum post but had no success.  The location /sys/devices/system/cpu/cpu0 does not have a subdirectory named cpufreq, and /sys/devices/system/cpu/cpufreq is an empty directory.

I have updated da850.c to include "unsigned int da850_max_speed = 456000;", and added the u-boot environment variable "maxcpuclk 456000000".  I also changed the u-boot source omapl138_lcdk.c so that "get_board_rev" returns 3 and #define CONFIG_DA850_EVM_MAX_CPU_CLK 456000000 is set.  None of this changed the clock speed.

If there is simply a place that the frequency can be set in the boot sequence and left at 456MHz, that will be all I need.  Any guidance/hints where to look are appreciated.

I am using Processor SDK 4.0.

Jeff

  • Hi Jeff,

    First you need to add the opp table in da850.dtsi. See am335x.dtsi for reference, look in the cpu0_opp_table: opp_table0.
    Then enable the CONFIG_PM_OPP, CPUFREQ & governors support in defconfig.

    Best Regards,
    Yordan
  • Thank you for your response Yordan.

    I have added the following to da850-lcdk.dts, trying to follow the recommendations in Documentation/devicetree/bindings/opp/opp.txt and bindings/arm/cpus.txt as best as I can:

    	cpus {
    		#address-cells = <1>;
    		#size-cells = <0>;
    		cpu@0 {
    			compatible = "arm,arm,arm926ej-s";
    			enable-method = "ti,da850";
    			device_type = "cpu";
    			reg = <0>;
    
    			operating-points-v2 = <&cpu0_opp_table>;
    		};
    	};
    	cpu0_opp_table: opp_table0 {
    		compatible = "operating-points-v2-ti-cpu";
    
    
    
    		opp50@300000000 {
    			opp-hz = /bits/ 64 <300000000>;
    			opp-microvolt = <1200000>;
    		};
    		opp100@456000000 {
    			opp-hz = /bits/ 64 <456000000>;
    			opp-microvolt = <1300000>;
    		};
    	};

    And the following have been set in .config:

    CONFIG_CPU_FREQ=y
    CONFIG_CPU_FREQ_STAT=y
    CONFIG_CPU_FREQ_STAT_DETAILS=y
    CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
    CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
    CONFIG_CPU_FREQ_GOV_USERSPACE=y
    CONFIG_CPUFREQ_DT=y
    CONFIG_CPUFREQ_DT_PLATDEV=y
    

    The directory /sys/devices/system/cpu/cpu0/cpufreq does not exist.

    ls /sys/devices/system/cpu/cpu0 shows the following:
    crash_notes of_node subsystem uevent crash_notes_size power topology

    And /sys/devices/system/cpu/cpufreq is empty.  I can verify the correct device tree has been loaded by examining /sys/devices/system/cpu/cpu0/of_node.

    There seems to be a number of discrepancies between the am33xx and the davinci system.  That would make sense, since they're different platforms.  The omapl138 documentation makes no mention of the operating points like the AM335x documents do.  There is also no mention of efuses or the syscon module referenced in the am33xx.dtsi in the omapl138 documentation.

    Digging a little deeper, it seems that the davinci-cpufreq driver may not support the device tree.  The copyright in the file predates the use of the device tree in Linux, and seems to only use platform devices.  It doesn't appear to make any attempts to use the "of_" functions mentioned in this article (lwn.net/Articles/448502/).  It seems to me that the Linux cpufreq driver may be loading, but is not successfully probing the davinci driver (or the davinci-cpufreq driver is not loading).  The omap-cpufreq and ti-cpufreq drivers do not seem to support the da8xx family.  All of that said, I find it unlikely that I am the first to try to set the Linux CPU speed in Processor SDK 4.0 on the OMAP-L138, so it has to have worked, right?  I suspect I've missed something/do not completely understand how everything comes together.

    Is there a way to simply force the board to boot at 456MHz, without any of the CPUFreq drivers?

    Jeff

  • Hi Jeff,

    Here is the opp table:
    processors.wiki.ti.com/.../OMAPL1:_Changing_the_Operating_Point

    You can have a look at those older threads for enabling user space cpu frequency scaling:
    e2e.ti.com/.../441440
    e2e.ti.com/.../2269084
    e2e.ti.com/.../1148165
    e2e.ti.com/.../1759686

    Is there a way to simply force the board to boot at 456MHz, without any of the CPUFreq drivers?

    You can try using the cmdline parameters:
    u-boot# set maxcpuclk 300000000

    You can build this in u-boot config file include/configs/omapl138_lcdk.h under #define CONFIG_EXTRA_ENV_SETTINGS \

    Best Regards,
    Yordan