9
0
Fork 0

mx25: implement clko command

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2009-09-11 17:16:56 +02:00
parent 2e976df267
commit 6e44db23fe
2 changed files with 41 additions and 1 deletions

View File

@ -66,7 +66,7 @@ menu "i.MX specific settings "
config IMX_CLKO
bool "clko command"
depends on ARCH_IMX21 || ARCH_IMX27 || ARCH_IMX35
depends on ARCH_IMX21 || ARCH_IMX27 || ARCH_IMX35 || ARCH_IMX25
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

View File

@ -99,3 +99,43 @@ int imx_dump_clocks(void)
return 0;
}
/*
* Set the divider of the CLKO pin. Returns
* the new divider (which may be smaller
* than the desired one)
*/
int imx_clko_set_div(int div)
{
unsigned long mcr = readl(IMX_CCM_BASE + 0x64);
div -= 1;
div &= 0x3f;
mcr &= ~(0x3f << 24);
mcr |= div << 24;
writel(mcr, IMX_CCM_BASE + 0x64);
return div + 1;
}
/*
* Set the clock source for the CLKO pin
*/
void imx_clko_set_src(int src)
{
unsigned long mcr = readl(IMX_CCM_BASE + 0x64);
if (src < 0) {
mcr &= ~(1 << 30);
writel(mcr, IMX_CCM_BASE + 0x64);
return;
}
mcr |= 1 << 30;
mcr &= ~(0xf << 20);
mcr |= (src & 0xf) << 20;
writel(mcr, IMX_CCM_BASE + 0x64);
}