diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-03-14 13:03:43 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-03-14 13:03:43 +0100 |
commit | e833cba394abe13ca18a91294f48d23d81e8320f (patch) | |
tree | a25bb0541559744b0f0439b4f2290dd82ddb0e07 /arch | |
parent | 14056577fd45e883c7687a6182daee39864174d3 (diff) | |
download | barebox-e833cba394abe13ca18a91294f48d23d81e8320f.tar.gz barebox-e833cba394abe13ca18a91294f48d23d81e8320f.tar.xz |
add clko command for i.MX27
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mach-imx/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/clko.c | 65 |
3 files changed, 74 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 62d0ead6f6..6128f6990d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -133,6 +133,14 @@ config MACH_PCM037 endchoice +config IMX_CLKO + bool "clko command" + depends on ARCH_IMX27 + help + The i.MX SoCs have a Pin which can output different reference frequencies. + Say y here if you want to have the clko command which lets you select the + frequency to output on this pin. + source arch/arm/mach-netx/Kconfig menu "Arm specific settings " diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 323bffb530..5d5e545d1d 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -2,5 +2,6 @@ obj-y += clocksource.o obj-$(CONFIG_ARCH_IMX1) += speed-imx1.o gpio.o obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o gpio.o imx27.o obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o gpio-imx31.o +obj-$(CONFIG_IMX_CLKO) += clko.o obj-y += speed.o diff --git a/arch/arm/mach-imx/clko.c b/arch/arm/mach-imx/clko.c new file mode 100644 index 0000000000..4eaf3691ef --- /dev/null +++ b/arch/arm/mach-imx/clko.c @@ -0,0 +1,65 @@ +#include <common.h> +#include <command.h> +#include <getopt.h> +#include <asm/arch/imx-regs.h> + +static int do_clko (cmd_tbl_t *cmdtp, int argc, char *argv[]) +{ + int opt, div = 0, src = -2; + + getopt_reset(); + + while((opt = getopt(argc, argv, "d:s:")) > 0) { + switch(opt) { + case 'd': + div = simple_strtoul(optarg, NULL, 0); + break; + case 's': + src = simple_strtoul(optarg, NULL, 0); + break; + } + } + + if (div == 0 && src == -2) { + u_boot_cmd_usage(cmdtp); + return 0; + } + + if (src == -1) { + PCDR0 &= ~(1 << 25); + return 0; + } + + if (src != -2) { + ulong ccsr; + ccsr = CCSR & ~0x1f; + ccsr |= src & 0x1f; + CCSR = ccsr; + } + + if (div != 0) { + ulong pcdr; + div--; + pcdr = PCDR0 & ~(7 << 22); + pcdr |= (div & 0x7) << 22; + PCDR0 = pcdr; + } + + PCDR0 |= (1 << 25); + return 0; +} + +static __maybe_unused char cmd_clko_help[] = +"Usage: clko [OPTION]...\n" +"Route different signals to the i.MX clko pin\n" +" -d <div> Divider (1..8)\n" +" -s <source> Clock select. See Ref. Manual for valid sources. Use -1\n" +" for disabling clock output\n"; + +U_BOOT_CMD_START(clko) + .maxargs = CONFIG_MAXARGS, + .cmd = do_clko, + .usage = "Adjust CLKO setting", + U_BOOT_CMD_HELP(cmd_clko_help) +U_BOOT_CMD_END + |