Path: blob/master/arch/sh/boards/mach-se/7724/sdram.S
15162 views
/*1* MS7724SE sdram self/auto-refresh setup code2*3* Copyright (C) 2009 Magnus Damm4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*/910#include <linux/sys.h>11#include <linux/errno.h>12#include <linux/linkage.h>13#include <asm/asm-offsets.h>14#include <asm/suspend.h>15#include <asm/romimage-macros.h>1617/* code to enter and leave self-refresh. must be self-contained.18* this code will be copied to on-chip memory and executed from there.19*/20.balign 421ENTRY(ms7724se_sdram_enter_start)2223/* DBSC: put memory in self-refresh mode */2425ED 0xFD000010, 0x00000000 /* DBEN */26ED 0xFD000040, 0x00000000 /* DBRFPDN0 */27ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */28ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */29ED 0xFD000040, 0x00000001 /* DBRFPDN0 */3031rts32nop3334ENTRY(ms7724se_sdram_enter_end)3536.balign 437ENTRY(ms7724se_sdram_leave_start)3839/* DBSC: put memory in auto-refresh mode */4041mov.l @(SH_SLEEP_MODE, r5), r042tst #SUSP_SH_RSTANDBY, r043bf resume_rstandby4445ED 0xFD000040, 0x00000000 /* DBRFPDN0 */46WAIT 147ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */48ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */49ED 0xFD000010, 0x00000001 /* DBEN */50ED 0xFD000040, 0x00010000 /* DBRFPDN0 */5152rts53nop5455resume_rstandby:5657/* CPG: setup clocks before restarting external memory */5859ED 0xA4150024, 0x00004000 /* PLLCR */6061mov.l FRQCRA,r062mov.l @r0,r363mov.l KICK,r164or r1, r365mov.l r3, @r06667mov.l LSTATS,r068mov #1,r169WAIT_LSTATS:70mov.l @r0,r371tst r1,r372bf WAIT_LSTATS7374/* DBSC: re-initialize and put in auto-refresh */7576ED 0xFD000108, 0x00000181 /* DBPDCNT0 */77ED 0xFD000020, 0x015B0002 /* DBCONF */78ED 0xFD000030, 0x03071502 /* DBTR0 */79ED 0xFD000034, 0x02020102 /* DBTR1 */80ED 0xFD000038, 0x01090405 /* DBTR2 */81ED 0xFD00003C, 0x00000002 /* DBTR3 */82ED 0xFD000008, 0x00000005 /* DBKIND */83ED 0xFD000040, 0x00000001 /* DBRFPDN0 */84ED 0xFD000040, 0x00000000 /* DBRFPDN0 */85ED 0xFD000018, 0x00000001 /* DBCKECNT */8687mov #100,r088WAIT_400NS:89dt r090bf WAIT_400NS9192ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */93ED 0xFD000060, 0x00020000 /* DBMRCNT (EMR2) */94ED 0xFD000060, 0x00030000 /* DBMRCNT (EMR3) */95ED 0xFD000060, 0x00010004 /* DBMRCNT (EMR) */96ED 0xFD000060, 0x00000532 /* DBMRCNT (MRS) */97ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */98ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */99ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */100ED 0xFD000060, 0x00000432 /* DBMRCNT (MRS) */101ED 0xFD000060, 0x000103c0 /* DBMRCNT (EMR) */102ED 0xFD000060, 0x00010040 /* DBMRCNT (EMR) */103104mov #100,r0105WAIT_400NS_2:106dt r0107bf WAIT_400NS_2108109ED 0xFD000010, 0x00000001 /* DBEN */110ED 0xFD000044, 0x0000050f /* DBRFPDN1 */111ED 0xFD000048, 0x236800e6 /* DBRFPDN2 */112113mov.l DUMMY,r0114mov.l @r0, r1 /* force single dummy read */115116ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */117ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */118ED 0xFD000108, 0x00000080 /* DBPDCNT0 */119ED 0xFD000040, 0x00010000 /* DBRFPDN0 */120121rts122nop123124.balign 4125DUMMY: .long 0xac400000126FRQCRA: .long 0xa4150000127KICK: .long 0x80000000128LSTATS: .long 0xa4150060129130ENTRY(ms7724se_sdram_leave_end)131132133