From patchwork Tue May 14 09:31:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 2568251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id F3A443FD85 for ; Tue, 14 May 2013 17:43:52 +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 1UcBdL-00024F-Tv; Tue, 14 May 2013 09:35:12 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcBaB-00017w-4W; Tue, 14 May 2013 09:31:43 +0000 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21] helo=cam-smtp0.cambridge.arm.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcBa7-00017X-TK for linux-arm-kernel@lists.infradead.org; Tue, 14 May 2013 09:31:40 +0000 Received: from arm.com (e102109-lin.cambridge.arm.com [10.1.203.38]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id r4E9VCSc006070; Tue, 14 May 2013 10:31:12 +0100 Date: Tue, 14 May 2013 10:31:08 +0100 From: Catalin Marinas To: Benoit Lecardonnel Subject: Re: arm64: Platform devices populated from a device_initcall Message-ID: <20130514093108.GA15129@arm.com> References: <519112E7.3040309@synopsys.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <519112E7.3040309@synopsys.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130514_053140_162352_8C2768EB X-CRM114-Status: GOOD ( 16.51 ) X-Spam-Score: -3.2 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [217.140.96.21 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -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 Hi Benoit, On Mon, May 13, 2013 at 05:20:55PM +0100, Benoit Lecardonnel wrote: > In the arm64 kernel, function arm64_device_probe > (arch/arm64/kernel/setup.c) is in charge of populating the platform > devices defined by the device tree. > > Does anyone know why arm64_device_probe is a device_initcall? It had to be somewhere after arch_initcall used by vexpress clocks (but now I do it in arm64_of_clk_init()). The of_clk_init needs to be after a core_inicall used by the vexpress sysreg initialisation. > This seems to be in conflict with some I2C drivers: see > drivers/i2c/busses/i2c-designware-platdrv.c for example. > The driver calls platform_driver_probe from a subsys_initcall. > The probe fails because subsys_initcalls are executed before > device_initcalls. Ah, this driver doesn't use platform_driver_register() but probe directly, so it needs the platform devices to be populated. > Maybe arm64_device_probe could be an arch_initcall? I think we could put of_clk_init() and of_platform_populate() calls under the same arch_initcall() just to keep their relative order. Something like this (could even use arch_initcall_sync in case we get some other arch_initcall in the future): Tested-by: Benoit Lecardonnel diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 6a9a532..add6ea6 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -282,12 +282,13 @@ void __init setup_arch(char **cmdline_p) #endif } -static int __init arm64_of_clk_init(void) +static int __init arm64_device_init(void) { of_clk_init(NULL); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); return 0; } -arch_initcall(arm64_of_clk_init); +arch_initcall(arm64_device_init); static DEFINE_PER_CPU(struct cpu, cpu_data); @@ -305,13 +306,6 @@ static int __init topology_init(void) } subsys_initcall(topology_init); -static int __init arm64_device_probe(void) -{ - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - return 0; -} -device_initcall(arm64_device_probe); - static const char *hwcap_str[] = { "fp", "asimd",