Commit 1a56fcea9f47ce9184f4dafd3e856de2d85d47cd
Committed by
York Sun
1 parent
438031e1bc
Exists in
v2017.01-smarct4x
and in
35 other branches
fsl/deepsleep: avoid the DDR restore from being optimized out
Function dp_ddr_restore is to restore the first 128-byte space of DDR. However those codes may be optimized out by compiler since the destination address is at 0x0. In order to avoid compiler optimization, we restore the space from high address, which is not at 0x0, to low address. Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
board/freescale/common/mpc85xx_sleep.c
... | ... | @@ -43,16 +43,16 @@ |
43 | 43 | */ |
44 | 44 | static void dp_ddr_restore(void) |
45 | 45 | { |
46 | - volatile u64 *src, *dst; | |
46 | + u64 *src, *dst; | |
47 | 47 | int i; |
48 | 48 | struct ccsr_scfg __iomem *scfg = (void *)CONFIG_SYS_MPC85xx_SCFG; |
49 | 49 | |
50 | 50 | /* get the address of ddr date from SPARECR3 */ |
51 | - src = (u64 *)in_be32(&scfg->sparecr[2]); | |
52 | - dst = (u64 *)CONFIG_SYS_SDRAM_BASE; | |
51 | + src = (u64 *)(in_be32(&scfg->sparecr[2]) + DDR_BUFF_LEN - 8); | |
52 | + dst = (u64 *)(CONFIG_SYS_SDRAM_BASE + DDR_BUFF_LEN - 8); | |
53 | 53 | |
54 | 54 | for (i = 0; i < DDR_BUFF_LEN / 8; i++) |
55 | - *dst++ = *src++; | |
55 | + *dst-- = *src--; | |
56 | 56 | |
57 | 57 | flush_dcache(); |
58 | 58 | } |