From patchwork Fri Jan 26 16:08:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 10186523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F2F360383 for ; Fri, 26 Jan 2018 16:09:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3073528C7A for ; Fri, 26 Jan 2018 16:09:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24E7729E42; Fri, 26 Jan 2018 16:09:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BDD0E28C7A for ; Fri, 26 Jan 2018 16:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FUtKPscrwfiGAzj8Zmc37ifXkt0/r6AdJVkxH+I+ows=; b=QTq9PBR3xx9ZNwBlVAqOit4H4m Fk5lK/aytabnpdRZC5GqWJxCRsrOySwNGvSvNPghzqhIT4jSH1fW6ykNTbtZI/baud55QbDBL7VF+ l5stfHjdjWQa8Oy3ImY8th2WQMJHtH7hCYeli2QZmXEOLKPoZK9Bqb0kuzGn5MBODcM19rkAn8Gix kHoO1WjayeFqWVc43wvDhrUZ3etwF/QwQm0YBu8F6qzDkgUEMUm8DEbis/u996bZ188If+M7t4NIg SvEO5ruetJLT/g2gx0jvMkC0+0bnKJu21dfp0Ybyn4Qk58gCzKlwCSD6klIeVs0y4BWzpdy96QW5z NQaBpKoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ef6Zb-0001ta-4j; Fri, 26 Jan 2018 16:09:51 +0000 Received: from relmlor4.renesas.com ([210.160.252.174] helo=relmlie3.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ef6ZI-0001Rj-87 for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2018 16:09:34 +0000 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 27 Jan 2018 01:09:20 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id B008E3F51E; Sat, 27 Jan 2018 01:09:20 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,417,1511794800"; d="scan'208";a="270747064" Received: from unknown (HELO fabrizio-dev.ree.adwin.renesas.com) ([10.226.37.88]) by relmlii2.idc.renesas.com with ESMTP; 27 Jan 2018 01:09:15 +0900 From: Fabrizio Castro To: Geert Uytterhoeven Subject: [RFC v2 23/37] ARM: shmobile: rcar-gen2: Export shmobile_set_wdt_clock_status function Date: Fri, 26 Jan 2018 16:08:57 +0000 Message-Id: <1516982937-29245-2-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516982937-29245-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1516982937-29245-1-git-send-email-fabrizio.castro@bp.renesas.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrizio Castro , Mark Rutland , Chris Paterson , Magnus Damm , linux-watchdog@vger.kernel.org, Simon Horman , devicetree@vger.kernel.org, Catalin Marinas , Michael Turquette , Will Deacon , Russell King , linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Wim Van Sebroeck , Rob Herring , linux-arm-kernel@lists.infradead.org, Philipp Zabel , Biju Das , Stephen Boyd , Guenter Roeck , Ramesh Shanmugasundaram MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch exposes a function to set the value of variable "shmobile_wdt_clock_status" so that the watchdog driver may communicate critical information to the SMP bring up assembly routine. Also, the new code provided by this commit decides which version of the boot vector to install to ICRAM1, and that depends on the size of the memory region available for this purpose. Signed-off-by: Fabrizio Castro Signed-off-by: Ramesh Shanmugasundaram --- arch/arm/mach-shmobile/common.h | 6 ++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 + arch/arm/mach-shmobile/pm-rcar-gen2.c | 25 +++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h index a8fa4f7..88d3c1b 100644 --- a/arch/arm/mach-shmobile/common.h +++ b/arch/arm/mach-shmobile/common.h @@ -7,6 +7,12 @@ extern void shmobile_init_delay(void); extern void shmobile_boot_vector(void); extern unsigned long shmobile_boot_fn; extern unsigned long shmobile_boot_size; +#ifdef CONFIG_ARCH_RCAR_GEN2 +extern void shmobile_boot_vector_gen2(void); +extern unsigned long shmobile_boot_fn_gen2; +extern unsigned long shmobile_boot_size_gen2; +extern unsigned long shmobile_wdt_clock_status; +#endif /* CONFIG_ARCH_RCAR_GEN2 */ extern void shmobile_smp_boot(void); extern void shmobile_smp_sleep(void); extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn, diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index 4422b61..ba732ef 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c @@ -191,6 +191,7 @@ static void __init shmobile_smp_apmu_setup_boot(void) { /* install boot code shared by all CPUs */ shmobile_boot_fn = __pa_symbol(shmobile_smp_boot); + shmobile_boot_fn_gen2 = shmobile_boot_fn; } void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus, diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c index e5f215c..7158d05 100644 --- a/arch/arm/mach-shmobile/pm-rcar-gen2.c +++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c @@ -50,6 +50,18 @@ static inline u32 phys_to_sbar(phys_addr_t addr) #define SYSCIER 0x0c #define SYSCIMR 0x10 +static void __iomem *shmobile_boot_vector_gen2_start = NULL; +static unsigned long clock_status; + +void shmobile_set_wdt_clock_status(unsigned long value) +{ + if (!shmobile_boot_vector_gen2_start) + return; + memcpy_toio(shmobile_boot_vector_gen2_start + clock_status, + &value, sizeof(value)); +} +EXPORT_SYMBOL(shmobile_set_wdt_clock_status); + #if defined(CONFIG_SMP) static void __init rcar_gen2_sysc_init(u32 syscier) @@ -120,8 +132,17 @@ void __init rcar_gen2_pm_init(void) if (!p) return; - memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); - iounmap(p); + if (resource_size(&res) >= shmobile_boot_size_gen2) { + memcpy_toio(p, shmobile_boot_vector_gen2, + shmobile_boot_size_gen2); + shmobile_boot_vector_gen2_start = p; + clock_status = (&shmobile_wdt_clock_status - + (unsigned long *)shmobile_boot_vector_gen2) * + sizeof(shmobile_wdt_clock_status); + } else { + memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); + } + /* setup reset vectors */ p = ioremap_nocache(RST, 0x63);