add TI DA8xx support: Add DA8xx cpu functions
PATCH v4 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 | 43 ++++++++++++++++++++++++++++++++++++++++++- cpu/arm926ejs/davinci/psc.c | 43 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 76 insertions(+), 10 deletions(-)
cpu/arm926ejs/davinci/cpu.c +42 -1
@@ -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,47 @@#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 = (readl (&DAVINCI_PLLC_REGS ->prediv) & +DAVINCI_PPLC_DIV_MASK ) +1 ; +int pllm =readl (&DAVINCI_PLLC_REGS ->pllm) +1 ; +int post_div = (readl (&DAVINCI_PLLC_REGS ->postdiv) & +DAVINCI_PPLC_DIV_MASK ) +1 ; +int pll_out =CONFIG_SYS_OSCIN_FREQ ; + +if (id ==DAVINCI_AUXCLK_CLKID ) + goto out; + +/* +* Lets keep this simple. Combining operations can result in +* unexpected approximations +*/ + pll_out /= pre_div; + pll_out *= pllm; + +if (id ==DAVINCI_PLLM_CLKID ) + goto out; + + pll_out /= post_div; + +if (id ==DAVINCI_PLLC_CLKID ) + goto out; + + pll_out /= (readl (sysdiv[id -1 ]) &DAVINCI_PPLC_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
PATCH v4 2/4 add TI DA8xx support: Add DA8xx cpu functions
Quoted 41 lines · Nick Thompson
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.Signed-off-by Nick Thompson <[email protected]>---
Applies to u-boot-ticpu/arm926ejs/davinci/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++- cpu/arm926ejs/davinci/psc.c | 43 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 76 insertions(+), 10 deletions(-)cpu/arm926ejs/davinci/cpu.c +7
-1@@ -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,47 @@#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
cpu/arm926ejs/davinci/cpu.c line 78
Quoted 10 lines
cpu/arm926ejs/davinci/cpu.c +10
-0+}; + +int clk_get (enum davinci_clk_ids id) +{ +int pre_div = (readl (&DAVINCI_PLLC_REGS ->prediv) & +DAVINCI_PPLC_DIV_MASK ) +1 ; +int pllm =readl (&DAVINCI_PLLC_REGS ->pllm) +1 ; +int post_div = (readl (&DAVINCI_PLLC_REGS ->postdiv) & +DAVINCI_PPLC_DIV_MASK ) +1 ; +int pll_out =CONFIG_SYS_OSCIN_FREQ ;
These register reads can be deferred till when they are needed. The various goto out's make some unnecessary. This is an optional change.
Your other changes look fine.
Tom
Quoted 4 lines
cpu/arm926ejs/davinci/cpu.c +4
-0+ +if (id ==DAVINCI_AUXCLK_CLKID ) + goto out; +