From patchwork Fri Jan 30 12:52:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 5749901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E6208BF440 for ; Fri, 30 Jan 2015 12:56:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21E4A20279 for ; Fri, 30 Jan 2015 12:56:26 +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 4E1B320270 for ; Fri, 30 Jan 2015 12:56:25 +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 1YHB5S-0004It-Gn; Fri, 30 Jan 2015 12:54:14 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YHB4p-0003tM-Fq for linux-arm-kernel@lists.infradead.org; Fri, 30 Jan 2015 12:53:36 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NIZ00199QGO9I60@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 30 Jan 2015 21:53:12 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-db-54cb7eb89ad9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 84.0E.09430.8BE7BC45; Fri, 30 Jan 2015 21:53:12 +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 <0NIZ00BH7QG75PC0@mmp2.samsung.com>; Fri, 30 Jan 2015 21:53:12 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Kukjin Kim , Kukjin Kim Subject: [PATCH v2 2/4] ARM: EXYNOS: add code for setting/clearing boot flag Date: Fri, 30 Jan 2015 13:52:50 +0100 Message-id: <1422622373-24769-3-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1422622373-24769-1-git-send-email-b.zolnierkie@samsung.com> References: <1422622373-24769-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCLMWRmVeSWpSXmKPExsVy+t9jQd0ddadDDJ5d1LbYOGM9q8W8z7IW vQuusln0P37NbHG26Q27xabH11gtLu+aw2bxufcIo8WM8/uYLFbt+sPowOWxc9Zddo9NqzrZ PO5c28PmsXlJvUffllWMHp83yQWwRXHZpKTmZJalFunbJXBltPSnFCzhr1j45TJ7A+MLni5G Dg4JAROJxoMpXYycQKaYxIV769m6GLk4hASmM0oc+3CbFcLpYpL4NO0jM0gVm4CVxMT2VYwg toiAq8ScK5MYQYqYBRYyScx6+4QdJCEs4CMxZ9UVFpANLAKqEvsf+YCEeQU8JHoer2GH2KYo 0f1sAhuIzSngKfFp301WEFsIqOb0oqfsExh5FzAyrGIUTS1ILihOSs810itOzC0uzUvXS87P 3cQIDrtn0jsYVzVYHGIU4GBU4uH1eHwqRIg1say4MvcQowQHs5II76+S0yFCvCmJlVWpRfnx RaU5qcWHGKU5WJTEeZXs20KEBNITS1KzU1MLUotgskwcnFINjJM82vkPXMw8c7ibczXTh3Pn 28Rf5q+WYferXpF0u8rkTvnSxSGJ6u77gzhsZ7vYVBRLbo6eYLpyvk1beOb13OfKi499/Kt3 WFg059QJp6nWxedPTPsuackkmyT5an+25WmVl9ei/izevsnLzdlIJHfXk/1Xrq7XlduVuTTg ZQzLxu679luFbZVYijMSDbWYi4oTAZHECMs3AgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150130_045335_756964_53EBE571 X-CRM114-Status: GOOD ( 10.29 ) 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 2013f73..c599a0f 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) {