From patchwork Sun Jun 12 21:04:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 9171637 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 DE0CF60573 for ; Sun, 12 Jun 2016 21:06:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D19C820855 for ; Sun, 12 Jun 2016 21:06:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C639621C9A; Sun, 12 Jun 2016 21:06:44 +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=unavailable 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 4817620855 for ; Sun, 12 Jun 2016 21:06:44 +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 1bCCZB-0006eQ-Ik; Sun, 12 Jun 2016 21:05:09 +0000 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bCCZ8-0005RX-Sp for linux-arm-kernel@lists.infradead.org; Sun, 12 Jun 2016 21:05:07 +0000 Received: by mail-lf0-x235.google.com with SMTP id u74so73953232lff.2 for ; Sun, 12 Jun 2016 14:04:46 -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=PGcmvF0Us5GIuDqiur2+ROW273rlQ7RVYF5xiKbqVrb5XLfseYcnl+aTAPvWHIunmi yE9ErCi9KUvU5Eb8fZs+9tBohvhLfv2eqtKpqHtdN1AYCFpsNWIQLQpkgk7Guwd6Er4j F8MtPXdAMgx9KCHoEnA6ffItLAUTtNgZ9rPrG1V9LnBtCPGJA0XrPVgFK6vWjuu4GPn4 FyauKcuVUa0vlv4k6yUb+AM9OTgpI6G1lTOBbP/vAYqxljYoKKgY05RdYtXPTLburtX6 FCjI9/NiM2t+MoTWVUiyQoQ8pzS4MIDrwU5gfppL71ECSwMVtZ88Sep+U2G28BBNrfzt 7VRg== 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=WdxrJN6ELp2l1xYEKFmpENal786x+e4o3E8KJqg9VmvFjjB17SQdh/GMo69AVvQ/r3 2kAvwDsA7kIkWxZKJ0/IM337XrT0vdJvMfW6eRB4FYpY4QlKhdTmvZNwja5LOO/E/PMt rHQgPiy5ZQ4OYmZhlP+qyYlPPZimdKdU4wXg3soe9ukXDUMlhpLvvRbj/cwx2oaOUWH0 pk9IjWvU5GItNN5Z93AwooGI8Th6FBMWv1lYmPNFJxKG+IwkQ58IxMd6NRvJSUTgJHuT eIMUL6CO0ECKaj+GlattfUz8QCV4UifEEN8JuzcGqzUcM+M7TvkGeFHqdbS3IZrGaV+p CylQ== X-Gm-Message-State: ALyK8tIBUihdhFiEDxOv5ozjZ59yIW7D4fD6e/eawRn/ftbufLOBpFmWEMSGUfo6KQW/Og== X-Received: by 10.25.143.148 with SMTP id r142mr1281419lfd.223.1465765484969; Sun, 12 Jun 2016 14:04:44 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.81.235]) by smtp.gmail.com with ESMTPSA id n72sm2416044lfi.39.2016.06.12.14.04.44 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 12 Jun 2016 14:04:44 -0700 (PDT) From: Sergei Shtylyov To: horms@verge.net.au, linux-renesas-soc@vger.kernel.org Subject: [PATCH v5 05/12] ARM: shmobile: r8a7792: add SMP support Date: Mon, 13 Jun 2016 00:04:43 +0300 Message-ID: <8892035.WlgqvXCvaR@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.10 (Linux/4.4.12-200.fc22.x86_64; KDE/4.14.17; x86_64; ; ) In-Reply-To: <14666252.G84Ipxe6EL@wasted.cogentembedded.com> References: <14666252.G84Ipxe6EL@wasted.cogentembedded.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160612_140507_306524_3BD21926 X-CRM114-Status: GOOD ( 15.37 ) 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, magnus.damm@gmail.com, 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 +};