public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 3/4] arm: mxs: be more careful when enabling gpmi_clk
  2019-09-12  9:17 [U-Boot] [PATCH 0/4] arm: mxs: mxs_set_gpmiclk Rasmus Villemoes
@ 2019-09-12  9:17 ` Rasmus Villemoes
  0 siblings, 0 replies; 2+ messages in thread
From: Rasmus Villemoes @ 2019-09-12  9:17 UTC (permalink / raw)
  To: u-boot

The data sheet says that the DIV field cannot change while the CLKGATE
bit is set or modified. So do it a little more carefully, by first
clearing the bit, waiting for that to appear, then setting the DIV
field.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 arch/arm/cpu/arm926ejs/mxs/mxs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
index 585c53baf6..183aa40b6d 100644
--- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
+++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
@@ -103,8 +103,11 @@ int arch_cpu_init(void)
 		&clkctrl_regs->hw_clkctrl_clkseq_set);
 
 	/* Set GPMI clock to ref_xtal / 1 */
+	clrbits_le32(&clkctrl_regs->hw_clkctrl_gpmi, CLKCTRL_GPMI_CLKGATE);
+	while (readl(&clkctrl_regs->hw_clkctrl_gpmi) & CLKCTRL_GPMI_CLKGATE)
+		;
 	clrsetbits_le32(&clkctrl_regs->hw_clkctrl_gpmi,
-		CLKCTRL_GPMI_CLKGATE | CLKCTRL_GPMI_DIV_MASK, 1);
+		CLKCTRL_GPMI_DIV_MASK, 1);
 
 	udelay(1000);
 
-- 
2.20.1

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

* [U-Boot] [PATCH 3/4] arm: mxs: be more careful when enabling gpmi_clk
@ 2020-01-04 11:00 sbabic at denx.de
  0 siblings, 0 replies; 2+ messages in thread
From: sbabic at denx.de @ 2020-01-04 11:00 UTC (permalink / raw)
  To: u-boot

> The data sheet says that the DIV field cannot change while the CLKGATE
> bit is set or modified. So do it a little more carefully, by first
> clearing the bit, waiting for that to appear, then setting the DIV
> field.
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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:[~2020-01-04 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-04 11:00 [U-Boot] [PATCH 3/4] arm: mxs: be more careful when enabling gpmi_clk sbabic at denx.de
  -- strict thread matches above, loose matches on Subject: below --
2019-09-12  9:17 [U-Boot] [PATCH 0/4] arm: mxs: mxs_set_gpmiclk Rasmus Villemoes
2019-09-12  9:17 ` [U-Boot] [PATCH 3/4] arm: mxs: be more careful when enabling gpmi_clk Rasmus Villemoes

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