How to get an ARM CPU clock speed in Linux?

Try cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq.

On my android this reads 1113600, so this is in kHz.


AFAICT the clock of a S3C2416 looks just like that of a S3C2443, or similar processors of its family. The Linux source code for it suggests that there are a number of closely-related clocks.

Choice snippet:

    pll = get_mpll(mpllcon, xtal);
    clk_msysclk.clk.rate = pll;

    fclk = pll / get_fdiv(clkdiv0);
    hclk = s3c2443_prediv_getrate(&clk_prediv);
    hclk /= s3c2443_get_hdiv(clkdiv0);
    pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);

    s3c24xx_setup_clocks(fclk, hclk, pclk);

    printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03l MHz\n",
           (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on",
           print_mhz(pll), print_mhz(fclk),
           print_mhz(hclk), print_mhz(pclk));

Update from OP

I have been looking for this output from dmesg, but I could not find anything - the dmesg output was littered with debug messages, and the beginning was missing. Clearly the kernel message buffer was too short to hold all messages until I connect by telnet. By putting /bin/dmesg > /tmp/dmesg.log early in the startup process, I was able to get this output, confirming what I wanted to know:

Linux version 2.6.21 (gcc version 4.2.2)
CPU: ARM926EJ-S revision 5 (ARMv5TEJ)
Machine: SMDK2416
...
CPU S3C2416 EVT3
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C2416: mpll on 534.000 MHz, cpu 534.000 MHz, mem 133.500 MHz, pclk 66.750 MHz