public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] i.MX6: Add ANATOP regulator init
@ 2012-05-02 12:12 Dirk Behme
  2012-05-06 16:44 ` Stefano Babic
  0 siblings, 1 reply; 2+ messages in thread
From: Dirk Behme @ 2012-05-02 12:12 UTC (permalink / raw)
  To: u-boot

Init the core regulator voltage to 1.2V. This is required for the correct
functioning of the GPU and when the ARM LDO is set to 1.225V. This is a
workaround to fix some memory clock jitter.

Note: This should be but can't be done in the DCD. The bootloader
      prevents access to the ANATOP registers.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
CC: Jason Chen <b02280@freescale.com>
CC: Jason Liu <r64343@freescale.com>
CC: Ranjani Vaidyanathan <ra5478@freescale.com>
CC: Stefano Babic <sbabic@denx.de>
CC: Fabio Estevam <festevam@gmail.com>
---
v2: Rename the function set_vddsoc(mV) and export it as discused in

http://lists.denx.de/pipermail/u-boot/2012-April/122946.html

 arch/arm/cpu/armv7/mx6/soc.c              |   30 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx6/sys_proto.h |    2 +
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 543b2cc..90f2088 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -77,10 +77,40 @@ void init_aips(void)
 	writel(0x00000000, &aips2->opacr4);
 }
 
+/*
+ * Set the VDDSOC
+ *
+ * Mask out the REG_CORE[22:18] bits (REG2_TRIG) and set
+ * them to the specified millivolt level.
+ * Possible values are from 0.725V to 1.450V in steps of
+ * 0.025V (25mV).
+ */
+void set_vddsoc(u32 mv)
+{
+	struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
+	u32 val, reg = readl(&anatop->reg_core);
+
+	if (mv < 725)
+		val = 0x00;	/* Power gated off */
+	else if (mv > 1450)
+		val = 0x1F;	/* Power FET switched full on. No regulation */
+	else
+		val = (mv - 700) / 25;
+
+	/*
+	 * Mask out the REG_CORE[22:18] bits (REG2_TRIG)
+	 * and set them to the calculated value (0.7V + val * 0.25V)
+	 */
+	reg = (reg & ~(0x1F << 18)) | (val << 18);
+	writel(reg, &anatop->reg_core);
+}
+
 int arch_cpu_init(void)
 {
 	init_aips();
 
+	set_vddsoc(1200);	/* Set VDDSOC to 1.2V */
+
 	return 0;
 }
 #endif
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h
index 668e77a..699e0b0 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -28,6 +28,8 @@
 
 u32 get_cpu_rev(void);
 
+void set_vddsoc(u32 mv);
+
 /*
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH v2] i.MX6: Add ANATOP regulator init
  2012-05-02 12:12 [U-Boot] [PATCH v2] i.MX6: Add ANATOP regulator init Dirk Behme
@ 2012-05-06 16:44 ` Stefano Babic
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2012-05-06 16:44 UTC (permalink / raw)
  To: u-boot

On 02/05/2012 14:12, Dirk Behme wrote:
> Init the core regulator voltage to 1.2V. This is required for the correct
> functioning of the GPU and when the ARM LDO is set to 1.225V. This is a
> workaround to fix some memory clock jitter.
> 
> Note: This should be but can't be done in the DCD. The bootloader
>       prevents access to the ANATOP registers.
> 
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
> CC: Jason Chen <b02280@freescale.com>
> CC: Jason Liu <r64343@freescale.com>
> CC: Ranjani Vaidyanathan <ra5478@freescale.com>
> CC: Stefano Babic <sbabic@denx.de>
> CC: Fabio Estevam <festevam@gmail.com>
> ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-06 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-02 12:12 [U-Boot] [PATCH v2] i.MX6: Add ANATOP regulator init Dirk Behme
2012-05-06 16:44 ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox