MDSTAT.STATE occupies bits 0..5 according to all available documentation, so fix
the mask which previously was leaving out the intermediate state indicator bit.
While at it, introduce two #define's for that mask -- unfortunately, we can't
use a single #define as the assembly code can't include <asm/arch/hardware.h>
due to C-specfic constructs in it.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
#include <config.h>
+#define MDSTAT_STATE 0x3f
+
.globl lowlevel_init
lowlevel_init:
checkDDRStatClkStop:
ldr r6, MDSTAT_DDR2
ldr r7, [r6]
- and r7, r7, $0x1f
+ and r7, r7, $MDSTAT_STATE
cmp r7, $0x03
bne checkDDRStatClkStop
checkDDRStatClkStop2:
ldr r6, MDSTAT_DDR2
ldr r7, [r6]
- and r7, r7, $0x1f
+ and r7, r7, $MDSTAT_STATE
cmp r7, $0x01
bne checkDDRStatClkStop2
checkDDRStatClkEn2:
ldr r6, MDSTAT_DDR2
ldr r7, [r6]
- and r7, r7, $0x1f
+ and r7, r7, $MDSTAT_STATE
cmp r7, $0x03
bne checkDDRStatClkEn2
while (readl(ptstat) & 0x01)
continue;
- if ((readl(mdstat) & 0x1f) == 0x03)
+ if ((readl(mdstat) & PSC_MDSTAT_STATE) == 0x03)
return; /* Already on and enabled */
writel(readl(mdctl) | 0x03, mdctl);
while (readl(ptstat) & 0x01)
continue;
- while ((readl(mdstat) & 0x1f) != 0x03)
+ while ((readl(mdstat) & PSC_MDSTAT_STATE) != 0x03)
continue;
}
#endif /* CONFIG_SOC_DA8XX */
+#define PSC_MDSTAT_STATE 0x3f
+
#ifndef CONFIG_SOC_DA8XX
/* Miscellania... */