diff options
author | Michael Brandt <Michael.Brandt@stericsson.com> | 2009-12-22 15:06:09 +0100 |
---|---|---|
committer | Michael Brandt <Michael.Brandt@stericsson.com> | 2009-12-22 15:06:09 +0100 |
commit | 257e7c347fd32438604da5e7996b902688d9611b (patch) | |
tree | 74fe0aa3fcaad4c9a3bd1c3dfc172531400cdd45 /cpu/arm926ejs/davinci/cpu.c | |
parent | 0c9ff2faf4cf516dd6631ba18a4bcc5b739eb4c6 (diff) | |
parent | 87d93a1ba2ae23550e1370adb7a3b00af0831165 (diff) |
Merge branch 'master' of http://git.denx.de/u-boot
Conflicts:
include/usb/musb_udc.h
Diffstat (limited to 'cpu/arm926ejs/davinci/cpu.c')
-rw-r--r-- | cpu/arm926ejs/davinci/cpu.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/cpu/arm926ejs/davinci/cpu.c b/cpu/arm926ejs/davinci/cpu.c index 390cab8a2..fc3551c30 100644 --- a/cpu/arm926ejs/davinci/cpu.c +++ b/cpu/arm926ejs/davinci/cpu.c @@ -23,7 +23,7 @@ #include <common.h> #include <netdev.h> #include <asm/arch/hardware.h> - +#include <asm/io.h> /* offsets from PLL controller base */ #define PLLC_PLLCTL 0x100 @@ -60,6 +60,54 @@ #define DDR_PLLDIV PLLC_PLLDIV1 #endif +#ifdef CONFIG_SOC_DA8XX +const dv_reg * const sysdiv[7] = { + &davinci_pllc_regs->plldiv1, &davinci_pllc_regs->plldiv2, + &davinci_pllc_regs->plldiv3, &davinci_pllc_regs->plldiv4, + &davinci_pllc_regs->plldiv5, &davinci_pllc_regs->plldiv6, + &davinci_pllc_regs->plldiv7 +}; + +int clk_get(enum davinci_clk_ids id) +{ + int pre_div; + int pllm; + int post_div; + int pll_out; + + pll_out = CONFIG_SYS_OSCIN_FREQ; + + if (id == DAVINCI_AUXCLK_CLKID) + goto out; + + /* + * Lets keep this simple. Combining operations can result in + * unexpected approximations + */ + pre_div = (readl(&davinci_pllc_regs->prediv) & + DAVINCI_PLLC_DIV_MASK) + 1; + pllm = readl(&davinci_pllc_regs->pllm) + 1; + + pll_out /= pre_div; + pll_out *= pllm; + + if (id == DAVINCI_PLLM_CLKID) + goto out; + + post_div = (readl(&davinci_pllc_regs->postdiv) & + DAVINCI_PLLC_DIV_MASK) + 1; + + pll_out /= post_div; + + if (id == DAVINCI_PLLC_CLKID) + goto out; + + pll_out /= (readl(sysdiv[id - 1]) & DAVINCI_PLLC_DIV_MASK) + 1; + +out: + return pll_out; +} +#endif /* CONFIG_SOC_DA8XX */ #ifdef CONFIG_DISPLAY_CPUINFO |