2 * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #include <linux/types.h>
27 #include <asm/clock.h>
29 int do_clkops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
39 if ((strcmp(argv[1], "core") == 0) ||
40 (strcmp(argv[1], "cpu") == 0))
42 else if (strcmp(argv[1], "periph") == 0)
44 else if (strcmp(argv[1], "ddr") == 0)
46 else if (strcmp(argv[1], "nfc") == 0)
49 printf("Unsupported clock type!\n");
52 freq = simple_strtoul(argv[2], NULL, 10);
53 if ((strcmp(argv[1], "core") == 0) ||
54 (strcmp(argv[1], "cpu") == 0))
55 clk_config(CONFIG_REF_CLK_FREQ, freq, CPU_CLK);
56 else if (strcmp(argv[1], "periph") == 0)
57 clk_config(CONFIG_REF_CLK_FREQ, freq, PERIPH_CLK);
58 else if (strcmp(argv[1], "ddr") == 0)
59 clk_config(CONFIG_REF_CLK_FREQ, freq, DDR_CLK);
60 else if (strcmp(argv[1], "nfc") == 0)
61 clk_config(CONFIG_REF_CLK_FREQ, freq, NFC_CLK);
63 printf("Unsupported clock type!\n");
67 printf("Too many parameters.\n");
68 printf("Usage:\n%s\n", cmdtp->usage);
78 "Setup/Display clock\n"
79 "clk - Display all clocks\n"
80 "clk core <core clock in MHz> - Setup/Display core clock\n"
81 "clk periph <peripheral clock in MHz> -"
82 "Setup/Display peripheral clock\n"
83 "clk ddr <DDR clock in MHz> - Setup/Display DDR clock\n"
84 "clk nfc <NFC clk in MHz> - Setup/Display NFC clock\n"
86 "clk - Show various clocks\n"
87 "clk core 665 - Set core clock to 665MHz\n"
88 "clk periph 600 - Set peripheral clock to 600MHz\n"
89 "clk ddr 166 - Set DDR clock to 166MHz");