From patchwork Thu Jun 26 10:58:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 4427031 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C726D9F319 for ; Thu, 26 Jun 2014 10:59:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C70C420377 for ; Thu, 26 Jun 2014 10:59:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ED90020351 for ; Thu, 26 Jun 2014 10:59:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X07Mg-00037Q-Vm; Thu, 26 Jun 2014 10:57:14 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X07Md-00032B-8f for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 10:57:12 +0000 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7R00H8SVQO6P80@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 19:56:48 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 94.83.13369.F6CFBA35; Thu, 26 Jun 2014 19:56:47 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-d8-53abfc6fc43a Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 24.3E.05196.F6CFBA35; Thu, 26 Jun 2014 19:56:47 +0900 (KST) Received: from abhilash-ubuntu.sisodomain.com ([107.108.73.92]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N7R002TGVQHW5A0@mmp2.samsung.com>; Thu, 26 Jun 2014 19:56:47 +0900 (KST) From: Abhilash Kesavan To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, nicolas.pitre@linaro.org Subject: [PATCH] ARM: EXYNOS: Restore the entry address setup code post-resume Date: Thu, 26 Jun 2014 16:28:32 +0530 Message-id: <1403780312-22885-1-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRmVeSWpSXmKPExsWyRsSkTjf/z+pgg9f3rSwer1nMZLHy/V9G i7PLDrJZrPmrZNG74CqbxabH11gtZpzfx2Tx6dk/dgcOj9kNF1k8ds66y+5x59oeNo/NS+o9 +rasYvT4vEkugC2KyyYlNSezLLVI3y6BK+P50qXsBQtFK06f72VrYDwm2MXIySEhYCLxcM1q RghbTOLCvfVsXYxcHEICSxklFl+YyQZT1PnmPRNEYjqjxKqJd6CcPiaJ+S+ug7WzCehJLPj3 lbmLkYNDRKBOYu1sK5Aws0CFxMMLK9hBbGEBP4mdnUdYQEpYBFQlDk2xAjF5BVwl7j+qBzEl BBQk5kyyARkuIdDPLrF+biPYcBYBAYlvkw+xQNTISmw6wAxxmaTEwRU3WCYwCi5gZFjFKJpa kFxQnJReZKJXnJhbXJqXrpecn7uJERjAp/89m7CD8d4B60OMyUDjJjJLiSbnAyMgryTe0NjM yMLUxNTYyNzSjDRhJXFetUdJQUIC6Yklqd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8RSnJFoqMVcVJwIAISsOkKlAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_035711_471472_9FED6754 X-CRM114-Status: GOOD ( 12.96 ) X-Spam-Score: -5.0 (-----) Cc: abrestic@chromium.org, Abhilash Kesavan , kesavan.abhilash@gmail.com, dianders@chromium.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Setup the mcpm entry address again on system resume as the iRAM contents are lost across an s2r cycle. Signed-off-by: Abhilash Kesavan --- This has been tested after applying the Exynos5420 S2R support series along with Nicolas Pitre's boot cluster CCI enablement patches on Peach Pit. arch/arm/mach-exynos/mcpm-exynos.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 8c610e2..0bf734d 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -26,6 +27,7 @@ #define EXYNOS5420_CPUS_PER_CLUSTER 4 #define EXYNOS5420_NR_CLUSTERS 2 +static void __iomem *ns_sram_base_addr; /* * The common v7_exit_coherency_flush API could not be used because of the * Erratum 799270 workaround. This macro is the same as the common one (in @@ -308,10 +310,26 @@ static const struct of_device_id exynos_dt_mcpm_match[] = { {}, }; +static void exynos_mcpm_setup_entry_point(void) +{ + /* + * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr + * as part of secondary_cpu_start(). Let's redirect it to the + * mcpm_entry_point(). This is done during both secondary boot-up as + * well as system resume. + */ + __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */ + __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */ + __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8); +} + +static struct syscore_ops exynos_mcpm_syscore_ops = { + .resume = exynos_mcpm_setup_entry_point, +}; + static int __init exynos_mcpm_init(void) { struct device_node *node; - void __iomem *ns_sram_base_addr; int ret; node = of_find_matching_node(NULL, exynos_dt_mcpm_match); @@ -357,16 +375,9 @@ static int __init exynos_mcpm_init(void) pr_info("Exynos MCPM support installed\n"); - /* - * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr - * as part of secondary_cpu_start(). Let's redirect it to the - * mcpm_entry_point(). - */ - __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */ - __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */ - __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8); + exynos_mcpm_setup_entry_point(); - iounmap(ns_sram_base_addr); + register_syscore_ops(&exynos_mcpm_syscore_ops); return ret; }