From patchwork Tue Feb 28 21:46:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 6982 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9500B23E4A for ; Tue, 28 Feb 2012 21:46:22 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 50236A18031 for ; Tue, 28 Feb 2012 21:46:22 +0000 (UTC) Received: by gglu1 with SMTP id u1so1497562ggl.11 for ; Tue, 28 Feb 2012 13:46:21 -0800 (PST) Received: from mr.google.com ([10.50.207.72]) by 10.50.207.72 with SMTP id lu8mr24455639igc.0.1330465581742 (num_hops = 1); Tue, 28 Feb 2012 13:46:21 -0800 (PST) Received: by 10.50.207.72 with SMTP id lu8mr19805253igc.0.1330465581691; Tue, 28 Feb 2012 13:46:21 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.11.10 with SMTP id r10csp17718ibr; Tue, 28 Feb 2012 13:46:21 -0800 (PST) Received: by 10.180.92.73 with SMTP id ck9mr34042324wib.2.1330465580520; Tue, 28 Feb 2012 13:46:20 -0800 (PST) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id s57si15260640weq.147.2012.02.28.13.46.20 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 13:46:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of mail-we0-f178.google.com designates 74.125.82.178 as permitted sender) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of mail-we0-f178.google.com designates 74.125.82.178 as permitted sender) smtp.mail= Received: by mail-we0-f178.google.com with SMTP id a13so1444547wer.37 for ; Tue, 28 Feb 2012 13:46:20 -0800 (PST) Received-SPF: pass (google.com: domain of designates 10.180.24.4 as permitted sender) client-ip=10.180.24.4; Received: from mr.google.com ([10.180.24.4]) by 10.180.24.4 with SMTP id q4mr11502286wif.7.1330465580140 (num_hops = 1); Tue, 28 Feb 2012 13:46:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.24.4 with SMTP id q4mr9145331wif.7.1330465580009; Tue, 28 Feb 2012 13:46:20 -0800 (PST) Received: from localhost.localdomain (AToulouse-159-1-63-219.w92-134.abo.wanadoo.fr. [92.134.214.219]) by mx.google.com with ESMTPS id dw7sm31483074wib.4.2012.02.28.13.46.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 13:46:19 -0800 (PST) From: daniel.lezcano@linaro.org To: sameo@linux.intel.com Cc: linus.walleij@stericsson.com, linux-arm-kernel@lists.infradead.org, rickard.andersson@stericsson.com, patches@linaro.org, linaro-dev@lists.linaro.org Subject: [PATCH 5/5] mfd : ux500 - check if the other core is in WFI Date: Tue, 28 Feb 2012 22:46:09 +0100 Message-Id: <1330465569-567-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1330465569-567-1-git-send-email-daniel.lezcano@linaro.org> References: <1330465569-567-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQkqr7H2dyNBhtKwE57Mw4+HYShHjomFG141hzDJ+uHQGc98W/AnjFGeOW6XHKmU4HOQCwXs From: Daniel Lezcano This patch allows to check if the other core is in WFI mode. It is the last check the idle routine has to do before entering into the retention state. Signed-off-by: Daniel Lezcano --- drivers/mfd/db8500-prcmu.c | 12 ++++++++++++ drivers/mfd/dbx500-prcmu-regs.h | 2 ++ include/linux/mfd/db8500-prcmu.h | 1 + include/linux/mfd/dbx500-prcmu.h | 8 ++++++++ 4 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 4e27db8..a1b3464 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -904,6 +904,18 @@ bool db8500_prcmu_pending_irq(void) } /* + * This function checks if the specified cpu is in in WFI. It's usage + * makes sense only if the gic is decoupled with the db8500_prcmu_gic_decouple + * function. Of course passing smp_processor_id() to this function will + * always return false... + */ +bool db8500_prcmu_is_cpu_in_wfi(int cpu) +{ + return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : + PRCM_ARM_WFI_STANDBY_WFI0; +} + +/* * This function copies the gic SPI settings to the prcmu in order to * monitor them and abort/finish the retention/off sequence or state. */ diff --git a/drivers/mfd/dbx500-prcmu-regs.h b/drivers/mfd/dbx500-prcmu-regs.h index b9ab4ce..3a0bf91 100644 --- a/drivers/mfd/dbx500-prcmu-regs.h +++ b/drivers/mfd/dbx500-prcmu-regs.h @@ -79,6 +79,8 @@ /* ARM WFI Standby signal register */ #define PRCM_ARM_WFI_STANDBY (_PRCMU_BASE + 0x130) +#define PRCM_ARM_WFI_STANDBY_WFI0 0x08 +#define PRCM_ARM_WFI_STANDBY_WFI1 0x10 #define PRCM_IOCR (_PRCMU_BASE + 0x310) #define PRCM_IOCR_IOFORCE 0x1 diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h index 926bdb3..048a534 100644 --- a/include/linux/mfd/db8500-prcmu.h +++ b/include/linux/mfd/db8500-prcmu.h @@ -585,6 +585,7 @@ int db8500_prcmu_gic_recouple(void); int db8500_prcmu_copy_gic_settings(void); bool db8500_prcmu_gic_pending_irq(void); bool db8500_prcmu_pending_irq(void); +bool db8500_prcmu_is_cpu_in_wfi(int cpu); void db8500_prcmu_enable_wakeups(u32 wakeups); int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); int db8500_prcmu_request_clock(u8 clock, bool enable); diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h index 5c72c07..eaa99a0 100644 --- a/include/linux/mfd/dbx500-prcmu.h +++ b/include/linux/mfd/dbx500-prcmu.h @@ -305,6 +305,14 @@ static inline bool prcmu_gic_pending_irq(void) return db8500_prcmu_gic_pending_irq(); } +static inline bool prcmu_is_cpu_in_wfi(int cpu) +{ + if (cpu_is_u5500()) + return -EINVAL; + else + return db8500_prcmu_is_cpu_in_wfi(cpu); +} + static inline int prcmu_copy_gic_settings(void) { if (cpu_is_u5500())