From patchwork Thu Apr 16 07:59:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 6224181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7B4239F1AC for ; Thu, 16 Apr 2015 08:02:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DCE2201BC for ; Thu, 16 Apr 2015 08:02:53 +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 9B1B320320 for ; Thu, 16 Apr 2015 08:02: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 1Yiej8-0000vR-AH; Thu, 16 Apr 2015 08:00:46 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YieiY-0000k4-4v for linux-arm-kernel@bombadil.infradead.org; Thu, 16 Apr 2015 08:00:10 +0000 Received: from conuserg011.nifty.com ([202.248.44.37] helo=conuserg011-v.nifty.com) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YieiU-0000vZ-BF for linux-arm-kernel@lists.infradead.org; Thu, 16 Apr 2015 08:00:08 +0000 Received: from beagle.diag.org (KD106154032031.au-net.ne.jp [106.154.32.31]) (authenticated) by conuserg011-v.nifty.com with ESMTP id t3G7x3kb011404; Thu, 16 Apr 2015 16:59:09 +0900 X-Nifty-SrcIP: [106.154.32.31] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH v2 1/4] ARM: UniPhier: add basic support for UniPhier architecture Date: Thu, 16 Apr 2015 16:59:04 +0900 Message-Id: <1429171147-19464-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429171147-19464-1-git-send-email-yamada.masahiro@socionext.com> References: <1429171147-19464-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150416_090006_890803_A00F6BC4 X-CRM114-Status: GOOD ( 17.60 ) X-Spam-Score: -1.2 (-) Cc: Mark Rutland , Arnd Bergmann , Pawel Moll , Ian Campbell , linux-kernel@vger.kernel.org, Masahiro Yamada , Rob Herring , Kumar Gala , Olof Johansson 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Initial commit for a new SoC family, UniPhier, developed by Socionext Inc. (formerly, System LSI Business Division of Panasonic Corporation). This commit includes a minimal set of components for booting the kernel, including SMP support. Signed-off-by: Masahiro Yamada --- Changes in v2: - Fix SoC compatible string "socionext,ph1-proxstream2" -> "socionext,proxstream2" arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/mach-uniphier/Kconfig | 11 ++++++ arch/arm/mach-uniphier/Makefile | 2 + arch/arm/mach-uniphier/headsmp.S | 21 +++++++++++ arch/arm/mach-uniphier/platsmp.c | 78 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-uniphier/uniphier.c | 31 ++++++++++++++++ 7 files changed, 146 insertions(+) create mode 100644 arch/arm/mach-uniphier/Kconfig create mode 100644 arch/arm/mach-uniphier/Makefile create mode 100644 arch/arm/mach-uniphier/headsmp.S create mode 100644 arch/arm/mach-uniphier/platsmp.c create mode 100644 arch/arm/mach-uniphier/uniphier.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 392e7ae..c332b98 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -963,6 +963,8 @@ source "arch/arm/mach-tegra/Kconfig" source "arch/arm/mach-u300/Kconfig" +source "arch/arm/mach-uniphier/Kconfig" + source "arch/arm/mach-ux500/Kconfig" source "arch/arm/mach-versatile/Kconfig" diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 5575d9f..9de6aa6 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -201,6 +201,7 @@ machine-$(CONFIG_ARCH_SUNXI) += sunxi machine-$(CONFIG_ARCH_TEGRA) += tegra machine-$(CONFIG_ARCH_U300) += u300 machine-$(CONFIG_ARCH_U8500) += ux500 +machine-$(CONFIG_ARCH_UNIPHIER) += uniphier machine-$(CONFIG_ARCH_VERSATILE) += versatile machine-$(CONFIG_ARCH_VEXPRESS) += vexpress machine-$(CONFIG_ARCH_VT8500) += vt8500 diff --git a/arch/arm/mach-uniphier/Kconfig b/arch/arm/mach-uniphier/Kconfig new file mode 100644 index 0000000..a017b1d --- /dev/null +++ b/arch/arm/mach-uniphier/Kconfig @@ -0,0 +1,11 @@ +config ARCH_UNIPHIER + bool "Socionext UniPhier SoCs" + depends on ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GLOBAL_TIMER + select ARM_GIC + select HAVE_ARM_SCU + select HAVE_ARM_TWD + help + Support for UniPhier SoC family developed by Socionext Inc. + (formerly, System LSI Business Division of Panasonic Corporation) diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile new file mode 100644 index 0000000..46cfa54 --- /dev/null +++ b/arch/arm/mach-uniphier/Makefile @@ -0,0 +1,2 @@ +obj-y := uniphier.o +obj-$(CONFIG_SMP) += headsmp.o platsmp.o diff --git a/arch/arm/mach-uniphier/headsmp.S b/arch/arm/mach-uniphier/headsmp.S new file mode 100644 index 0000000..8d94877 --- /dev/null +++ b/arch/arm/mach-uniphier/headsmp.S @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 Socionext Inc. + * Author: Masahiro Yamada + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + +ENTRY(uniphier_secondary_startup) + bl v7_invalidate_l1 + b secondary_startup +ENDPROC(uniphier_secondary_startup) diff --git a/arch/arm/mach-uniphier/platsmp.c b/arch/arm/mach-uniphier/platsmp.c new file mode 100644 index 0000000..6b61f8d --- /dev/null +++ b/arch/arm/mach-uniphier/platsmp.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2015 Socionext Inc. + * Author: Masahiro Yamada + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + +#define ROM_BOOT_ROMRSV2 0x59801208 + +static void __init uniphier_smp_prepare_cpus(unsigned int max_cpus) +{ + static cpumask_t only_cpu_0 = { CPU_BITS_CPU0 }; + unsigned long scu_base_phys = 0; + void __iomem *scu_base; + + if (scu_a9_has_base()) + scu_base_phys = scu_a9_get_base(); + + if (!scu_base_phys) { + pr_err("failed to get scu base\n"); + goto err; + } + + scu_base = ioremap(scu_base_phys, SZ_128); + if (!scu_base) { + pr_err("failed to remap scu base (0x%08lx)\n", scu_base_phys); + goto err; + } + + scu_enable(scu_base); + iounmap(scu_base); + +err: + pr_warn("disabling SMP\n"); + init_cpu_present(&only_cpu_0); +} + +void uniphier_secondary_startup(void); + +static int uniphier_boot_secondary(unsigned int cpu, + struct task_struct *idle) +{ + void __iomem *reg; + + reg = ioremap(ROM_BOOT_ROMRSV2, 4); + if (!reg) { + pr_err("failed to remap ROM_BOOT_ROMRSV2.\n"); + return -ENOMEM; + } + + writel(virt_to_phys(uniphier_secondary_startup), reg); + iounmap(reg); + + asm("sev"); + + return 0; +} + +struct smp_operations uniphier_smp_ops __initdata = { + .smp_prepare_cpus = uniphier_smp_prepare_cpus, + .smp_boot_secondary = uniphier_boot_secondary, +}; +CPU_METHOD_OF_DECLARE(uniphier_smp, "socionext,uniphier-smp", + &uniphier_smp_ops); diff --git a/arch/arm/mach-uniphier/uniphier.c b/arch/arm/mach-uniphier/uniphier.c new file mode 100644 index 0000000..755472d --- /dev/null +++ b/arch/arm/mach-uniphier/uniphier.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 Socionext Inc. + * Author: Masahiro Yamada + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + +static const char * const uniphier_board_dt_compat[] __initconst = { + "socionext,ph1-sld3", + "socionext,ph1-ld4", + "socionext,ph1-pro4", + "socionext,ph1-sld8", + "socionext,ph1-pro5", + "socionext,proxstream2", + "socionext,ph1-ld6b", + NULL, +}; + +DT_MACHINE_START(UNIPHIER, "Socionext UniPhier") + .dt_compat = uniphier_board_dt_compat, +MACHINE_END