Skip to content
Snippets Groups Projects
Commit 39f0ac93 authored by Fabio Estevam's avatar Fabio Estevam Committed by Stefano Babic
Browse files

mx6: soc: Add the required LDO ramp up delay


When changing LDO voltages we need to wait for the required amount of time
for the voltage to settle.

Also, as the timer is still not available when arch_cpu_init() is called, we
need to call it later at board_postclk_init() phase.

Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
parent 3d622b78
No related branches found
No related tags found
No related merge requests found
...@@ -124,7 +124,7 @@ static void clear_ldo_ramp(void) ...@@ -124,7 +124,7 @@ static void clear_ldo_ramp(void)
static int set_ldo_voltage(enum ldo_reg ldo, u32 mv) static int set_ldo_voltage(enum ldo_reg ldo, u32 mv)
{ {
struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR; struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
u32 val, reg = readl(&anatop->reg_core); u32 val, step, old, reg = readl(&anatop->reg_core);
u8 shift; u8 shift;
if (mv < 725) if (mv < 725)
...@@ -150,9 +150,20 @@ static int set_ldo_voltage(enum ldo_reg ldo, u32 mv) ...@@ -150,9 +150,20 @@ static int set_ldo_voltage(enum ldo_reg ldo, u32 mv)
return -EINVAL; return -EINVAL;
} }
old = (reg & (0x1F << shift)) >> shift;
step = abs(val - old);
if (step == 0)
return 0;
reg = (reg & ~(0x1F << shift)) | (val << shift); reg = (reg & ~(0x1F << shift)) | (val << shift);
writel(reg, &anatop->reg_core); writel(reg, &anatop->reg_core);
/*
* The LDO ramp-up is based on 64 clock cycles of 24 MHz = 2.6 us per
* step
*/
udelay(3 * step);
return 0; return 0;
} }
...@@ -170,8 +181,6 @@ int arch_cpu_init(void) ...@@ -170,8 +181,6 @@ int arch_cpu_init(void)
{ {
init_aips(); init_aips();
set_ldo_voltage(LDO_SOC, 1175); /* Set VDDSOC to 1.175V */
imx_set_wdog_powerdown(false); /* Disable PDE bit of WMCR register */ imx_set_wdog_powerdown(false); /* Disable PDE bit of WMCR register */
#ifdef CONFIG_APBH_DMA #ifdef CONFIG_APBH_DMA
...@@ -182,6 +191,13 @@ int arch_cpu_init(void) ...@@ -182,6 +191,13 @@ int arch_cpu_init(void)
return 0; return 0;
} }
int board_postclk_init(void)
{
set_ldo_voltage(LDO_SOC, 1175); /* Set VDDSOC to 1.175V */
return 0;
}
#ifndef CONFIG_SYS_DCACHE_OFF #ifndef CONFIG_SYS_DCACHE_OFF
void enable_caches(void) void enable_caches(void)
{ {
......
...@@ -20,5 +20,6 @@ ...@@ -20,5 +20,6 @@
#define CONFIG_ARM_ERRATA_742230 #define CONFIG_ARM_ERRATA_742230
#define CONFIG_ARM_ERRATA_743622 #define CONFIG_ARM_ERRATA_743622
#define CONFIG_ARM_ERRATA_751472 #define CONFIG_ARM_ERRATA_751472
#define CONFIG_BOARD_POSTCLK_INIT
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment