]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mxs: be more careful when enabling gpmi_clk
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Thu, 12 Sep 2019 09:17:11 +0000 (09:17 +0000)
committerStefano Babic <sbabic@denx.de>
Tue, 7 Jan 2020 09:26:57 +0000 (10:26 +0100)
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

index 585c53baf6589a28b164d5925c08c15b7365ac2f..183aa40b6d1d30daa05b3e109ba800728ea422e4 100644 (file)
@@ -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);