From patchwork Mon Jun 10 19:55:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2698961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 6141FDF264 for ; Mon, 10 Jun 2013 19:57:52 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Um8D5-0008AJ-6Z; Mon, 10 Jun 2013 19:57:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Um8Cl-0002xw-P0; Mon, 10 Jun 2013 19:56:39 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Um8Cc-0002vn-IQ for linux-arm-kernel@lists.infradead.org; Mon, 10 Jun 2013 19:56:32 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5AJu4nV026129; Mon, 10 Jun 2013 14:56:04 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5AJu4YA001971; Mon, 10 Jun 2013 14:56:04 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Mon, 10 Jun 2013 14:56:04 -0500 Received: from ula0393909.am.dhcp.ti.com (ula0393909.am.dhcp.ti.com [158.218.103.117]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5AJtd6u017295; Mon, 10 Jun 2013 14:56:04 -0500 From: Santosh Shilimkar To: Subject: [PATCH 2/3] ARM: keystone: Enable SMP support on Keystone machines Date: Mon, 10 Jun 2013 15:55:22 -0400 Message-ID: <1370894123-26846-3-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1370894123-26846-1-git-send-email-santosh.shilimkar@ti.com> References: <1370894123-26846-1-git-send-email-santosh.shilimkar@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130610_155630_746492_4CC307B7 X-CRM114-Status: GOOD ( 17.23 ) X-Spam-Score: -7.0 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.40 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Olof Johansson , arm@kernel.org, Santosh Shilimkar , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add basic SMP support for Keystone machines. This does not include support for CPU hotplug for now. Cc: Olof Johansson Cc: Arnd Bergmann Cc: arm@kernel.org Signed-off-by: Santosh Shilimkar --- arch/arm/mach-keystone/Kconfig | 1 + arch/arm/mach-keystone/Makefile | 1 + arch/arm/mach-keystone/keystone.c | 4 +++ arch/arm/mach-keystone/keystone.h | 17 ++++++++++ arch/arm/mach-keystone/platsmp.c | 67 +++++++++++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 arch/arm/mach-keystone/keystone.h create mode 100644 arch/arm/mach-keystone/platsmp.c diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig index 39fab74..6054673 100644 --- a/arch/arm/mach-keystone/Kconfig +++ b/arch/arm/mach-keystone/Kconfig @@ -3,6 +3,7 @@ config ARCH_KEYSTONE select CPU_V7 select ARM_GIC select HAVE_ARM_ARCH_TIMER + select HAVE_SMP select USE_OF select MULTI_IRQ_HANDLER select CLKSRC_MMIO diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile index d4671d5..3f6b8ab 100644 --- a/arch/arm/mach-keystone/Makefile +++ b/arch/arm/mach-keystone/Makefile @@ -1 +1,2 @@ obj-y := keystone.o +obj-$(CONFIG_SMP) += platsmp.o diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index 6c6fc42..5dd3b32 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -19,6 +19,9 @@ #include #include #include +#include + +#include "keystone.h" #define PLL_RESET_WRITE_KEY_MASK 0xffff0000 #define PLL_RESET_WRITE_KEY 0x5a69 @@ -67,6 +70,7 @@ void keystone_restart(char mode, const char *cmd) } DT_MACHINE_START(KEYSTONE, "Keystone") + .smp = smp_ops(keystone_smp_ops), .map_io = debug_ll_io_init, .init_machine = keystone_init, .dt_compat = keystone_match, diff --git a/arch/arm/mach-keystone/keystone.h b/arch/arm/mach-keystone/keystone.h new file mode 100644 index 0000000..43a1b47 --- /dev/null +++ b/arch/arm/mach-keystone/keystone.h @@ -0,0 +1,17 @@ +/* + * Copyright 2013 Texas Instruments, Inc. + * Cyril Chemparathy + * Santosh Shilimkar + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#ifndef __KEYSTONE_H__ +#define __KEYSTONE_H__ + +extern struct smp_operations keystone_smp_ops; +extern void secondary_startup(void); + +#endif /* __KEYSTONE_H__ */ diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c new file mode 100644 index 0000000..3071dda --- /dev/null +++ b/arch/arm/mach-keystone/platsmp.c @@ -0,0 +1,67 @@ +/* + * Keystone SOC SMP platform code + * + * Copyright 2013 Texas Instruments, Inc. + * Cyril Chemparathy + * Santosh Shilimkar + * + * Based on platsmp.c, Copyright (C) 2002 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include +#include +#include + +#include + +#include "keystone.h" + +static void __init keystone_smp_init_cpus(void) +{ + unsigned int i, ncores; + + ncores = 4; + + /* sanity check */ + if (ncores > NR_CPUS) { + pr_warn("restricted to %d cpus\n", NR_CPUS); + ncores = NR_CPUS; + } + + for (i = 0; i < ncores; i++) + set_cpu_possible(i, true); +} + +static int __cpuinit keystone_smp_boot_secondary(unsigned int cpu, + struct task_struct *idle) +{ + unsigned long start = virt_to_phys(&secondary_startup); + int error; + + pr_debug("keystone-smp: booting cpu %d, vector %08lx\n", + cpu, start); + + asm volatile ( + "mov r0, #0\n" /* power on cmd */ + "mov r1, %1\n" /* cpu */ + "mov r2, %2\n" /* start */ + ".inst 0xe1600070\n" /* smc #0 */ + "mov %0, r0\n" + : "=r" (error) + : "r"(cpu), "r"(start) + : "cc", "r0", "r1", "r2", "memory" + ); + + pr_debug("keystone-smp: monitor returned %d\n", error); + + return error; +} + +struct smp_operations keystone_smp_ops __initdata = { + .smp_init_cpus = keystone_smp_init_cpus, + .smp_boot_secondary = keystone_smp_boot_secondary, +};