From patchwork Thu Jul 17 17:11:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 4577591 Return-Path: X-Original-To: patchwork-linux-arm@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 A6BDAC0514 for ; Thu, 17 Jul 2014 17:13:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDB0720120 for ; Thu, 17 Jul 2014 17:13:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E6F082017D for ; Thu, 17 Jul 2014 17:13:51 +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 1X7pCs-0006sl-C3; Thu, 17 Jul 2014 17:10:58 +0000 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X7pCp-0006mk-Ip for linux-arm-kernel@lists.infradead.org; Thu, 17 Jul 2014 17:10:56 +0000 Received: by mail-wi0-f182.google.com with SMTP id d1so3178658wiv.9 for ; Thu, 17 Jul 2014 10:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qNW3GmIp/Qk/KXUEhatAVfvgSD9vZRo9PzNAql0c+Ec=; b=QiSyEveRlUgiAFB4tWZ/csodH7FMpk3RPCDPDn0ypKdR+i2Xl7Q2VwiI2KxyYiGAMo lygmJToE2J7qFalmgT+TzSZb2Xg3ur0d+sj9XIchJQXasWl0qHETQ/boKzFmtusF8arB 05Mtv81kTlcC7tQjNdRDzLNF4Sw9WmJemkc52iJuJWvLtJwSWYfgREC+0M5AmmS/u5Ma +0WgkUm0OnoQQ6uNMplv5e9zDkTlgBoVpse1omECynKKG2Xl00sYUwgEieWr5GqGJDyJ /9VGHC4PHT7H81uFHZo+pNbBK6MNYXcVpgH68rNqMK5FzN6O4PGxJQ0mTGiVu0Rqvo68 ZHiQ== X-Received: by 10.194.91.228 with SMTP id ch4mr47034024wjb.59.1405617030525; Thu, 17 Jul 2014 10:10:30 -0700 (PDT) Received: from localhost.localdomain (AToulouse-554-1-142-44.w90-60.abo.wanadoo.fr. [90.60.237.44]) by mx.google.com with ESMTPSA id bg2sm15222553wib.21.2014.07.17.10.10.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jul 2014 10:10:29 -0700 (PDT) From: Romain Perier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: rockchip: Add cpu hotplug support for RK3XXX SoCs Date: Thu, 17 Jul 2014 17:11:50 +0000 Message-Id: <1405617110-1136-1-git-send-email-romain.perier@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140717_101055_792714_E7E4202B X-CRM114-Status: GOOD ( 13.02 ) X-Spam-Score: -0.8 (/) Cc: heiko@sntech.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no 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 Adds ability to shutdown all CPUs except the first one (since it might be special for a lot of platforms). It is now possible to use kexec which requires such a feature. Signed-off-by: Romain Perier --- arch/arm/mach-rockchip/platsmp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c index 910835d..7c1299a 100644 --- a/arch/arm/mach-rockchip/platsmp.c +++ b/arch/arm/mach-rockchip/platsmp.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -178,8 +179,38 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) pmu_set_power_domain(0 + i, false); } +#ifdef CONFIG_HOTPLUG_CPU +static DECLARE_COMPLETION(cpu_died); + +static int rockchip_cpu_kill(unsigned int cpu) +{ + if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(1000))) { + pr_err("CPU%d: didn't die correctly\n", cpu); + return 0; + } + pmu_set_power_domain(0 + cpu, false); + return 1; +} + + +static void rockchip_cpu_die(unsigned int cpu) +{ + complete(&cpu_died); + flush_cache_louis(); + + v7_exit_coherency_flush(louis); + + while(1) + cpu_do_idle(); +} +#endif + static struct smp_operations rockchip_smp_ops __initdata = { .smp_prepare_cpus = rockchip_smp_prepare_cpus, .smp_boot_secondary = rockchip_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_kill = rockchip_cpu_kill, + .cpu_die = rockchip_cpu_die, +#endif }; CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops);