Skip to contentSkip to conversation

add TI DA8xx support: Add DA8xx cpu functions

PATCH Superseded Nick Thompson 2 participants 2 messages Nov 10, 2009 – Nov 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v5 2/4 add TI DA8xx support: Add DA8xx cpu functions

From: Sekhar Nori <[email protected]>

Provides initial support for TI OMAP-L1x/DA8xx SoC devices. See http://www.ti.com

Provides:
Low level initialisation.
System clock API.
Timer control.

---
Applies to u-boot-ti

 cpu/arm926ejs/davinci/cpu.c |   50 ++++++++++++++++++++++++++++++++++++++++++-
 cpu/arm926ejs/davinci/psc.c |   43 +++++++++++++++++++++++++++++-------
 2 files changed, 83 insertions(+), 10 deletions(-)
cpu/arm926ejs/davinci/cpu.c +49 -1
index 390cab8..fc3551c 100644
@@ -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
 
cpu/arm926ejs/davinci/psc.c +34 -9

77 lines not on this page · raw message

#1 lore raw

PATCH v5 2/4 add TI DA8xx support: Add DA8xx cpu functions

Quoted 15 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Nick Thompson
Sent: Tuesday, November 10, 2009 10:10 AM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH V5 2/4] add TI DA8xx support: Add DA8xx cpu functions

From: Sekhar Nori <[email protected]>

Provides initial support for TI OMAP-L1x/DA8xx SoC devices. See http://www.ti.com

Quoted 8 lines

Provides:
Low level initialisation.
System clock API.
Timer control.

---
Applies to u-boot-ti

Pushed to u-boot-ti/master

http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=0942803639e8d40aa5dc8d5cd99f9f7ba58c4033

Thanks,
Sandeep