^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * KFR2R09 sdram self/auto-refresh setup code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2009 Magnus Damm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/sys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/romimage-macros.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /* code to enter and leave self-refresh. must be self-contained.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * this code will be copied to on-chip memory and executed from there.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .balign 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ENTRY(kfr2r09_sdram_enter_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* DBSC: put memory in self-refresh mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) ED 0xFD000010, 0x00000000 /* DBEN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ENTRY(kfr2r09_sdram_enter_end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .balign 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) ENTRY(kfr2r09_sdram_leave_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* DBSC: put memory in auto-refresh mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) mov.l @(SH_SLEEP_MODE, r5), r0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) tst #SUSP_SH_RSTANDBY, r0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) bf resume_rstandby
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) WAIT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) ED 0xFD000010, 0x00000001 /* DBEN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) resume_rstandby:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* DBSC: re-initialize and put in auto-refresh */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ED 0xFD000108, 0x40000301 /* DBPDCNT0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) ED 0xFD000020, 0x011B0002 /* DBCONF */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ED 0xFD000030, 0x03060E02 /* DBTR0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ED 0xFD000034, 0x01020102 /* DBTR1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) ED 0xFD000038, 0x01090406 /* DBTR2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ED 0xFD000008, 0x00000004 /* DBKIND */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ED 0xFD000018, 0x00000001 /* DBCKECNT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) WAIT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) ED 0xFD000010, 0x00000001 /* DBEN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ED 0xFD000044, 0x000004AF /* DBRFPDN1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ED 0xFD000048, 0x20CF0037 /* DBRFPDN2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ED 0xFD000108, 0x40000300 /* DBPDCNT0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) ENTRY(kfr2r09_sdram_leave_end)