From patchwork Mon Apr 23 07:10:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 8008 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id EF9D323E49 for ; Mon, 23 Apr 2012 07:09:28 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B704EA187DF for ; Mon, 23 Apr 2012 07:09:28 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so22276722iag.11 for ; Mon, 23 Apr 2012 00:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=LUMj3yWhAtIRCKDFfmMFZ+0La0ppQHdszEamAx0yEQ0=; b=DKtOVUvhJge/Cy+94QYXywhieGTffNAyLFPGTVHoCv5JLIz3FIJpagTfzWzNlsY249 0fDmzCiDcIEG+g3s8irDXebMMKDgYrlm6DtsZiZX6YfrxOow31Mi04RWGU/RZVk49bDU npTyBd4gFhYHFjM7yZNYPHowlnaP1Qphn/jjNOVL3kIYnGWZ0WZp3fPuRdX3Ic/RnIxL lDdn+BoAhvVTrlmHP9mdVc64aAc3DjYihuEC604Dyx7Wx+g4G0sJKxtf9pJQ10/c4Dpe nremb3IoUDq+LHKWreOD5y48joXoSsDQmI6ZVCyN0Auhf0XWVlT+OWyerof+WShd1Q7X WTFw== Received: by 10.50.193.199 with SMTP id hq7mr5316524igc.49.1335164968517; Mon, 23 Apr 2012 00:09:28 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp91200ibt; Mon, 23 Apr 2012 00:09:27 -0700 (PDT) Received: by 10.68.189.230 with SMTP id gl6mr3301184pbc.64.1335164967137; Mon, 23 Apr 2012 00:09:27 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id y10si15421692pbg.106.2012.04.23.00.09.26 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:09:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: by pbcxa12 with SMTP id xa12so4022979pbc.37 for ; Mon, 23 Apr 2012 00:09:26 -0700 (PDT) Received: by 10.68.204.234 with SMTP id lb10mr6313970pbc.161.1335164966893; Mon, 23 Apr 2012 00:09:26 -0700 (PDT) Received: from S2101-09.ap.freescale.net ([114.216.235.177]) by mx.google.com with ESMTPS id ha8sm1603923pbc.45.2012.04.23.00.09.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:09:25 -0700 (PDT) Date: Mon, 23 Apr 2012 15:10:15 +0800 From: Shawn Guo To: Sascha Hauer Cc: Rob Lee , Amit Kucheria , kernel@pengutronix.de, linaro-dev@lists.linaro.org, patches@linaro.org, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/3] ARM: imx: Add common imx cpuidle init functionality. Message-ID: <20120423071013.GS26306@S2101-09.ap.freescale.net> References: <20120417174213.GD3852@pengutronix.de> <20120419064308.GH3852@pengutronix.de> <20120420020816.GH22219@S2101-09.ap.freescale.net> <20120423051813.GM26306@S2101-09.ap.freescale.net> <20120423062739.GX3852@pengutronix.de> <20120423065259.GR26306@S2101-09.ap.freescale.net> <20120423065623.GA3852@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120423065623.GA3852@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQloJchq/SbiddEyF3DDybSTXV/C0PKNRfby+M5jQZEPxSMO7lRtVGOG0/b/a+PuVk+WL16X On Mon, Apr 23, 2012 at 08:56:23AM +0200, Sascha Hauer wrote: > On Mon, Apr 23, 2012 at 02:53:01PM +0800, Shawn Guo wrote: > > On Mon, Apr 23, 2012 at 08:27:39AM +0200, Sascha Hauer wrote: > > > On Mon, Apr 23, 2012 at 01:18:21PM +0800, Shawn Guo wrote: > > > > On Sun, Apr 22, 2012 at 11:44:39PM -0500, Rob Lee wrote: ... > > > > > Since device_initcall isn't platform specific, it seems I would still > > > > > need a cpu_is_imx6q() function or similiar functionality from a device > > > > > tree call. Or do you have something else in mind that I'm not seeing? > > > > > > > > > I guess Sascha is asking for something like the following. > > > > > > > > static int __init imx_device_init(void) > > > > { > > > > imx5_device_init(); > > > > imx6_device_init(); > > > > } > > > > device_initcall(imx_device_init) > > > > > > > > static int __init imx6_device_init(void) > > > > { > > > > /* > > > > * do whatever needs to get done in device_initcall time > > > > */ > > > > } > > > > > > The problem is more how we can detect that we are actually running a > > > i.MX6 SoC. We could directly ask the devicetree in an initcall or we > > > could introduce a cpu_is_mx6() just like we have a macro for all other > > > i.MX SoCs. > > > > > Oops, my reply was a brain-dead one. Hmm, then it seems that we have > > to introduce cpu_is_mx6() which I tried hard to avoid. I do not have > > a preference between defining a macro and asking device tree. > > Since we already have a place in early setup code in which we know that > we are running on an i.MX6 I suggest for the sake of the symmetry of the > universe that we introduce a cpu_is_mx6. > Let me try last time. What about having a late_initcall hook in machine_desc? Regards, Shawn 8<--- diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index d7692ca..0b1c94b 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -43,6 +43,7 @@ struct machine_desc { void (*init_irq)(void); struct sys_timer *timer; /* system tick timer */ void (*init_machine)(void); + void (*init_late)(void); #ifdef CONFIG_MULTI_IRQ_HANDLER void (*handle_irq)(struct pt_regs *); #endif diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index ebfac78..549f036 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -800,6 +800,14 @@ static int __init customize_machine(void) } arch_initcall(customize_machine); +static int __init init_machine_late(void) +{ + if (machine_desc->init_late) + machine_desc->init_late(); + return 0; +} +late_initcall(init_machine_late); + #ifdef CONFIG_KEXEC static inline unsigned long long get_total_mem(void) { diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index da6c1d9..0e3640f 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -142,6 +142,7 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad (Device Tree)") .handle_irq = imx6q_handle_irq, .timer = &imx6q_timer, .init_machine = imx6q_init_machine, + .init_late = imx6q_init_late, .dt_compat = imx6q_dt_compat, .restart = imx6q_restart, MACHINE_END