From patchwork Fri Aug 24 08:33:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyungmin Park X-Patchwork-Id: 1370081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id D3653DF264 for ; Fri, 24 Aug 2012 08:36:18 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4pKU-0004yM-EF; Fri, 24 Aug 2012 08:33:22 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4pKO-0004xX-VN for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2012 08:33:19 +0000 Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9900D0G3REJNW0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2012 17:33:15 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-c7-50373c4aa167 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 88.2B.17335.A4C37305; Fri, 24 Aug 2012 17:33:14 +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 <0M99001AF3RCIG60@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2012 17:33:14 +0900 (KST) Received: by july (sSMTP sendmail emulation); Fri, 24 Aug 2012 17:33:51 +0900 Date: Fri, 24 Aug 2012 17:33:51 +0900 From: Kyungmin Park To: Russell King , Arnd Bergmann Subject: [PATCH v5 1/2] ARM: Make a compile firmware conditionally Message-id: <20120824083351.GA25369@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+t9jAV0vG/MAg/1nOCw2Pb7G6sDosXlJ fQBjFJdNSmpOZllqkb5dAlfGykOrmAqWSFfMXrSLtYHxvWgXIyeHhICJxPVpO9ggbDGJC/fW A9lcHEICixglXt7fxwThzGeS2HjjPQtIlZCAr8ThRQ/YQWwWAVWJe9O+M4LYbAJaElc+7AGL iwh4SHR2XGcGsZkFGhklds3262Lk4BAWcJJYf8ECJMwroCkx5fZ2RghbUOLH5HssEOVaEut3 HmeCsKUlHv2dwQ6xVlPi6N83YIeKCqhITDm5jW0Co8AsJO2zkLTPQtK+gJF5FaNoakFyQXFS eq6hXnFibnFpXrpecn7uJkZwAD6T2sG4ssHiEKMAB6MSD++OFrMAIdbEsuLK3EOMEhzMSiK8 8x8DhXhTEiurUovy44tKc1KLDzFKc7AoifPy9xkGCAmkJ5akZqemFqQWwWSZODilGhi7ay9f v8nqzCC3bNEFR3EBgz0eSo9e57L5bjt22k3TTJRz+bNXd6Wvbroc9l058/fho3r35J5vND5n PCXB4rWpvuvKNW6nHcsfcLx8P8VKPOJM2z9rjoZjs3JrP5fr/j+n0BN4cWVDNP8hjcA9dd/a auOP823j+RGhO7df68Cp28myWlJfHaYrsRRnJBpqMRcVJwIAnF+xaDwCAAA= 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.34 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 */ do_firmware_op(cpu_boot, cpu); } gic_raise_softirq(cpumask_of(cpu), 1); if (pen_release == -1) 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 --- Changelog v4 use call_firmware_op commented by Tomasz Figa. remove useless core_initcall 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..e375e9f --- /dev/null +++ b/arch/arm/common/firmware.c @@ -0,0 +1,25 @@ +/* + * 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 + +static void cpu_boot(int cpu) +{ + /* Do nothing */ +} + +static struct firmware_ops default_firmware_ops = { + .do_idle = cpu_do_idle, + .cpu_boot = cpu_boot, +}; + +struct firmware_ops *firmware_ops = &default_firmware_ops; diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h new file mode 100644 index 0000000..99c97ff --- /dev/null +++ b/arch/arm/include/asm/firmware.h @@ -0,0 +1,27 @@ +/* + * 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; + +#ifdef CONFIG_ARM_FIRMWARE +#define call_firmware_op(op, ...) \ + ((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : 0) +#else +#define call_firmware_op(op, ...) do { } while (0) +#endif + +#endif