From patchwork Sat Aug 15 02:53:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 41572 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7F2vohE001543 for ; Sat, 15 Aug 2009 02:58:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755673AbZHOC6I (ORCPT ); Fri, 14 Aug 2009 22:58:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756057AbZHOC6I (ORCPT ); Fri, 14 Aug 2009 22:58:08 -0400 Received: from wa-out-1112.google.com ([209.85.146.183]:62562 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755673AbZHOC6H (ORCPT ); Fri, 14 Aug 2009 22:58:07 -0400 Received: by wa-out-1112.google.com with SMTP id j5so349323wah.21 for ; Fri, 14 Aug 2009 19:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=WWwa/zLw6x13E2HSivwftMNtfTLFsmmrODOeWFsvLow=; b=vRQyHLeY8LjIME654UAPemZA90MKGAWirguNhyR357PxVg6hm+bVVZEBhYyZpsIIH/ ZnNbqlbtIel0vK+BbXAuXmFo9Pv/Bg4Z6uWH/67n8npkGkQ40v0tUCTVg1gPRhHs+O47 wDjPvEX/2vvQDwWWSjQbYa+oNqv8QgAVJfDvs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=hHh6FaEG9h98QEZxvW5ssGEcqm2Ru/f6/XPSxfFts/TcO+aQ9y8U0LVgE5juRHjV5z lVVC7YGbotuYS9bq5aE+J2u8y49VQN4lFlFYKRoZzYVRYeEoe5pSIP6NqXF6blVoHd2T hhkUIYzr8VMG1VozWuNXA4LrI8is+rS0wXLyA= Received: by 10.114.164.40 with SMTP id m40mr2403691wae.225.1250305087305; Fri, 14 Aug 2009 19:58:07 -0700 (PDT) Received: from rx1.opensource.se (210-225-125-011.jp.fiberphone.net [210.225.125.11]) by mx.google.com with ESMTPS id f20sm3381296waf.52.2009.08.14.19.58.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 Aug 2009 19:58:06 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Sat, 15 Aug 2009 11:53:42 +0900 Message-Id: <20090815025342.8125.7783.sendpatchset@rx1.opensource.se> In-Reply-To: <20090815025307.8125.50234.sendpatchset@rx1.opensource.se> References: <20090815025307.8125.50234.sendpatchset@rx1.opensource.se> Subject: [PATCH 04/04] sh: sh7724 ddr self-refresh changes Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch updates the SuperH Mobile sleep assembly code with support for DBSC memory controller found in the sh7724 processor. Without this fix the memory hooked up to the sh7724 processor will never enter self-refresh mode before suspending to ram. The effect of this is that the memory contents most likeley will be lost upon resume which may or may not be what you want. Signed-off-by: Magnus Damm --- arch/sh/kernel/cpu/shmobile/sleep.S | 70 ++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/sh/kernel/cpu/shmobile/sleep.S +++ work/arch/sh/kernel/cpu/shmobile/sleep.S 2009-08-14 12:36:40.000000000 +0900 @@ -26,8 +26,30 @@ ENTRY(sh_mobile_standby) tst #SUSP_SH_SF, r0 bt skip_set_sf +#ifdef CONFIG_CPU_SUBTYPE_SH7724 + /* DBSC: put memory in self-refresh mode */ - /* SDRAM: disable power down and put in self-refresh mode */ + mov.l dben_reg, r4 + mov.l dben_data0, r1 + mov.l r1, @r4 + + mov.l dbrfpdn0_reg, r4 + mov.l dbrfpdn0_data0, r1 + mov.l r1, @r4 + + mov.l dbcmdcnt_reg, r4 + mov.l dbcmdcnt_data0, r1 + mov.l r1, @r4 + + mov.l dbcmdcnt_reg, r4 + mov.l dbcmdcnt_data1, r1 + mov.l r1, @r4 + + mov.l dbrfpdn0_reg, r4 + mov.l dbrfpdn0_data1, r1 + mov.l r1, @r4 +#else + /* SBSC: disable power down and put in self-refresh mode */ mov.l 1f, r4 mov.l 2f, r1 mov.l @r4, r2 @@ -35,6 +57,7 @@ ENTRY(sh_mobile_standby) mov.l 3f, r3 and r3, r2 mov.l r2, @r4 +#endif skip_set_sf: tst #SUSP_SH_SLEEP, r0 @@ -84,7 +107,36 @@ done_sleep: tst #SUSP_SH_SF, r0 bt skip_restore_sf - /* SDRAM: set auto-refresh mode */ +#ifdef CONFIG_CPU_SUBTYPE_SH7724 + /* DBSC: put memory in auto-refresh mode */ + + mov.l dbrfpdn0_reg, r4 + mov.l dbrfpdn0_data0, r1 + mov.l r1, @r4 + + /* sleep 140 ns */ + nop + nop + nop + nop + + mov.l dbcmdcnt_reg, r4 + mov.l dbcmdcnt_data0, r1 + mov.l r1, @r4 + + mov.l dbcmdcnt_reg, r4 + mov.l dbcmdcnt_data1, r1 + mov.l r1, @r4 + + mov.l dben_reg, r4 + mov.l dben_data1, r1 + mov.l r1, @r4 + + mov.l dbrfpdn0_reg, r4 + mov.l dbrfpdn0_data2, r1 + mov.l r1, @r4 +#else + /* SBSC: set auto-refresh mode */ mov.l 1f, r4 mov.l @r4, r2 mov.l 4f, r3 @@ -98,15 +150,29 @@ done_sleep: add r4, r3 or r2, r3 mov.l r3, @r1 +#endif skip_restore_sf: rts nop .balign 4 +#ifdef CONFIG_CPU_SUBTYPE_SH7724 +dben_reg: .long 0xfd000010 /* DBEN */ +dben_data0: .long 0 +dben_data1: .long 1 +dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */ +dbrfpdn0_data0: .long 0 +dbrfpdn0_data1: .long 1 +dbrfpdn0_data2: .long 0x00010000 +dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */ +dbcmdcnt_data0: .long 2 +dbcmdcnt_data1: .long 4 +#else 1: .long 0xfe400008 /* SDCR0 */ 2: .long 0x00000400 3: .long 0xffff7fff 4: .long 0xfffffbff +#endif 5: .long 0xa4150020 /* STBCR */ 6: .long 0xfe40001c /* RTCOR */ 7: .long 0xfe400018 /* RTCNT */