From patchwork Fri Apr 19 14:40:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2465441 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 573F9DF25A for ; Fri, 19 Apr 2013 14:40:43 +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 1UTCUT-0001nk-VL; Fri, 19 Apr 2013 14:40:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTCUR-0007hY-DV; Fri, 19 Apr 2013 14:40:39 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTCUN-0007hE-M5 for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2013 14:40:36 +0000 Received: from klappe2.localnet (HSI-KBW-095-208-002-043.hsi5.kabel-badenwuerttemberg.de [95.208.2.43]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MQb5V-1U5nNU42ZB-00UaWH; Fri, 19 Apr 2013 16:40:34 +0200 From: Arnd Bergmann To: "Russell King - ARM Linux" Subject: [PATCH v3] ARM: default machine descriptor for multiplatform Date: Fri, 19 Apr 2013 16:40:31 +0200 User-Agent: KMail/1.12.2 (Linux/3.8.0-18-generic; KDE/4.3.2; x86_64; ; ) References: <1365779468-116419-1-git-send-email-arnd@arndb.de> <20130419132848.GO14496@n2100.arm.linux.org.uk> <201304191621.54681.arnd@arndb.de> In-Reply-To: <201304191621.54681.arnd@arndb.de> MIME-Version: 1.0 Message-Id: <201304191640.32139.arnd@arndb.de> X-Provags-ID: V02:K0:in0DsFg6vQp9lXN6pwz1mmFKA28UIcvd/KASpgXxT+Z Rf5kXOrHUnu6GtinYfGdmJJS/88O72WMbi9OZ+ecfwTIbq0kEQ tX/fIlSPzazZYMBpdH47WR68laAeUu3fBc1IQfWyVLBHB5CbZS C8aBVQ6KkQA0zx0DIyuZsznwQ1daYx/kwzP/v6fGOLmEvoMNFi 51ffXQeDgLr/AUy4VImLA4Dqp4ytjUhzYvAVPx0L/cxvs0uqXw rf4S0FXtyYDZhlC55NOxRIoalVgFR9Cs13Woiv/F4o6h4LB02d 0O1sGajrODLDOgm3dR2NFNWhP087wHnpC6EiPgNvZsSAM2I6bf imXAg4Pl7WbZYaajUX0E= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130419_104036_104662_6971BA5B X-CRM114-Status: GOOD ( 20.56 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.9 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] Cc: 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 Since we now have default implementations for init_time and init_irq, the init_machine callback is the only one that is not yet optional, but since simple DT based platforms all have the same of_platform_populate function call in there, we can consolidate them as well, and then actually boot with a completely empty machine_desc. Unofortunately we cannot just default to an empty init_machine: We cannot call of_platform_populate before init_machine because that does not work in case of auxdata, and we cannot call it after init_machine either because the machine might need to run code after adding the devices. To take the final step, this adds support for booting without defining any machine_desc whatsoever. For the case that CONFIG_MULTIPLATFORM is enabled, it adds a global machine descriptor that never matches any machine but is used as a fallback if nothing else matches. We assume that without CONFIG_MULTIPLATFORM, we only want to boot on the systems that the kernel is built for, so we still retain the build-time warning for missing machine descriptors and the run-time warning when the platform does not match in that case. In the case that we run on a multiplatform kernel and the machine provides a fully populated device tree, we attempt to keep booting, hoping that no machine specific callbacks are necessary. Finally, this also removes the misguided "select ARCH_VEXPRESS" that was only added to avoid a build error for allnoconfig kernels. Signed-off-by: Arnd Bergmann Acked-by: Nicolas Pitre Acked-by: Olof Johansson Cc: "Russell King - ARM Linux" Cc: Rob Herring diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1cacda4..e67d49d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1014,7 +1014,6 @@ config ARCH_MULTI_V7 bool "ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)" default y select ARCH_MULTI_V6_V7 - select ARCH_VEXPRESS select CPU_V7 config ARCH_MULTI_V6_V7 diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 70f1bde..9038c9f 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -180,6 +180,13 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) unsigned long dt_root; const char *model; + if (IS_ENABLED(CONFIG_ARCH_MULTIPLATFORM)) { + DT_MACHINE_START(GENERIC_DT, "Generic DT based system") + MACHINE_END + + mdesc_best = (struct machine_desc *)&__mach_desc_GENERIC_DT; + } + if (!dt_phys) return NULL; diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index d343a6c..9e0f43d 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -660,9 +661,17 @@ struct screen_info screen_info = { static int __init customize_machine(void) { - /* customizes platform devices, or adds new ones */ + /* + * customizes platform devices, or adds new ones + * On DT based machines, we fall back to populating the + * machine from the device tree, if no callback is provided, + * otherwise we would always need an init_machine callback. + */ if (machine_desc->init_machine) machine_desc->init_machine(); + else + of_platform_populate(NULL, of_default_bus_match_table, + NULL, NULL); return 0; } arch_initcall(customize_machine);