^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) * AP325RXA 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(ap325rxa_sdram_enter_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* SBSC: disable power down and put in self-refresh mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) mov.l 1f, r4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) mov.l 2f, r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) mov.l @r4, r2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) or r1, r2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) mov.l 3f, r3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) and r3, r2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) mov.l r2, @r4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .balign 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 1: .long 0xfe400008 /* SDCR0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 2: .long 0x00000400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 3: .long 0xffff7fff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ENTRY(ap325rxa_sdram_enter_end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .balign 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) ENTRY(ap325rxa_sdram_leave_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* SBSC: set auto-refresh mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) mov.l 1f, r4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) mov.l @r4, r0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) mov.l 4f, r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) and r1, r0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) mov.l r0, @r4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) mov.l 6f, r4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) mov.l 8f, r0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) mov.l @r4, r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) mov #-1, r4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) add r4, r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) or r1, r0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) mov.l 7f, r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) mov.l r0, @r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .balign 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 1: .long 0xfe400008 /* SDCR0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 4: .long 0xfffffbff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 6: .long 0xfe40001c /* RTCOR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 7: .long 0xfe400018 /* RTCNT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 8: .long 0xa55a0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ENTRY(ap325rxa_sdram_leave_end)