Skip to content

Commit 4de1ad2

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 it it has been proved that reverting DLL bypass and power down of the IOs fix the issue. Reverting only one or the other had no effect (issue still present). Thus, for the moment keep only the DX DLLs bypassing and avoid AC DLL bypass + IO disable. It may happen that AC DLL bypass to produce glitches in RAM controllers that might produce the breakage that has been discovered. With the code in current patch there is an extra current consumption of 6mA when switching to any ULP or standby modes but the self-refresh procedure still works. Thus until further investigation keep it like this. Fixes: f0bbf17 ("ARM: at91: pm: add self-refresh support for sama7g5") Suggested-by: Frederic Schumacher <frederic.schumacher@microchip.com> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Tested-by: Cristian Birsan <cristian.birsan@microchip.com>
1 parent 88093de commit 4de1ad2

2 files changed

Lines changed: 19 additions & 40 deletions

File tree

arch/arm/mach-at91/pm_suspend.S

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -193,27 +193,16 @@ sr_ena_2:
193193
/* Put DDR PHY's DLL in bypass mode for non-backup modes. */
194194
cmp r7, #AT91_PM_BACKUP
195195
beq sr_ena_3
196-
ldr tmp1, [r3, #DDR3PHY_PIR]
197-
orr tmp1, tmp1, #DDR3PHY_PIR_DLLBYP
198-
str tmp1, [r3, #DDR3PHY_PIR]
196+
197+
ldr tmp1, [r3, #DDR3PHY_DX0DLLCR]
198+
orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
199+
str tmp1, [r3, #DDR3PHY_DX0DLLCR]
200+
201+
ldr tmp1, [r3, #DDR3PHY_DX1DLLCR]
202+
orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
203+
str tmp1, [r3, #DDR3PHY_DX1DLLCR]
199204

200205
sr_ena_3:
201-
/* Power down DDR PHY data receivers. */
202-
ldr tmp1, [r3, #DDR3PHY_DXCCR]
203-
orr tmp1, tmp1, #DDR3PHY_DXCCR_DXPDR
204-
str tmp1, [r3, #DDR3PHY_DXCCR]
205-
206-
/* Power down ADDR/CMD IO. */
207-
ldr tmp1, [r3, #DDR3PHY_ACIOCR]
208-
orr tmp1, tmp1, #DDR3PHY_ACIORC_ACPDD
209-
orr tmp1, tmp1, #DDR3PHY_ACIOCR_CKPDD_CK0
210-
orr tmp1, tmp1, #DDR3PHY_ACIOCR_CSPDD_CS0
211-
str tmp1, [r3, #DDR3PHY_ACIOCR]
212-
213-
/* Power down ODT. */
214-
ldr tmp1, [r3, #DDR3PHY_DSGCR]
215-
orr tmp1, tmp1, #DDR3PHY_DSGCR_ODTPDD_ODT0
216-
str tmp1, [r3, #DDR3PHY_DSGCR]
217206
.endm
218207

219208
/**
@@ -225,27 +214,13 @@ sr_ena_3:
225214
ldr r2, .sramc_base
226215
ldr r3, .sramc_phy_base
227216

228-
/* Power up DDR PHY data receivers. */
229-
ldr tmp1, [r3, #DDR3PHY_DXCCR]
230-
bic tmp1, tmp1, #DDR3PHY_DXCCR_DXPDR
231-
str tmp1, [r3, #DDR3PHY_DXCCR]
232-
233-
/* Power up the output of CK and CS pins. */
234-
ldr tmp1, [r3, #DDR3PHY_ACIOCR]
235-
bic tmp1, tmp1, #DDR3PHY_ACIORC_ACPDD
236-
bic tmp1, tmp1, #DDR3PHY_ACIOCR_CKPDD_CK0
237-
bic tmp1, tmp1, #DDR3PHY_ACIOCR_CSPDD_CS0
238-
str tmp1, [r3, #DDR3PHY_ACIOCR]
239-
240-
/* Power up ODT. */
241-
ldr tmp1, [r3, #DDR3PHY_DSGCR]
242-
bic tmp1, tmp1, #DDR3PHY_DSGCR_ODTPDD_ODT0
243-
str tmp1, [r3, #DDR3PHY_DSGCR]
244-
245-
/* Take DDR PHY's DLL out of bypass mode. */
246-
ldr tmp1, [r3, #DDR3PHY_PIR]
247-
bic tmp1, tmp1, #DDR3PHY_PIR_DLLBYP
248-
str tmp1, [r3, #DDR3PHY_PIR]
217+
ldr tmp1, [r3, #DDR3PHY_DX0DLLCR]
218+
bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
219+
str tmp1, [r3, #DDR3PHY_DX0DLLCR]
220+
221+
ldr tmp1, [r3, #DDR3PHY_DX1DLLCR]
222+
bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
223+
str tmp1, [r3, #DDR3PHY_DX1DLLCR]
249224

250225
/* Enable quasi-dynamic programming. */
251226
mov tmp1, #0

include/soc/at91/sama7-ddr.h

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

4242
#define DDR3PHY_ZQ0SR0 (0x188) /* ZQ status register 0 */
4343

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

0 commit comments

Comments
 (0)