From patchwork Wed Jun 12 21:25:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2712561 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 A48B6C1459 for ; Wed, 12 Jun 2013 21:27:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B68DA20297 for ; Wed, 12 Jun 2013 21:27:28 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E97B2028F for ; Wed, 12 Jun 2013 21:27:27 +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 1UmsYm-0005bI-7n; Wed, 12 Jun 2013 21:26:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UmsYY-0000jP-7V; Wed, 12 Jun 2013 21:26:14 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UmsYL-0000gk-Hp for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2013 21:26:02 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5CLPbVj012682; Wed, 12 Jun 2013 16:25:37 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5CLPbSi030920; Wed, 12 Jun 2013 16:25:37 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Wed, 12 Jun 2013 16:25:37 -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 r5CLPJ24029661; Wed, 12 Jun 2013 16:25:37 -0500 From: Santosh Shilimkar To: , Subject: [PATCH v2 3/3] ARM: keystone: Enable SMP support on Keystone machines Date: Wed, 12 Jun 2013 17:25:17 -0400 Message-ID: <1371072317-15030-4-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371072317-15030-1-git-send-email-santosh.shilimkar@ti.com> References: <1371072317-15030-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-20130612_172601_718303_BC178757 X-CRM114-Status: GOOD ( 15.80 ) X-Spam-Score: -7.1 (-------) Cc: arm@kernel.org, Santosh Shilimkar , linux-arm-kernel@lists.infradead.org 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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 Acked-by: Olof Johansson --- 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 | 52 +++++++++++++++++++++++++++++++++++++ 5 files changed, 75 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 aebe8cd..2dbd4ce 100644 --- a/arch/arm/mach-keystone/Kconfig +++ b/arch/arm/mach-keystone/Kconfig @@ -4,6 +4,7 @@ config ARCH_KEYSTONE select CPU_V7 select ARM_GIC select HAVE_ARM_ARCH_TIMER + select HAVE_SMP select CLKSRC_MMIO select GENERIC_CLOCKEVENTS select HAVE_SCHED_CLOCK 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 c4912c4..da54d15 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), .init_machine = keystone_init, .dt_compat = keystone_match, .restart = keystone_restart, 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..630ab3b --- /dev/null +++ b/arch/arm/mach-keystone/platsmp.c @@ -0,0 +1,52 @@ +/* + * 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 + +#include "keystone.h" + +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 = arm_dt_init_cpu_maps, + .smp_boot_secondary = keystone_smp_boot_secondary, +};