From patchwork Sat Jun 15 13:38:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2727061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9980C0AB1 for ; Sat, 15 Jun 2013 13:39:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F060820213 for ; Sat, 15 Jun 2013 13:39:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C1EE201FC for ; Sat, 15 Jun 2013 13:39:39 +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 1UnqhU-0005nN-EC; Sat, 15 Jun 2013 13:39:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnqhR-0006Pz-Vu; Sat, 15 Jun 2013 13:39:25 +0000 Received: from mail-bk0-x232.google.com ([2a00:1450:4008:c01::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnqhP-0006PK-Ez for linux-arm-kernel@lists.infradead.org; Sat, 15 Jun 2013 13:39:24 +0000 Received: by mail-bk0-f50.google.com with SMTP id ik8so631241bkc.37 for ; Sat, 15 Jun 2013 06:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=wIiLWiidCY9N8ft05rO5A0gOilN866Mnp40fPfRA+4c=; b=tstwqP5s3dsDjR4LpMgTDga6eTnJhvVh+CfxojH8bHbBHUbK5H0vf52d5tJuJEU7/m jdiZwLdLmaCTxkG3xcYhZp/7yCO9KV5/irY3hsYdf95zGvXs+ffGnuErYr47BeE4MGdw +p/X9Aq7rmApyLbHQCUhnbUc5RmifTs8Qmuc9Oz7OiCkwPvBn2jx0FS59Z33fn7AXw8p 4ZMEASJSAAeHBc9RCzrX+AL6Mo4EjBFb+GOAgMGGtBHGYmrhX7lTQVVsoUgAAEk9uJgN lFmj/vVuEZCFLgKJfjlMRWDcEDFh7nMtJhUeXTsdBBeXL2aboL0youROVYlDIEo/XHu1 V7mA== X-Received: by 10.204.226.201 with SMTP id ix9mr910843bkb.157.1371303541252; Sat, 15 Jun 2013 06:39:01 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id 2sm415273bkn.16.2013.06.15.06.38.58 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Jun 2013 06:39:00 -0700 (PDT) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH] ARM: Add .init_platform() callback to machine descriptor Date: Sat, 15 Jun 2013 15:38:56 +0200 Message-Id: <1371303536-12250-1-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.2.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130615_093923_636722_C07F135B X-CRM114-Status: GOOD ( 14.05 ) X-Spam-Score: -2.0 (--) Cc: Nicolas Pitre , Russell King - ARM Linux , Arnd Bergmann , Stephen Warren , Will Deacon , Stefano Stabellini , Nicolas Ferre , linux-kernel@vger.kernel.org, Rob Herring , Tomasz Figa , Olof Johansson , Maxime Ripard 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: , 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.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Most ARM platforms have parts that should be initialized as early as possible, which usually means as soon as memory management (kmalloc, ioremap) starts to work, However, currently there is no appropriate callback in machine_desc struct to use for such initialization and platforms tend to stuff things up .init_irq() and .init_time() callbacks. Since all the DT-based platforms are going towards generic IRQ and time initialization (using irqchip_init and clocksource_of_init) and current code assumes that if custom callbacks are not provided in machine_desc then generic ones should be used, this problem has become a bit more inconvenient. This patch tries to solve this issue by introducing new callback called .init_platform(), where any custom low level initialization of platform can be done safely. Signed-off-by: Tomasz Figa --- arch/arm/include/asm/mach/arch.h | 1 + arch/arm/kernel/irq.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 75bf079..76ac800 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -51,6 +51,7 @@ struct machine_desc { void (*reserve)(void);/* reserve mem blocks */ void (*map_io)(void);/* IO mapping function */ void (*init_early)(void); + void (*init_platform)(void); void (*init_irq)(void); void (*init_time)(void); void (*init_machine)(void); diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 9723d17..61e2000 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -115,6 +115,9 @@ EXPORT_SYMBOL_GPL(set_irq_flags); void __init init_IRQ(void) { + if (machine_desc->init_platform) + machine_desc->init_platform(); + if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq) irqchip_init(); else