From patchwork Fri Jan 11 05:47:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inderpal Singh X-Patchwork-Id: 13969 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3522923E57 for ; Fri, 11 Jan 2013 05:48:11 +0000 (UTC) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by fiordland.canonical.com (Postfix) with ESMTP id C9FC8A19DFF for ; Fri, 11 Jan 2013 05:48:10 +0000 (UTC) Received: by mail-vb0-f44.google.com with SMTP id fc26so1110134vbb.17 for ; Thu, 10 Jan 2013 21:48:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=uwoD4IPxR9cafT+GC28gqEFAajBGsYEkYnBwsP7U3+s=; b=KW0JgLzeuEWPnN8FLYlGBCAIkSQfvCXjh9pM8y2POtuhJSkR61QM+tS+2D85YlfVvG Ll1QMHnB7k5Khb+hW5OtrhkrAJneKk7iSL/JhsEJf/SbXeK4CEaV1mP6vOI0LV0qHzht FSeciDLL94+aCODS0bnrdLh7V3WhTbZi/pYUF+z7gwaxlouJC7/u7tg/XK4ycO96wjVs c1BAgi538VkYI9GZwFvQirknRP8jVQZE7xfiW7NGLKmif4Ufqfq2J4fLa0b1eZLJY198 gZdi778XEApuq0xKqVb0WOM9sZIUQPJYraaiIveWIGOLnqZgpjhfXBTvdOgo7cBKPCK6 jYMQ== X-Received: by 10.58.181.42 with SMTP id dt10mr11492278vec.34.1357883290299; Thu, 10 Jan 2013 21:48:10 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp97454veb; Thu, 10 Jan 2013 21:48:09 -0800 (PST) X-Received: by 10.68.125.201 with SMTP id ms9mr226742457pbb.78.1357883288789; Thu, 10 Jan 2013 21:48:08 -0800 (PST) Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) by mx.google.com with ESMTPS id e2si4200379paz.121.2013.01.10.21.48.08 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jan 2013 21:48:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) client-ip=209.85.160.51; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) smtp.mail=inderpal.singh@linaro.org Received: by mail-pb0-f51.google.com with SMTP id ro12so757058pbb.10 for ; Thu, 10 Jan 2013 21:48:08 -0800 (PST) X-Received: by 10.68.243.33 with SMTP id wv1mr221155128pbc.143.1357883288321; Thu, 10 Jan 2013 21:48:08 -0800 (PST) Received: from inder-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPS id mz10sm2147610pbc.37.2013.01.10.21.48.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jan 2013 21:48:07 -0800 (PST) From: Inderpal Singh To: linux-samsung-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, lorenzo.pieralisi@arm.com, amit.daniel@samsung.com, patches@linaro.org Subject: [PATCH] arm: exynos4: Fix suspend/resume hang Date: Fri, 11 Jan 2013 11:17:58 +0530 Message-Id: <1357883278-26239-1-git-send-email-inderpal.singh@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlwNrO9FcWYHVjVihEpsCkpz97kYGfrz15x+fU363iu8htFhsiaSrLkUxVhqRV8Aek2RLms commit d0341c61a2 removed the l2 cache save/restore from pm.c and commit 7c6035b63b added the l2 cache restoration in sleep.s to early enable the cache in resume path. With these changes the system hangs while resuming when vdd_arm is turned off in suspended state. The cache needs to be invalidated before turning it on, as it was being done before mentioned commits. Signed-off-by: Inderpal Singh Reviewed-by: Thomas Abraham --- arch/arm/mach-exynos/common.h | 1 + arch/arm/mach-exynos/pm.c | 4 ++++ arch/arm/plat-samsung/s5p-sleep.S | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index af33872..056d9ce 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -78,6 +78,7 @@ enum sys_powerdown { }; extern unsigned long l2x0_regs_phys; +extern unsigned long wake_reason_reg_phys; struct exynos_pmu_conf { void __iomem *reg; unsigned int val[NUM_SYS_POWERDOWN]; diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index f459afd..b10513c 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -220,6 +220,10 @@ static __init int exynos_pm_drvinit(void) s3c_pm_init(); +#ifdef CONFIG_CACHE_L2X0 + if (!soc_is_exynos5250() && !soc_is_exynos5440()) + wake_reason_reg_phys = virt_to_phys(S5P_INFORM1); +#endif /* All wakeup disable */ tmp = __raw_readl(S5P_WAKEUP_MASK); diff --git a/arch/arm/plat-samsung/s5p-sleep.S b/arch/arm/plat-samsung/s5p-sleep.S index bdf6dad..74331e2 100644 --- a/arch/arm/plat-samsung/s5p-sleep.S +++ b/arch/arm/plat-samsung/s5p-sleep.S @@ -24,6 +24,7 @@ #include #include #include +#include /* * The following code is located into the .data section. This is to @@ -67,6 +68,25 @@ ENTRY(s3c_cpu_resume) str r2, [r1, #L2X0_PREFETCH_CTRL] ldr r2, [r0, #L2X0_R_PWR_CTRL] str r2, [r1, #L2X0_POWER_CTRL] + + /* check resume reason */ + adr r0, wake_reason_reg_phys + ldr r0, [r0] + ldr r2, [r0] + ldr r0, =S5P_CHECK_SLEEP + cmp r0, r2 + bne turn_cache_on + + /* Invalidate the cache if resume from sleep */ + ldr r2, =0xffff + str r2, [r1, #L2X0_INV_WAY] +wait: + ldr r2, [r1, #L2X0_INV_WAY] + ldr r0, =0xffff + ands r2, r2, r0 + bne wait + +turn_cache_on: mov r2, #1 str r2, [r1, #L2X0_CTRL] resume_l2on: @@ -77,4 +97,7 @@ ENDPROC(s3c_cpu_resume) .globl l2x0_regs_phys l2x0_regs_phys: .long 0 + .globl wake_reason_reg_phys +wake_reason_reg_phys: + .long 0 #endif