From patchwork Thu Jun 5 05:15:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 4303121 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 1014DBEEA7 for ; Thu, 5 Jun 2014 05:14:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E52620179 for ; Thu, 5 Jun 2014 05:14:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A28C20251 for ; Thu, 5 Jun 2014 05:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753428AbaFEFOL (ORCPT ); Thu, 5 Jun 2014 01:14:11 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:65258 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754820AbaFEFNZ (ORCPT ); Thu, 5 Jun 2014 01:13:25 -0400 Received: by mail-pd0-f177.google.com with SMTP id g10so545660pdj.22 for ; Wed, 04 Jun 2014 22:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=cwq8xVt++HqGXCroT+22QHm0ZekuFYrqE5TgCdIoxtE=; b=rkEIYQhBU39iAz1zkXAdyMgRr1y0b4DTMnAUFDoNMIpHAx1dYF/obsukbnFl0aIwzg AlE7mCRuxS5Pbf6q64qNn5hvcEhcXLmnE6xKOoy/R1j6pj/ILxZJQxoBOuL+TScRClyX 9N96LLhwusY+lDsXn6gOW7kaLw7mZc2kzM2EnOKAG6n5WjX11x/sQYb61/la6Kj4eQ2b T2PaXoKLVyEd10GkQJ6Zgtt+cnrJ5pFHnlSZvTmCSJ9a8CP0pOflLkwmxJiDHENvz695 BMEx5vKm/Mp/uBCHLsrd9p3JCkPvdhTy3crGZ3IVWM3VwBwTKP6U/wqEbwJGamg9DndI 63Gg== X-Received: by 10.68.163.100 with SMTP id yh4mr71946502pbb.122.1401945204607; Wed, 04 Jun 2014 22:13:24 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id vf9sm17601237pbc.94.2014.06.04.22.13.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jun 2014 22:13:23 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , horms@verge.net.au, keita.kobayashi.ym@renesas.com Date: Thu, 05 Jun 2014 14:15:28 +0900 Message-Id: <20140605051528.18075.47881.sendpatchset@w520> In-Reply-To: <20140605051505.18075.76727.sendpatchset@w520> References: <20140605051505.18075.76727.sendpatchset@w520> Subject: [PATCH 03/08] ARM: shmobile: Move r8a7790 reset code to pm-r8a7790.c 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.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Magnus Damm Move r8a7790 specific reset vector setup code from the SMP glue code to PM code. This makes the code one step closer to allow PM operations such as Suspend-to-RAM in the case when SMP is disabled in the kernel config. Signed-off-by: Magnus Damm --- arch/arm/mach-shmobile/pm-r8a7790.c | 40 ++++++++++++++++++++++++++++++++-- arch/arm/mach-shmobile/smp-r8a7790.c | 30 ------------------------- 2 files changed, 38 insertions(+), 32 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/arm/mach-shmobile/pm-r8a7790.c +++ work/arch/arm/mach-shmobile/pm-r8a7790.c 2014-06-05 11:25:46.000000000 +0900 @@ -11,10 +11,22 @@ */ #include +#include #include +#include #include #include +/* RST */ +#define RST 0xe6160000 +#define CA15BAR 0x0020 +#define CA7BAR 0x0030 +#define CA15RESCNT 0x0040 +#define CA7RESCNT 0x0044 + +/* On-chip RAM */ +#define MERAM 0xe8080000 + /* SYSC */ #define SYSCIER 0x0c #define SYSCIMR 0x10 @@ -38,8 +50,32 @@ static inline void r8a7790_sysc_init(voi void __init r8a7790_pm_init(void) { + void __iomem *p; + u32 bar; static int once; - if (!once++) - r8a7790_sysc_init(); + if (once++) + return; + + /* MERAM for jump stub, because BAR requires 256KB aligned address */ + p = ioremap_nocache(MERAM, shmobile_boot_size); + memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); + iounmap(p); + + /* setup reset vectors */ + p = ioremap_nocache(RST, 0x63); + bar = (MERAM >> 8) & 0xfffffc00; + writel_relaxed(bar, p + CA15BAR); + writel_relaxed(bar, p + CA7BAR); + writel_relaxed(bar | 0x10, p + CA15BAR); + writel_relaxed(bar | 0x10, p + CA7BAR); + + /* de-assert reset for all CPUs */ + writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000, + p + CA15RESCNT); + writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000, + p + CA7RESCNT); + iounmap(p); + + r8a7790_sysc_init(); } --- 0001/arch/arm/mach-shmobile/smp-r8a7790.c +++ work/arch/arm/mach-shmobile/smp-r8a7790.c 2014-06-05 11:25:46.000000000 +0900 @@ -22,13 +22,6 @@ #include #include -#define RST 0xe6160000 -#define CA15BAR 0x0020 -#define CA7BAR 0x0030 -#define CA15RESCNT 0x0040 -#define CA7RESCNT 0x0044 -#define MERAM 0xe8080000 - static struct rcar_sysc_ch r8a7790_ca15_scu = { .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */ .isr_bit = 12, /* CA15-SCU */ @@ -41,32 +34,9 @@ static struct rcar_sysc_ch r8a7790_ca7_s static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) { - void __iomem *p; - u32 bar; - /* let APMU code install data related to shmobile_boot_vector */ shmobile_smp_apmu_prepare_cpus(max_cpus); - /* MERAM for jump stub, because BAR requires 256KB aligned address */ - p = ioremap_nocache(MERAM, shmobile_boot_size); - memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); - iounmap(p); - - /* setup reset vectors */ - p = ioremap_nocache(RST, 0x63); - bar = (MERAM >> 8) & 0xfffffc00; - writel_relaxed(bar, p + CA15BAR); - writel_relaxed(bar, p + CA7BAR); - writel_relaxed(bar | 0x10, p + CA15BAR); - writel_relaxed(bar | 0x10, p + CA7BAR); - - /* enable clocks to all CPUs */ - writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000, - p + CA15RESCNT); - writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000, - p + CA7RESCNT); - iounmap(p); - /* turn on power to SCU */ r8a7790_pm_init(); shmobile_smp_apmu_suspend_init();