summaryrefslogtreecommitdiff
path: root/cpu/arm926ejs/davinci/cpu.c
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2010-01-15 22:41:58 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2010-01-15 22:41:58 +0900
commite598dfc22c8789991d165714bec53b2390fc999d (patch)
treecf3c704c4b00e06605bdfe23384b8af97022efa6 /cpu/arm926ejs/davinci/cpu.c
parente7ae13a57b4cbaa2cd3da8ffca614853d9d84230 (diff)
parent1c2a8e359ebbec0dbef62f5b54c72f9cd72ccd59 (diff)
downloadu-boot-imx-e598dfc22c8789991d165714bec53b2390fc999d.zip
u-boot-imx-e598dfc22c8789991d165714bec53b2390fc999d.tar.gz
u-boot-imx-e598dfc22c8789991d165714bec53b2390fc999d.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts: cpu/arm_cortexa8/s5pc1xx/cache.c include/asm-arm/arch-s5pc1xx/sys_proto.h include/sja1000.h Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'cpu/arm926ejs/davinci/cpu.c')
-rw-r--r--cpu/arm926ejs/davinci/cpu.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/cpu/arm926ejs/davinci/cpu.c b/cpu/arm926ejs/davinci/cpu.c
index 390cab8..fc3551c 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