From patchwork Fri Aug 24 00:24:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyungmin Park X-Patchwork-Id: 1369211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4331E3FCAE for ; Fri, 24 Aug 2012 00:28:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4hh4-0002OB-DD; Fri, 24 Aug 2012 00:24:10 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4hh0-0002Ny-Jg for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2012 00:24:07 +0000 Received: from epcpsbgm1.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9800LBAH3TCGH0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2012 09:24:00 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-17-5036c9a0f899 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 84.50.17335.0A9C6305; Fri, 24 Aug 2012 09:24:00 +0900 (KST) Received: from july ([165.213.74.254]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M98002TNH3ZQ410@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2012 09:24:00 +0900 (KST) Received: by july (sSMTP sendmail emulation); Fri, 24 Aug 2012 09:24:37 +0900 Date: Fri, 24 Aug 2012 09:24:37 +0900 From: Kyungmin Park To: Russell King , Arnd Bergmann Subject: [PATCH v4 1/2] ARM: Make a compile firmware conditionally Message-id: <20120824002437.GA17038@july> MIME-version: 1.0 Content-disposition: inline rom: Kyungmin Park User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsVy+t9jAd0FJ80CDDZMVLTY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZ7xYmFOyWqpi1/zZjA+Mk0S5GTg4JAROJiwdeMULYYhIX7q1n 62Lk4hASWMQo0dL1mBHCmc8kcW7+VhaQKiEBX4kzkxYygdgsAqoSz+4fZQWx2QS0JK582MMO YosIeEh0dlxnBrGZBRoZJXbN9gOxhQWcJD6/3QzWyyugKbHp7gN2CFtQ4sfkeywQ9VoS63ce Z4KwpSUe/Z3BDrFXU+Lo3zdsILaogIrElJPb2CYwCsxC0j4LSfssJO0LGJlXMYqmFiQXFCel 5xrqFSfmFpfmpesl5+duYgQH4DOpHYwrGywOMQpwMCrx8O5oMQsQYk0sK67MPcQowcGsJML7 dT5QiDclsbIqtSg/vqg0J7X4EKM0B4uSOC9/n2GAkEB6YklqdmpqQWoRTJaJg1OqgXE3q+a3 q+Vf36hGV8T0/Nu+Wjhd+7n8yheXD86ouZT6Z8/W+pe2R7QPFC79s9LaaMrFF9odH73b/Bf5 CRRNnL3m6bXzpiFrE6+ca1jwXiN9c9yfHs7XIQsfsqofyhXlfbrCrYKt7TtTffCvl84nH5yt XeRycPYutfS77z+KLNDiV3TXXqab/eKGEktxRqKhFnNRcSIAvcjRATwCAAA= X-TM-AS-MML: No X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.8 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 HDRS_LCASE Odd capitalization of message header Cc: olof@lixom.net, dave.martin@linaro.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kyungmin Park Some boards can use the firmware at trustzone but others can't use this. However we need to build it simultaneously. To address this issue, introduce arm firmware support and use it at each board files. e.g., In boot_secondary at mach-exynos/platsmp.c __raw_writel(virt_to_phys(exynos4_secondary_startup), CPU1_BOOT_REG); if (IS_ENABLED(CONFIG_ARM_FIRMWARE)) { /* Call Exynos specific smc call */ firmware_ops->cpu_boot(cpu); } gic_raise_softirq(cpumask_of(cpu), 1); if (pen_release == -1) Now smp_ops is not yet merged, now just call the firmware_init at init_early at board file e.g., exynos4412 based board static void __init board_init_early(void) { exynos_firmware_init(); } TODO 1. DT support. 2. call firmware init by smp_ops. Signed-off-by: Kyungmin Park diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 283fa1d..5b097ca 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -21,6 +21,9 @@ config ARM_VIC_NR The maximum number of VICs available in the system, for power management. +config ARM_FIRMWARE + bool + config ICST bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index e8a4e58..4af6568 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_ARM_GIC) += gic.o obj-$(CONFIG_ARM_VIC) += vic.o +obj-$(CONFIG_ARM_FIRMWARE) += firmware.o obj-$(CONFIG_ICST) += icst.o obj-$(CONFIG_SA1111) += sa1111.o obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o diff --git a/arch/arm/common/firmware.c b/arch/arm/common/firmware.c new file mode 100644 index 0000000..d2c5d37 --- /dev/null +++ b/arch/arm/common/firmware.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Samsung Electronics. + * Kyungmin Park + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include + +#include + +struct firmware_ops *firmware_ops; + +static void cpu_boot(int cpu) +{ + /* Do nothing */ +} + +static struct firmware_ops __firmware_ops = { + .do_idle = cpu_do_idle, + .cpu_boot = cpu_boot, +}; + +static int __init firmware_init(void) +{ + firmware_ops = __firmware_ops; + return 0; +} + +core_initcall(firmware_init); diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h new file mode 100644 index 0000000..8f47cf7 --- /dev/null +++ b/arch/arm/include/asm/firmware.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2012 Samsung Electronics. + * Kyungmin Park + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __ASM_ARM_FIRMWARE_H +#define __ASM_ARM_FIRMWARE_H + +struct firmware_ops { + int (*do_idle)(void); + void (*cpu_boot)(int cpu); +}; + +extern struct firmware_ops *firmware_ops; + +#endif