From patchwork Wed Mar 18 13:09:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 6038971 Return-Path: X-Original-To: patchwork-linux-pm@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 70FFE9F399 for ; Wed, 18 Mar 2015 13:12:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87F9320503 for ; Wed, 18 Mar 2015 13:12:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FFEA20511 for ; Wed, 18 Mar 2015 13:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932813AbbCRNLa (ORCPT ); Wed, 18 Mar 2015 09:11:30 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:50421 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933028AbbCRNL0 (ORCPT ); Wed, 18 Mar 2015 09:11:26 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NLE00HHSSN1KKC0@mailout4.samsung.com>; Wed, 18 Mar 2015 22:11:25 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-a4-5509797d6d4e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 81.2D.20081.D7979055; Wed, 18 Mar 2015 22:11:25 +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 <0NLE009WHSKWBE50@mmp1.samsung.com>; Wed, 18 Mar 2015 22:11:25 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Kukjin Kim Cc: Kukjin Kim , Daniel Lezcano , Tomasz Figa , Colin Cross , Krzysztof Kozlowski , Kyungmin Park , Marek Szyprowski , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com, Russell King Subject: [PATCH v2 4/5] ARM: EXYNOS: add exynos_get_boot_addr() helper Date: Wed, 18 Mar 2015 14:09:56 +0100 Message-id: <1426684197-22281-5-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1426684197-22281-1-git-send-email-b.zolnierkie@samsung.com> References: <1426684197-22281-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJLMWRmVeSWpSXmKPExsVy+t9jAd3aSs5Qg2/d0hYbZ6xntVgwo53Z Yt5nWYvXLwwtehdcZbPof/ya2eJs0xt2i8u75rBZfO49wmgx4/w+Jou1R+6yW2z+8JLNYtWu P4wOvB4tzT1sHjtn3WX3WLCp1GPTqk42jzvX9rB59G1ZxejxeZNcAHsUl01Kak5mWWqRvl0C V8a3LYeYC/5LVOyftp29gfGmSBcjJ4eEgInEv5uvmCFsMYkL99azdTFycQgJLGKUuLv3BBOE 08UksXTFBbAqNgEriYntqxhBbBEBNYmexVsZQYqYBU4ySxy6d4wFJCEs4Cax/Ww3mM0ioCox p6WDFcTmFfCQmD9lMyvEOkWJ7mcT2EBsTgFPiblL3gPVcwBt85DY1Mg4gZF3ASPDKkbR1ILk guKk9FxDveLE3OLSvHS95PzcTYzgAH0mtYNxZYPFIUYBDkYlHl6JqxyhQqyJZcWVuYcYJTiY lUR4ubM4Q4V4UxIrq1KL8uOLSnNSiw8xSnOwKInzKtm3hQgJpCeWpGanphakFsFkmTg4pRoY Ox3SVFKeufz/c9Ar3PiYJX8J16MahWPqs59xGrxrfuducOL16iWvFv5JntVzUvVAaqS78bKP BTd25hUXreMO2Cmw+dWRE1z73iatKsjYfSQ17/vb+OZzlyZNn+F46XF19623O/LX9ay12RXb Glcm6TG9n6N3Rnei1A3/1Bfeq3nZ9wl2xcqXK7EUZyQaajEXFScCAJVN7cFMAgAA Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Add get_cpu_boot_addr() firmware operation and then exynos_get_boot_addr() helper. This is a preparation for adding coupled cpuidle support for Exynos3250 SoC. There should be no functional changes caused by this patch. Cc: Daniel Lezcano Cc: Russell King Signed-off-by: Bartlomiej Zolnierkiewicz Reviewed-by: Krzysztof Kozlowski --- arch/arm/include/asm/firmware.h | 4 ++++ arch/arm/mach-exynos/firmware.c | 17 +++++++++++++++++ arch/arm/mach-exynos/platsmp.c | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h index 89aefe1..34c1d96 100644 --- a/arch/arm/include/asm/firmware.h +++ b/arch/arm/include/asm/firmware.h @@ -34,6 +34,10 @@ struct firmware_ops { */ int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr); /* + * Gets boot address of specified physical CPU + */ + int (*get_cpu_boot_addr)(int cpu, unsigned long *boot_addr); + /* * Boots specified physical CPU */ int (*cpu_boot)(int cpu); diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c index f236877..c9e4481 100644 --- a/arch/arm/mach-exynos/firmware.c +++ b/arch/arm/mach-exynos/firmware.c @@ -104,6 +104,22 @@ static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr) return 0; } +static int exynos_get_cpu_boot_addr(int cpu, unsigned long *boot_addr) +{ + void __iomem *boot_reg; + + if (!sysram_ns_base_addr) + return -ENODEV; + + boot_reg = sysram_ns_base_addr + 0x1c; + + if (soc_is_exynos4412()) + boot_reg += 4 * cpu; + + *boot_addr = __raw_readl(boot_reg); + return 0; +} + static int exynos_cpu_suspend(unsigned long arg) { flush_cache_all(); @@ -138,6 +154,7 @@ static int exynos_resume(void) static const struct firmware_ops exynos_firmware_ops = { .do_idle = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? exynos_do_idle : NULL, .set_cpu_boot_addr = exynos_set_cpu_boot_addr, + .get_cpu_boot_addr = exynos_get_cpu_boot_addr, .cpu_boot = exynos_cpu_boot, .suspend = IS_ENABLED(CONFIG_PM_SLEEP) ? exynos_suspend : NULL, .resume = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? exynos_resume : NULL, diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index b7cfcdc..449edd1 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -272,6 +272,31 @@ fail: return ret; } +static int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr) +{ + int ret; + + /* + * Try to get boot address using firmware first + * and fall back to boot register if it fails. + */ + ret = call_firmware_op(get_cpu_boot_addr, core_id, boot_addr); + if (ret && ret != -ENOSYS) + goto fail; + if (ret == -ENOSYS) { + void __iomem *boot_reg = cpu_boot_reg(core_id); + + if (IS_ERR(boot_reg)) { + ret = PTR_ERR(boot_reg); + goto fail; + } + *boot_addr = __raw_readl(boot_reg); + ret = 0; + } +fail: + return ret; +} + static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) { unsigned long timeout;