xref: /openbmc/linux/arch/sh/boards/mach-migor/sdram.S (revision 81de3bf3)
1/* SPDX-License-Identifier: GPL-2.0
2 *
3 * Migo-R sdram self/auto-refresh setup code
4 *
5 *  Copyright (C) 2009 Magnus Damm
6 */
7
8#include <linux/sys.h>
9#include <linux/errno.h>
10#include <linux/linkage.h>
11#include <asm/asm-offsets.h>
12#include <asm/suspend.h>
13#include <asm/romimage-macros.h>
14
15/* code to enter and leave self-refresh. must be self-contained.
16 * this code will be copied to on-chip memory and executed from there.
17 */
18	.balign 4
19ENTRY(migor_sdram_enter_start)
20
21	/* SBSC: disable power down and put in self-refresh mode */
22	mov.l	1f, r4
23	mov.l	2f, r1
24	mov.l	@r4, r2
25	or	r1, r2
26	mov.l   3f, r3
27	and	r3, r2
28	mov.l	r2, @r4
29
30	rts
31	 nop
32
33	.balign 4
341:	.long	0xfe400008 /* SDCR0 */
352:	.long	0x00000400
363:	.long	0xffff7fff
37ENTRY(migor_sdram_enter_end)
38
39	.balign 4
40ENTRY(migor_sdram_leave_start)
41
42	/* SBSC: set auto-refresh mode */
43	mov.l	1f, r4
44	mov.l	@r4, r0
45	mov.l   4f, r1
46	and	r1, r0
47	mov.l	r0, @r4
48	mov.l	6f, r4
49	mov.l	8f, r0
50	mov.l	@r4, r1
51	mov	#-1, r4
52	add	r4, r1
53	or	r1, r0
54	mov.l	7f, r1
55	mov.l	r0, @r1
56
57	rts
58	 nop
59
60	.balign 4
611:	.long	0xfe400008 /* SDCR0 */
624:	.long	0xfffffbff
636:	.long   0xfe40001c /* RTCOR */
647:	.long   0xfe400018 /* RTCNT */
658:	.long   0xa55a0000
66ENTRY(migor_sdram_leave_end)
67