From patchwork Mon Sep 29 05:05:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khiem Nguyen X-Patchwork-Id: 4993421 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5FB0ABEEA6 for ; Mon, 29 Sep 2014 05:05:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 818E420256 for ; Mon, 29 Sep 2014 05:05:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F67D20254 for ; Mon, 29 Sep 2014 05:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbaI2FF5 (ORCPT ); Mon, 29 Sep 2014 01:05:57 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:26932 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750844AbaI2FF4 (ORCPT ); Mon, 29 Sep 2014 01:05:56 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 29 Sep 2014 14:05:56 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 20C383C1A9; Mon, 29 Sep 2014 14:05:56 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 21DB0180A1; Mon, 29 Sep 2014 14:05:56 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 1C73A180A0; Mon, 29 Sep 2014 14:05:56 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id QAG23368; Mon, 29 Sep 2014 14:05:56 +0900 X-IronPort-AV: E=Sophos;i="5.04,617,1406559600"; d="scan'208";a="170120893" Received: from hqdg0130.wireless.renesas.com (HELO [10.161.20.130]) ([10.161.20.130]) by relmlii1.idc.renesas.com with ESMTP; 29 Sep 2014 14:05:55 +0900 Message-ID: <5428E8B3.3090609@renesas.com> Date: Mon, 29 Sep 2014 14:05:55 +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 , Linux-sh list , rjw@rjwysocki.net, Russell King CC: khiem.nguyen.xt@renesas.com, KEITA KOBAYASHI , Geert Uytterhoeven , sergei.shtylyov@cogentembedded.com Subject: [PATCH RFC v2 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.5 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 5e4dcdb..ef146fa 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; @@ -244,6 +245,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 */