public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Shawn Guo <shawn.guo@freescale.com>
Cc: Olof Johansson <olof@lixom.net>, Shawn Guo <shawn.guo@linaro.org>,
	linux-kernel@vger.kernel.org, grant.likely@secretlab.ca,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	patches@linaro.org
Subject: Re: [PATCH 2/4] ARM: mxc: migrate mach-mx5 gpio driver to gpio-mxc
Date: Tue, 31 May 2011 17:27:55 +0200	[thread overview]
Message-ID: <201105311727.55985.arnd@arndb.de> (raw)
In-Reply-To: <20110531151019.GA32275@S2100-06.ap.freescale.net>

On Tuesday 31 May 2011, Shawn Guo wrote:
> 
> On Tue, May 31, 2011 at 01:28:17PM +0200, Arnd Bergmann wrote:
> > On Tuesday 31 May 2011, Shawn Guo wrote:
> > > > Just open-code the mxc_add_mxc_gpio() by moving the individual calls to
> > > > mxc_add_gpio() into the respective callers. Having a global
> > > > mxc_add_mxc_gpio() function that does something different for each
> > > > caller seems entirely pointless to me.
> > > > 
> > > Right now, mxc_add_mxc_gpio() is a postcore_initcall.  Moving
> > > individual mxc_add_gpio() call into irq_init function does not work.
> > > And I need to find a proper caller for each SoC to call mxc_add_gpio
> > > to register gpio devices.
> >  
> > Why not init_machine? That is an arch_initcall(), so it's probably close
> > enough.
> > 
> The init_machine is mostly a board specific function than SoC specific
> one.  That is to say we will call mxc_add_gpio() in every single board
> init function even for the same SoC.

But the machine is the only place that knows what SOC is being used.
Your patch right now detects it by looking at the CPU type that is
also being set by the board file using the init_early call, which
is a bit silly.

I would leave e.g. the imx51_register_gpios() in place, but only
change the definition and the caller to

void __init imx51_register_gpios(void)
{
        mxc_add_gpio(0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO1_LOW, MX51_MXC_INT_GPIO1_HIGH);
        mxc_add_gpio(1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO2_LOW, MX51_MXC_INT_GPIO2_HIGH);
        mxc_add_gpio(2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
        mxc_add_gpio(3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
}

Then you can call that function from each i.mx51 based board, or
from a new imx51_soc_init() function that groups multiple such
functions.

	Arnd

  reply	other threads:[~2011-05-31 15:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 14:52 [PATCH 0/4] Move plat-mxc gpio driver into drivers/gpio Shawn Guo
2011-05-30 14:52 ` [PATCH 1/4] gpio: gpio-mxc: add gpio driver for Freescale MXC architecture Shawn Guo
2011-05-31  0:53   ` Olof Johansson
2011-05-31  1:35     ` Shawn Guo
2011-05-31  8:44   ` Jamie Iles
2011-05-31  9:16     ` Shawn Guo
2011-05-30 14:52 ` [PATCH 2/4] ARM: mxc: migrate mach-mx5 gpio driver to gpio-mxc Shawn Guo
2011-05-31  0:16   ` Olof Johansson
2011-05-31  2:47     ` Shawn Guo
2011-05-31  8:26       ` Arnd Bergmann
2011-05-31 10:30         ` Shawn Guo
2011-05-31 11:28           ` Arnd Bergmann
2011-05-31 15:10             ` Shawn Guo
2011-05-31 15:27               ` Arnd Bergmann [this message]
2011-05-31 16:08                 ` Shawn Guo
2011-05-31 16:52                   ` Olof Johansson
2011-05-30 14:52 ` [PATCH 3/4] ARM: mxc: migrate mach-imx " Shawn Guo
2011-05-30 14:52 ` [PATCH 4/4] ARM: mxc: remove plat-mxc/gpio driver Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201105311727.55985.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=grant.likely@secretlab.ca \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=patches@linaro.org \
    --cc=shawn.guo@freescale.com \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox