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: 1964501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 08E893FF0F for ; Fri, 11 Jan 2013 05:55:16 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TtXWD-0007Vn-Ey; Fri, 11 Jan 2013 05:51:06 +0000 Received: from mail-pa0-f45.google.com ([209.85.220.45]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TtXTR-0005UY-4b for linux-arm-kernel@lists.infradead.org; Fri, 11 Jan 2013 05:48:20 +0000 Received: by mail-pa0-f45.google.com with SMTP id bg2so808405pad.4 for ; Thu, 10 Jan 2013 21:48:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=uwoD4IPxR9cafT+GC28gqEFAajBGsYEkYnBwsP7U3+s=; b=j7lf9MhLuwulrymLSVb32kAAjt36kzEuL+zvsCgx3kom48YItW+zfA35Kl5xoqX2VS TskEZG3sgOMjnu7GRk3VPVt7qz9NjnnW4RYtnnyExcsbxSB/jmoleqfWUTx67/PohOJs Gcp1x7bivYsCu9LhF+Vf2Yn4eys/2RyeyZbmjohDhJdC1KLN1vzK5R3hLUhuSuVnQiB4 2YEsZ68/qZ/9TibanpYAp7opkVNjpKprEJfwO6TLGXUfPnLRLPV6Nidxh/yAiA3l0t2f tGvZDy446P1WMnY4nfSkhGAzCX23WVd7MUE4dNMCJ/ovnih1E6poDLV+lu4V9aUpM6IU pCHA== 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 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: ALoCoQlUHCUYnkckXSkyZ3THgrxnIAe1kBMYyvumwjDsDa/vZa485mosfYCcN0VYx6esZHIuN8/0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130111_004814_275923_DEEF72E5 X-CRM114-Status: GOOD ( 13.10 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.45 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: lorenzo.pieralisi@arm.com, amit.daniel@samsung.com, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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