From patchwork Fri Sep 26 02:40:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khiem Nguyen X-Patchwork-Id: 4978171 Return-Path: X-Original-To: patchwork-linux-sh@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 E5F839F3DF for ; Fri, 26 Sep 2014 02:40:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15B82202AE for ; Fri, 26 Sep 2014 02:40:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BC7720274 for ; Fri, 26 Sep 2014 02:40:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752515AbaIZCkY (ORCPT ); Thu, 25 Sep 2014 22:40:24 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:32107 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752386AbaIZCkX (ORCPT ); Thu, 25 Sep 2014 22:40:23 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 26 Sep 2014 11:40:22 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id B3B253D103; Fri, 26 Sep 2014 11:40:22 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 9F5E28002E; Fri, 26 Sep 2014 11:40:22 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 80EC78002D; Fri, 26 Sep 2014 11:40:22 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id MAC23163; Fri, 26 Sep 2014 11:40:22 +0900 X-IronPort-AV: E=Sophos;i="5.04,601,1406559600"; d="scan'208";a="169968231" Received: from hqdg0130.wireless.renesas.com (HELO [10.161.20.130]) ([10.161.20.130]) by relmlii1.idc.renesas.com with ESMTP; 26 Sep 2014 11:40:22 +0900 Message-ID: <5424D215.1020005@renesas.com> Date: Fri, 26 Sep 2014 11:40:21 +0900 From: Khiem Nguyen User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Magnus Damm , Simon Horman CC: khiem.nguyen.xt@renesas.com, Linux-sh list , KEITA KOBAYASHI Subject: [PATCH RFC 5/7] ARM: shmobile: Clear External Event Request in system resume Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 According to datasheet, this step is necessary when waking up from L2shutdown mode. Signed-off-by: Khiem Nguyen --- arch/arm/mach-shmobile/platsmp-apmu.c | 2 ++ arch/arm/mach-shmobile/pm-rcar.c | 22 ++++++++++++++++++++++ arch/arm/mach-shmobile/pm-rcar.h | 1 + 3 files changed, 25 insertions(+) diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index f883697..dfa8a18 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c @@ -26,6 +26,7 @@ #include #include #include "common.h" +#include "pm-rcar.h" static struct { void __iomem *iomem; @@ -243,6 +244,7 @@ static int shmobile_smp_apmu_enter_suspend(suspend_state_t state) cpu_leave_lowpower(); writel_relaxed(0x0, cpucmcr); + rcar_sysc_clear_event_status(); return 0; } diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c index 00022ee..9f4ec85 100644 --- a/arch/arm/mach-shmobile/pm-rcar.c +++ b/arch/arm/mach-shmobile/pm-rcar.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "pm-rcar.h" @@ -24,6 +25,10 @@ #define PWROFFCR_OFFS 0x04 #define PWRONCR_OFFS 0x0c #define PWRER_OFFS 0x14 +#define SYSCEERSR_OFFS 0x20 +#define SYSCEERSCR_OFFS 0x24 +#define SYSCEERSR2_OFFS 0x2C +#define SYSCEERSCR2_OFFS 0x30 #define SYSCSR_RETRIES 100 #define SYSCSR_DELAY_US 1 @@ -34,6 +39,23 @@ static void __iomem *rcar_sysc_base; static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */ +void rcar_sysc_clear_event_status(void) +{ + if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A15) { + /* Clear External event status regiser */ + iowrite32(0x111, rcar_sysc_base + SYSCEERSCR_OFFS); + + pr_debug("%s: External event status: 0x%08x\n", __func__, + ioread32(rcar_sysc_base + SYSCEERSR_OFFS)); + } else { + /* Clear External event status regiser */ + iowrite32(0x111, rcar_sysc_base + SYSCEERSCR2_OFFS); + + pr_debug("%s: External event status: 0x%08x\n", __func__, + ioread32(rcar_sysc_base + SYSCEERSR2_OFFS)); + } +} + static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch, int sr_bit, int reg_offs) { diff --git a/arch/arm/mach-shmobile/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h index ef3a1ef..1a349bf 100644 --- a/arch/arm/mach-shmobile/pm-rcar.h +++ b/arch/arm/mach-shmobile/pm-rcar.h @@ -11,5 +11,6 @@ int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch); int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch); bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch); void __iomem *rcar_sysc_init(phys_addr_t base); +void rcar_sysc_clear_event_status(void); #endif /* PM_RCAR_H */