From patchwork Wed Jun 8 21:15:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 9165749 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 5C1B060572 for ; Wed, 8 Jun 2016 21:17:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B60D27248 for ; Wed, 8 Jun 2016 21:17:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E59028294; Wed, 8 Jun 2016 21:17:29 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B45A127248 for ; Wed, 8 Jun 2016 21:17:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAkpG-0004AY-A0; Wed, 08 Jun 2016 21:15:46 +0000 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAkpC-00042n-NZ for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2016 21:15:43 +0000 Received: by mail-lf0-x230.google.com with SMTP id s186so13998211lfs.1 for ; Wed, 08 Jun 2016 14:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=7589wG7HL+X8yXR8luS3wuqIYkBf4146jpnPuEjSoQs=; b=Qmn1Zmn6Jh9PMry1KHbkIE4ILh2o2EdS5/Wq7r4nTyJ6gPfQ91R2m8XS+jNLpmwvEU u5N7WY82ijBRVSlatAVo6rgVmTEbDlebkzcx5oJ6UhGDUNGYFzIKJEyWwb3w6GzAdeDu kSJcR/kD6d/0M7LihlCNTgHHwKZTFknJAZ43A8DPNAl02Z1+PcJti9H72Q1U8X4WPbRU ybH8Dcgk3sZk5Vd5PnUbEWSJli62EEKCcKTSXdlFg1VwWH9UV/XQnVYM39DrWc1GiDci w0UQXg8dWOf37yuIPY79j0FSGY/RS0ymXHxQHvAtYyj+MS76W/CfCgXtbMRpKEInY3JM nK+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=7589wG7HL+X8yXR8luS3wuqIYkBf4146jpnPuEjSoQs=; b=i/s21ef+ZnDLzni8Olytr0SxpY9H33/STPf/GdieLd7vnf6nZYnus1xz+x5L+bA8hm 7JLlnSaypG+gcgSWFKDq8qd1mBnyDLRr/+NoedXUOwEVS4a7kqykmLfTwKTNZkU8H8xX FWZsHg5QPUaQJhBZdKRiRUj1bWLn063LwRCgKxFqGUwwDIqjnwdLqEKPaB0W5RkxlItx VN3ZkE/cG/qnR5Vmzu/lcKIU5svPbjUXywXSTnaSqufuh3zVacIdMRl3Cw1Tp0URRNCu DWdKSd6hOZLY7ein9IOM6U1RIELlMtQQb5kxzsPsF1NV7sHIhgmuxgCWK5C9tjpp+pwe zmZA== X-Gm-Message-State: ALyK8tITJ1gLv0vUg/sZNSOJpONDssOF01bjGnm6LURW4yDaMfztgxWX3pdqPesfz80xpA== X-Received: by 10.25.134.194 with SMTP id i185mr4183962lfd.116.1465420520539; Wed, 08 Jun 2016 14:15:20 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.85.233]) by smtp.gmail.com with ESMTPSA id 17sm328655lja.35.2016.06.08.14.15.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2016 14:15:19 -0700 (PDT) From: Sergei Shtylyov To: horms@verge.net.au, linux-renesas-soc@vger.kernel.org, magnus.damm@gmail.com Subject: [PATCH v3 05/12] ARM: shmobile: r8a7792: add SMP support Date: Thu, 09 Jun 2016 00:15:17 +0300 Message-ID: <7848375.HIECFST0Ua@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.10 (Linux/4.4.11-200.fc22.x86_64; KDE/4.14.17; x86_64; ; ) In-Reply-To: <12536856.AsKMEpuejQ@wasted.cogentembedded.com> References: <12536856.AsKMEpuejQ@wasted.cogentembedded.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_141543_122893_4C1FF704 X-CRM114-Status: GOOD ( 16.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org 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 Add R8A7792 SMP support using the shared APMU code. This SoC has 2 ARM Cortex-A15 CPU cores. Signed-off-by: Sergei Shtylyov --- Changes in version 3: - new patch. arch/arm/mach-shmobile/Makefile | 1 arch/arm/mach-shmobile/r8a7792.h | 6 +++ arch/arm/mach-shmobile/setup-r8a7792.c | 2 + arch/arm/mach-shmobile/smp-r8a7792.c | 62 +++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) Index: renesas/arch/arm/mach-shmobile/Makefile =================================================================== --- renesas.orig/arch/arm/mach-shmobile/Makefile +++ renesas/arch/arm/mach-shmobile/Makefile @@ -35,6 +35,7 @@ smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0. smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o +smp-$(CONFIG_ARCH_R8A7792) += smp-r8a7792.o smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o # PM objects Index: renesas/arch/arm/mach-shmobile/r8a7792.h =================================================================== --- /dev/null +++ renesas/arch/arm/mach-shmobile/r8a7792.h @@ -0,0 +1,6 @@ +#ifndef __ASM_R8A7792_H__ +#define __ASM_R8A7792_H__ + +extern const struct smp_operations r8a7792_smp_ops; + +#endif /* __ASM_R8A7792_H__ */ Index: renesas/arch/arm/mach-shmobile/setup-r8a7792.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7792.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7792.c @@ -20,6 +20,7 @@ #include "common.h" #include "rcar-gen2.h" +#include "r8a7792.h" static const char * const r8a7792_boards_compat_dt[] __initconst = { "renesas,r8a7792", @@ -27,6 +28,7 @@ static const char * const r8a7792_boards }; DT_MACHINE_START(R8A7792_DT, "Generic R8A7792 (Flattened Device Tree)") + .smp = smp_ops(r8a7792_smp_ops), .init_early = shmobile_init_delay, .init_late = shmobile_init_late, .init_time = rcar_gen2_timer_init, Index: renesas/arch/arm/mach-shmobile/smp-r8a7792.c =================================================================== --- /dev/null +++ renesas/arch/arm/mach-shmobile/smp-r8a7792.c @@ -0,0 +1,62 @@ +/* + * SMP support for r8a7792 + * + * Copyright (C) 2014 Renesas Electronics Corporation + * Copyright (C) 2016 Cogent Embedded, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include + +#include + +#include "common.h" +#include "platsmp-apmu.h" +#include "rcar-gen2.h" +#include "r8a7792.h" + +static struct rcar_sysc_ch r8a7792_ca15_scu = { + .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */ + .isr_bit = 12, /* CA15-SCU */ +}; + +static struct rcar_apmu_config r8a7792_apmu_config[] = { + { + .iomem = DEFINE_RES_MEM(0xe6152000, 0x188), + .cpus = { 0, 1 }, + }, +}; + +static void __init r8a7792_smp_prepare_cpus(unsigned int max_cpus) +{ + /* let APMU code install data related to shmobile_boot_vector */ + shmobile_smp_apmu_prepare_cpus(max_cpus, + r8a7792_apmu_config, + ARRAY_SIZE(r8a7792_apmu_config)); + + /* turn on power to SCU */ + rcar_gen2_pm_init(); + rcar_sysc_power_up(&r8a7792_ca15_scu); +} + +const struct smp_operations r8a7792_smp_ops __initconst = { + .smp_prepare_cpus = r8a7792_smp_prepare_cpus, + .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_can_disable = shmobile_smp_cpu_can_disable, + .cpu_die = shmobile_smp_apmu_cpu_die, + .cpu_kill = shmobile_smp_apmu_cpu_kill, +#endif +};