From patchwork Wed Mar 18 12:51:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 6038851 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78CC99F318 for ; Wed, 18 Mar 2015 12:55:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC3A92050B for ; Wed, 18 Mar 2015 12:55:22 +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 BBA512039C for ; Wed, 18 Mar 2015 12:55:21 +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 1YYDT4-0006hF-L2; Wed, 18 Mar 2015 12:53:02 +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 1YYDSf-0006Ue-1u for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 12:52:38 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NLE00BJHRRCT640@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 21:52:24 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-39-55097508e077 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id EB.98.20081.80579055; Wed, 18 Mar 2015 21:52:24 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NLE0090BRQJ9L30@mmp1.samsung.com>; Wed, 18 Mar 2015 21:52:24 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Kukjin Kim , Kukjin Kim Subject: [PATCH v3 2/4] ARM: EXYNOS: add code for setting/clearing boot flag Date: Wed, 18 Mar 2015 13:51:51 +0100 Message-id: <1426683113-31209-3-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1426683113-31209-1-git-send-email-b.zolnierkie@samsung.com> References: <1426683113-31209-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKLMWRmVeSWpSXmKPExsVy+t9jAV2OUs5Qg/YbHBYbZ6xntZj3Wdai d8FVNov+x6+ZLc42vWG32PT4GqvF5V1z2Cw+9x5htJhxfh+TxapdfxgduDx2zrrL7rFpVSeb x51re9g8Ni+p9+jbsorR4/MmuQC2KC6blNSczLLUIn27BK6Me2ubGAuW8Ff8vbOPpYHxBU8X IweHhICJxPpF+V2MnECmmMSFe+vZuhi5OIQEFjFKTF6ymwkkISTQxSTxYmo6iM0mYCUxsX0V I4gtIuAqMefKJEaQBmaBhUwSs94+YQdJCAv4SFx6fYIZxGYRUJWYP68bzOYV8JB4dP0NE8Q2 RYnuZxPYQGxOAU+JecdnsUAs85DYdqGDaQIj7wJGhlWMoqkFyQXFSem5hnrFibnFpXnpesn5 uZsYwYH3TGoH48oGi0OMAhyMSjy8Elc5QoVYE8uKK3MPMUpwMCuJ8HJncYYK8aYkVlalFuXH F5XmpBYfYpTmYFES51WybwsREkhPLEnNTk0tSC2CyTJxcEo1MFqx8h87dTZvwY/P53fc11NP 51X8UG2wQKTzpt2Rxo9Mj5a97ZRtXrMiac7/NU97N85fd4NX7qfT+Z4t9z1f9nAyHnY4xP7D OHZFm0ZGO5919vmty2dnM5g/kzlwq/D57VMft9eXXD++aZvvhv+fS+Z89vJ9eIrdZcvX0w5X Zwga/LbR+pPmKaikxFKckWioxVxUnAgAnhbweTgCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150318_055237_301190_450F8F8B X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: -5.0 (-----) Cc: linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Daniel Lezcano , Tomasz Figa , linux-kernel@vger.kernel.org, Kyungmin Park , linux-arm-kernel@lists.infradead.org, b.zolnierkie@samsung.com 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This code is needed for cpuidle (W-)AFTR mode support on Exynos3250. Cc: Daniel Lezcano Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Kyungmin Park --- arch/arm/mach-exynos/common.h | 6 ++++++ arch/arm/mach-exynos/exynos.c | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index f70eca7..87bf1f3 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -119,6 +119,12 @@ extern void __iomem *sysram_base_addr; extern void __iomem *pmu_base_addr; void exynos_sysram_init(void); +/* CPU BOOT mode flag */ +#define C2_STATE (1 << 3) + +void exynos_set_boot_flag(unsigned int cpu, unsigned int mode); +void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode); + enum { FW_DO_IDLE_SLEEP, FW_DO_IDLE_AFTR, diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 4031a96..90ed2e5 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -117,6 +117,31 @@ static void __init exynos_init_late(void) exynos_pm_init(); } +#define REG_CPU_STATE_ADDR (sysram_ns_base_addr + 0x28) +#define BOOT_MODE_MASK 0x1f + +void exynos_set_boot_flag(unsigned int cpu, unsigned int mode) +{ + unsigned int tmp; + + tmp = __raw_readl(REG_CPU_STATE_ADDR + cpu * 4); + + if (mode & BOOT_MODE_MASK) + tmp &= ~BOOT_MODE_MASK; + + tmp |= mode; + __raw_writel(tmp, REG_CPU_STATE_ADDR + cpu * 4); +} + +void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode) +{ + unsigned int tmp; + + tmp = __raw_readl(REG_CPU_STATE_ADDR + cpu * 4); + tmp &= ~mode; + __raw_writel(tmp, REG_CPU_STATE_ADDR + cpu * 4); +} + static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, int depth, void *data) {