From patchwork Thu Nov 20 15:11:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 5348821 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 3803F9F1E1 for ; Thu, 20 Nov 2014 15:15:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5EDFB2018E for ; Thu, 20 Nov 2014 15:15:02 +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 9634A201BC for ; Thu, 20 Nov 2014 15:15:01 +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 1XrTPo-0008QA-Ub; Thu, 20 Nov 2014 15:13:00 +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 1XrTPb-0008CX-6L for linux-arm-kernel@lists.infradead.org; Thu, 20 Nov 2014 15:12:48 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFC007AJFKO1410@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 21 Nov 2014 00:12:24 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-20-546e04d80ad7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AF.EF.09430.8D40E645; Fri, 21 Nov 2014 00:12:24 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NFC00KRDFJRJY00@mmp2.samsung.com>; Fri, 21 Nov 2014 00:12:24 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Kukjin Kim , Kukjin Kim Subject: [PATCH 2/4] ARM: EXYNOS: add code for setting/clearing boot flag Date: Thu, 20 Nov 2014 16:11:47 +0100 Message-id: <1416496309-27602-3-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1416496309-27602-1-git-send-email-b.zolnierkie@samsung.com> References: <1416496309-27602-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKLMWRmVeSWpSXmKPExsVy+t9jQd0bLHkhBrcfSllsnLGe1WLeZ1mL 3gVX2Sz6H79mtjjb9IbdYtPja6wWl3fNYbP43HuE0WLG+X1MFqt2/WF04PLYOesuu8emVZ1s Hneu7WHz2Lyk3qNvyypGj8+b5ALYorhsUlJzMstSi/TtErgyZn2fyVKwhL/i/fJ/7A2ML3i6 GDk5JARMJBY+WMsIYYtJXLi3nq2LkYtDSGA6o8SqpRdZIJwuJok9V/4xgVSxCVhJTGxfBdYh IuAqMefKJEaQImaBhUwSs94+Ye9i5OAQFvCUWNSqAFLDIqAq8X/6fLBeXgEPiUXz/7NAbFOU 6H42gQ2knBOo/PamHJCwEFDJ86YljBMYeRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93E CA68Z9I7GFc1WBxiFOBgVOLhTbDIDRFiTSwrrsw9xCjBwawkwrvwPVCINyWxsiq1KD++qDQn tfgQozQHi5I4742bQCmB9MSS1OzU1ILUIpgsEwenVAPj5Mk9bT6RqY9PrD3t5uA/PVhcYM6z fu/mhvIJPZ+uaClcuVn/0SLkYLTTjGiBGbcuXT5VLnjxlnyAs5fS00nudht3uDi9uXe1Tzyw WmFJavJvlaQN9Se/ZTHcm8jOaXkoMXXjltYdx3/VvRbVO7bq/tSkPXtmh4Y8eOXjrufKL5+9 ef4idW87JZbijERDLeai4kQA8lfkuzgCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141120_071247_431565_EC127030 X-CRM114-Status: GOOD ( 10.92 ) 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 431be1b..155f019 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 8f638ad..847cd0a 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -148,6 +148,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) {