Skip to content

Commit a02875c

Browse files
committed
ARM: at91: pm: fix self-refresh for sama7g5
It has been discovered that on some parts, from time to time, self-refresh procedure doesn't work as expected. Debugging and investigating it proved that disabling AC DLL introduce glitches in RAM controllers which leads to unexpected behavior. This is confirmed as a hardware bug. DLL bypass disables 3 DLLs: 2 DX DLLs and AC DLL. Thus, keep only DX DLLs disabled. This introduce 6mA extra current consumption on VDDCORE when switching to any ULP mode or standby mode but the self-refresh procedure still works. Fixes: f0bbf17 ("ARM: at91: pm: add self-refresh support for sama7g5") Suggested-by: Frederic Schumacher <[email protected]> Signed-off-by: Claudiu Beznea <[email protected]> Tested-by: Cristian Birsan <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f04445f commit a02875c

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

arch/arm/mach-at91/pm_suspend.S

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,15 @@ sr_ena_2:
172172
/* Put DDR PHY's DLL in bypass mode for non-backup modes. */
173173
cmp r7, #AT91_PM_BACKUP
174174
beq sr_ena_3
175-
ldr tmp1, [r3, #DDR3PHY_PIR]
176-
orr tmp1, tmp1, #DDR3PHY_PIR_DLLBYP
177-
str tmp1, [r3, #DDR3PHY_PIR]
175+
176+
/* Disable DX DLLs. */
177+
ldr tmp1, [r3, #DDR3PHY_DX0DLLCR]
178+
orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
179+
str tmp1, [r3, #DDR3PHY_DX0DLLCR]
180+
181+
ldr tmp1, [r3, #DDR3PHY_DX1DLLCR]
182+
orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
183+
str tmp1, [r3, #DDR3PHY_DX1DLLCR]
178184

179185
sr_ena_3:
180186
/* Power down DDR PHY data receivers. */
@@ -221,10 +227,14 @@ sr_ena_3:
221227
bic tmp1, tmp1, #DDR3PHY_DSGCR_ODTPDD_ODT0
222228
str tmp1, [r3, #DDR3PHY_DSGCR]
223229

224-
/* Take DDR PHY's DLL out of bypass mode. */
225-
ldr tmp1, [r3, #DDR3PHY_PIR]
226-
bic tmp1, tmp1, #DDR3PHY_PIR_DLLBYP
227-
str tmp1, [r3, #DDR3PHY_PIR]
230+
/* Enable DX DLLs. */
231+
ldr tmp1, [r3, #DDR3PHY_DX0DLLCR]
232+
bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
233+
str tmp1, [r3, #DDR3PHY_DX0DLLCR]
234+
235+
ldr tmp1, [r3, #DDR3PHY_DX1DLLCR]
236+
bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
237+
str tmp1, [r3, #DDR3PHY_DX1DLLCR]
228238

229239
/* Enable quasi-dynamic programming. */
230240
mov tmp1, #0

include/soc/at91/sama7-ddr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939

4040
#define DDR3PHY_ZQ0SR0 (0x188) /* ZQ status register 0 */
4141

42+
#define DDR3PHY_DX0DLLCR (0x1CC) /* DDR3PHY DATX8 DLL Control Register */
43+
#define DDR3PHY_DX1DLLCR (0x20C) /* DDR3PHY DATX8 DLL Control Register */
44+
#define DDR3PHY_DXDLLCR_DLLDIS (1 << 31) /* DLL Disable */
45+
4246
/* UDDRC */
4347
#define UDDRC_STAT (0x04) /* UDDRC Operating Mode Status Register */
4448
#define UDDRC_STAT_SELFREF_TYPE_DIS (0x0 << 4) /* SDRAM is not in Self-refresh */

0 commit comments

Comments
 (0)