summaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-05-19 12:22:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-19 12:22:44 +0200
commit9afe84b60e0fd5ac2568e516097fe7a4f71c32d6 (patch)
tree628450e015c6bb2358b4e8e12233dc7fa5b6bf53 /board
parentc18c5777229152d3ceb2533a6adb707d2d606d50 (diff)
downloadbarebox-9afe84b60e0fd5ac2568e516097fe7a4f71c32d6.tar.gz
barebox-9afe84b60e0fd5ac2568e516097fe7a4f71c32d6.tar.xz
pcm043: Allow to switch cpu frequency from command line
Currently there are i.MX35 SoCs with 532MHz and 400MHz maximum frequency. As there's some confusion about which SoCs are available add frequency switching to the command line. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'board')
-rw-r--r--board/pcm043/pcm043.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/board/pcm043/pcm043.c b/board/pcm043/pcm043.c
index b663a23ce5..c8f267d11a 100644
--- a/board/pcm043/pcm043.c
+++ b/board/pcm043/pcm043.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <command.h>
#include <init.h>
#include <driver.h>
#include <environment.h>
@@ -34,6 +35,7 @@
#include <asm/mach-types.h>
#include <asm/arch/imx-nand.h>
#include <fec.h>
+#include <asm/arch/imx-pll.h>
#define CYG_MACRO_START
#define CYG_MACRO_END
@@ -247,3 +249,46 @@ static int pcm043_core_setup(void)
core_initcall(pcm043_core_setup);
+#define MPCTL_PARAM_399 (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
+#define MPCTL_PARAM_532 ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
+
+static int do_cpufreq(cmd_tbl_t *cmdtp, int argc, char *argv[])
+{
+ unsigned long freq;
+
+ if (argc != 2) {
+ u_boot_cmd_usage(cmdtp);
+ return 1;
+ }
+
+ freq = simple_strtoul(argv[1], NULL, 0);
+
+ switch (freq) {
+ case 399:
+ writel(MPCTL_PARAM_399, IMX_CCM_BASE + CCM_MPCTL);
+ break;
+ case 532:
+ writel(MPCTL_PARAM_532, IMX_CCM_BASE + CCM_MPCTL);
+ break;
+ default:
+ u_boot_cmd_usage(cmdtp);
+ return 1;
+ }
+
+ printf("Switched CPU frequency to %dMHz\n", freq);
+
+ return 0;
+}
+
+static const __maybe_unused char cmd_cpufreq_help[] =
+"Usage: cpufreq 399|532\n"
+"\n"
+"Set CPU frequency to <freq> MHz\n";
+
+U_BOOT_CMD_START(cpufreq)
+ .maxargs = CONFIG_MAXARGS,
+ .cmd = do_cpufreq,
+ .usage = "adjust CPU frequency",
+ U_BOOT_CMD_HELP(cmd_cpufreq_help)
+U_BOOT_CMD_END
+