From patchwork Wed Sep 24 11:05:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 37805 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35763202DB for ; Wed, 24 Sep 2014 11:07:00 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf5286956lbd.11 for ; Wed, 24 Sep 2014 04:06:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=KkARG397xGFvq/cpVBVbBnO8XZ05tTeEUAM/rjNC2aM=; b=icmIhtNIkuzBPZ9HN22xzy2QyhI0l8UWIQR0FRmNePqwYYW79Ci2JNka+tSPDVplL9 /72ZUnF3VaCyJHgU/ZfGroC4heJFmfS6d9jfAxQnR+jACvcBPeoR8h/gSAzlstG0oKW8 XkKRmzKtL3E7rnQlSGxIQQ8/+TN4ZAG2cTiRPHzdm74bXUJS9h4FGckOPn2q/ZH/bjUS q5lNjC9/5eQFHtClr+5OQ1NUq85oGB1rYhhGLSftuHCC2lF966VtpAm1RogLOBjSx+W/ LOrAS70sg2cnGSEkYhH+cL3m9jMUovGbo+PHkMO5PemcZyeS6wpxabRPn5ocEY9VLSFH JE/w== X-Gm-Message-State: ALoCoQlvp9CpdQ4GjYNm+N84v7gde9C7T58eMybB51twHHnGEdEAjCWjHT36MM1gdKtF/E8+6S6s X-Received: by 10.194.201.198 with SMTP id kc6mr901861wjc.0.1411556818961; Wed, 24 Sep 2014 04:06:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.40 with SMTP id p8ls129297lah.106.gmail; Wed, 24 Sep 2014 04:06:58 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr5476118lbb.12.1411556818640; Wed, 24 Sep 2014 04:06:58 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx.google.com with ESMTPS id p14si22452069lal.6.2014.09.24.04.06.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 04:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id 10so8647118lbg.18 for ; Wed, 24 Sep 2014 04:06:58 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr5574907lal.71.1411556818519; Wed, 24 Sep 2014 04:06:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp562321lbb; Wed, 24 Sep 2014 04:06:57 -0700 (PDT) X-Received: by 10.66.136.48 with SMTP id px16mr8405134pab.10.1411556816968; Wed, 24 Sep 2014 04:06:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tk10si25725981pac.134.2014.09.24.04.06.55 for ; Wed, 24 Sep 2014 04:06:56 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbaIXLGw (ORCPT + 27 others); Wed, 24 Sep 2014 07:06:52 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:28616 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753387AbaIXLFx (ORCPT ); Wed, 24 Sep 2014 07:05:53 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NCE00J75KAFIU70@mailout4.w1.samsung.com>; Wed, 24 Sep 2014 12:08:39 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-4d-5422a58fdadc Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id A6.F0.15956.F85A2245; Wed, 24 Sep 2014 12:05:51 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NCE00JS4K5ISSA0@eusync4.samsung.com>; Wed, 24 Sep 2014 12:05:51 +0100 (BST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Tomasz Figa , Kyungmin Park , Russell King - ARM Linux , Kukjin Kim , lauraa@codeaurora.org, linux-omap@vger.kernel.org, linus.walleij@linaro.org, santosh.shilimkar@ti.com, tony@atomide.com, drake@endlessm.com, loeliger@gmail.com Subject: [PATCH v5 6/7] ARM: EXYNOS: Add support for non-secure L2X0 resume Date: Wed, 24 Sep 2014 13:05:40 +0200 Message-id: <1411556741-5810-7-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1411556741-5810-1-git-send-email-m.szyprowski@samsung.com> References: <1411556741-5810-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrELMWRmVeSWpSXmKPExsVy+t/xa7r9S5VCDH4tELZ4NP8xs0Xvgqts Fmeb3rBbbO+cwW4x5c9yJotNj6+xWlzeNYfNYvaSfhaLGef3MVncvsxrcW77FhaLtUfuslu8 7lvDbLFq1x9Gi/1XvBz4PVqae9g8vn2dxOJxua+XyWPR9yyPnbPusnvcubaHzWPzknqPvi2r GD2O39jO5PF5k1wAVxSXTUpqTmZZapG+XQJXxvv7v5gL9gpUXDhxn6mBcRNvFyMnh4SAicT3 M1MZIWwxiQv31rN1MXJxCAksZZSYd2M7K4TTxyQx6d0iVpAqNgFDia63XWwgtohAtsSPb5NZ QIqYBVqZJR4/+QZWJCzgLbFiyVoWEJtFQFVi0qeXQDYHB6+Au8SUU4YQ2+Qk/r9cwQRicwp4 SDx+/I8RpEQIqKRpk8sERt4FjAyrGEVTS5MLipPSc430ihNzi0vz0vWS83M3MULC+esOxqXH rA4xCnAwKvHwThRXChFiTSwrrsw9xCjBwawkwvuqByjEm5JYWZValB9fVJqTWnyIkYmDU6qB MeiF294O9ay7UzXsHS2+c23mVjjo+qGEXVpht9jsdivTpSHyeROuNMbxvHlXZ3P7qOyvOyxl 3z/G8tnHyCnMef8xXXL9rLPzlVhe6ztNF37C7pzAff3gORGzrK1eB9VL5Zcov1VevOZHXP0d g6dtz/RNFy6+vjKJRXrLXx9+loyd8sF3voevVGIpzkg01GIuKk4EAOR89kRFAgAA Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Tomasz Figa On Exynos SoCs it is necessary to resume operation of L2C early in assembly code, because otherwise certain systems will crash. This patch adds necessary code to non-secure resume handler. Signed-off-by: Tomasz Figa [rewrote the code accessing l2x0_saved_regs] Sigend-off-by: Marek Szyprowski --- arch/arm/mach-exynos/sleep.S | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S index e3c373082bbe..31d25834b9c4 100644 --- a/arch/arm/mach-exynos/sleep.S +++ b/arch/arm/mach-exynos/sleep.S @@ -16,6 +16,8 @@ */ #include +#include +#include #include "smc.h" #define CPU_MASK 0xff0ffff0 @@ -74,6 +76,45 @@ ENTRY(exynos_cpu_resume_ns) mov r0, #SMC_CMD_C15RESUME dsb smc #0 +#ifdef CONFIG_CACHE_L2X0 + adr r0, 1f + ldr r2, [r0] + add r0, r2, r0 + + /* Check that the address has been initialised. */ + ldr r1, [r0, #L2X0_R_PHY_BASE] + teq r1, #0 + beq skip_l2x0 + + /* Check if controller has been enabled. */ + ldr r2, [r1, #L2X0_CTRL] + tst r2, #0x1 + bne skip_l2x0 + + ldr r1, [r0, #L2X0_R_TAG_LATENCY] + ldr r2, [r0, #L2X0_R_DATA_LATENCY] + ldr r3, [r0, #L2X0_R_PREFETCH_CTRL] + mov r0, #SMC_CMD_L2X0SETUP1 + smc #0 + + /* Reload saved regs pointer because smc corrupts registers. */ + adr r0, 1f + ldr r2, [r0] + add r0, r2, r0 + + ldr r1, [r0, #L2X0_R_PWR_CTRL] + ldr r2, [r0, #L2X0_R_AUX_CTRL] + mov r0, #SMC_CMD_L2X0SETUP2 + smc #0 + + mov r0, #SMC_CMD_L2X0INVALL + smc #0 + + mov r1, #1 + mov r0, #SMC_CMD_L2X0CTRL + smc #0 +skip_l2x0: +#endif /* CONFIG_CACHE_L2X0 */ skip_cp15: b cpu_resume ENDPROC(exynos_cpu_resume_ns) @@ -83,3 +124,8 @@ cp15_save_diag: .globl cp15_save_power cp15_save_power: .long 0 @ cp15 power control + +#ifdef CONFIG_CACHE_L2X0 + .align +1: .long l2x0_saved_regs - . +#endif /* CONFIG_CACHE_L2X0 */