linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Controlling Driver Load Order
       [not found]     ` <AANLkTikj8yGSK5Ovud_k8f6jWloojqDJmQ_H6pD_IFgM@mail.gmail.com>
@ 2010-05-27  4:13       ` Wolfram Sang
       [not found]         ` <20100527041358.GA14070-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2010-05-27  4:13 UTC (permalink / raw)
  To: Robert Emanuele; +Cc: Linus Walleij, linux-arm-kernel, linux-kernel, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]

On Wed, May 26, 2010 at 06:39:13PM -0700, Robert Emanuele wrote:

> Still the framebuffer device would initialize first and it would lack
> having the i2c chips it needs ready.  That is the order I'm trying to
> straighten out.

Understood. Our pointers were probably not precise enough, sorry. Please try
this patch and give a Tested-by-tag if it solves your problems.

From: Wolfram Sang <w.sang@pengutronix.de>
Date: Thu, 27 May 2010 06:03:48 +0200
Subject: [PATCH] i2c-at91: use subsys_initcall() for early initialization

I2C needs to be available early, so other subsystems can access it.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Robert Emanuele <rob@emanuele.us>
Cc: Ben Dooks <ben-linux@fluff.org>
---

 drivers/i2c/busses/i2c-at91.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 305c075..bea5794 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -313,13 +313,12 @@ static int __init at91_i2c_init(void)
 {
 	return platform_driver_register(&at91_i2c_driver);
 }
+subsys_initcall(at91_i2c_init);
 
 static void __exit at91_i2c_exit(void)
 {
 	platform_driver_unregister(&at91_i2c_driver);
 }
-
-module_init(at91_i2c_init);
 module_exit(at91_i2c_exit);
 
 MODULE_AUTHOR("Rick Bronson");


-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Controlling Driver Load Order
       [not found]         ` <20100527041358.GA14070-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-05-27 17:07           ` Robert Emanuele
  2010-05-27 21:01             ` Wolfram Sang
  2010-05-27 21:09             ` Ryan Mallon
  0 siblings, 2 replies; 7+ messages in thread
From: Robert Emanuele @ 2010-05-27 17:07 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Linus Walleij, linux-arm-kernel,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Wolfram,

I am using the i2c-gpio.c driver, not the i2c-at91 driver.  The Atmel
folks have expressed concerns over their i2c silicon and wrote a gpio
version.

Anyway, I better understand the subsys_initcall now and applied that
to the i2c-gpio and my i2c chip driver.  That worked perfectly for my
issue.  I'd be happy to return a patch of this.  Would be this the
sort of thing that would benefit from a config option?  Something
like:

#if defined(CONFIG_EARLY_i2C_GPIO)
subsys_initcall(i2c_gpio_init);
#else
module_init(i2c_gpio_init);
#endif

I appreciate your help and direction.

Thank you,

Rob

On Wed, May 26, 2010 at 9:13 PM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> On Wed, May 26, 2010 at 06:39:13PM -0700, Robert Emanuele wrote:
>
>> Still the framebuffer device would initialize first and it would lack
>> having the i2c chips it needs ready.  That is the order I'm trying to
>> straighten out.
>
> Understood. Our pointers were probably not precise enough, sorry. Please try
> this patch and give a Tested-by-tag if it solves your problems.
>
> From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Date: Thu, 27 May 2010 06:03:48 +0200
> Subject: [PATCH] i2c-at91: use subsys_initcall() for early initialization
>
> I2C needs to be available early, so other subsystems can access it.
>
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Robert Emanuele <rob-3bOSxtzXIkJzbRFIqnYvSA@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> ---
>
>  drivers/i2c/busses/i2c-at91.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 305c075..bea5794 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -313,13 +313,12 @@ static int __init at91_i2c_init(void)
>  {
>        return platform_driver_register(&at91_i2c_driver);
>  }
> +subsys_initcall(at91_i2c_init);
>
>  static void __exit at91_i2c_exit(void)
>  {
>        platform_driver_unregister(&at91_i2c_driver);
>  }
> -
> -module_init(at91_i2c_init);
>  module_exit(at91_i2c_exit);
>
>  MODULE_AUTHOR("Rick Bronson");
>
>
> --
> Pengutronix e.K.                           | Wolfram Sang                |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkv98YYACgkQD27XaX1/VRsvlwCffUOH2qAsWbaG2EmIf1Cl2H+I
> 8P4AoInnCS69XCfq6wIFku1hUgeT8hlG
> =vGcD
> -----END PGP SIGNATURE-----
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Controlling Driver Load Order
  2010-05-27 17:07           ` Robert Emanuele
@ 2010-05-27 21:01             ` Wolfram Sang
  2010-05-27 21:09             ` Ryan Mallon
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2010-05-27 21:01 UTC (permalink / raw)
  To: Robert Emanuele; +Cc: Linus Walleij, linux-arm-kernel, linux-kernel, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

> Anyway, I better understand the subsys_initcall now and applied that
> to the i2c-gpio and my i2c chip driver.  That worked perfectly for my

With chip-driver you mean the PMIC? Yes, that is probably needed there, too.
Which driver is it?

> issue.  I'd be happy to return a patch of this.  Would be this the
> sort of thing that would benefit from a config option?  Something

Nope, there is no bigger drawback to this and probably a number of useres
wouldn't know what to select here. Just patch the module_init() away.

Kind regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Controlling Driver Load Order
  2010-05-27 17:07           ` Robert Emanuele
  2010-05-27 21:01             ` Wolfram Sang
@ 2010-05-27 21:09             ` Ryan Mallon
  2010-05-27 21:42               ` Wolfram Sang
  1 sibling, 1 reply; 7+ messages in thread
From: Ryan Mallon @ 2010-05-27 21:09 UTC (permalink / raw)
  To: Robert Emanuele
  Cc: Wolfram Sang, Linus Walleij, linux-kernel, linux-arm-kernel,
	linux-i2c

Robert Emanuele wrote:
> Hi Wolfram,
> 
> I am using the i2c-gpio.c driver, not the i2c-at91 driver.  The Atmel
> folks have expressed concerns over their i2c silicon and wrote a gpio
> version.
> 
> Anyway, I better understand the subsys_initcall now and applied that
> to the i2c-gpio and my i2c chip driver.  That worked perfectly for my
> issue.  I'd be happy to return a patch of this.  Would be this the
> sort of thing that would benefit from a config option?  Something
> like:
> 
> #if defined(CONFIG_EARLY_i2C_GPIO)
> subsys_initcall(i2c_gpio_init);
> #else
> module_init(i2c_gpio_init);
> #endif

Looks like this has already been done:
http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg03056.html

There was a discussion a while back to make all of the embedded i2c
busses be subsys_initcall since i2c is often a system bus on embedded
devices. Looks the i2c_gpio driver got missed the first time round.

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Controlling Driver Load Order
  2010-05-27 21:09             ` Ryan Mallon
@ 2010-05-27 21:42               ` Wolfram Sang
       [not found]                 ` <20100527214209.GC5636-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2010-05-27 21:42 UTC (permalink / raw)
  To: Ryan Mallon
  Cc: Robert Emanuele, Linus Walleij, linux-kernel, linux-arm-kernel,
	linux-i2c

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]


> Looks like this has already been done:
> http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg03056.html

Always ask which kernel is used, sigh...

> 
> There was a discussion a while back to make all of the embedded i2c
> busses be subsys_initcall since i2c is often a system bus on embedded

Oh, where was that? Can't recall (but couldn't recall that I acked the i2c-gpio
patch above as well ;))

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Controlling Driver Load Order
       [not found]                 ` <20100527214209.GC5636-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-05-27 21:54                   ` Ryan Mallon
       [not found]                     ` <4BFEEA08.70401-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Ryan Mallon @ 2010-05-27 21:54 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Robert Emanuele, Linus Walleij,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

Wolfram Sang wrote:
>> Looks like this has already been done:
>> http://www.mail-archive.com/linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg03056.html
> 
> Always ask which kernel is used, sigh...

Sorry? I didn't see a kernel version mentioned. I went looking because I
had though that i2c-gpio was already subsys_initcall.

>> There was a discussion a while back to make all of the embedded i2c
>> busses be subsys_initcall since i2c is often a system bus on embedded
> 
> Oh, where was that? Can't recall (but couldn't recall that I acked the i2c-gpio
> patch above as well ;))
> 

Moving the embedded i2c busses to subsys_initcall was discussed here:
http://lists.lm-sensors.org/pipermail/i2c/2008-June/004142.html. The
i2c_gpio bus got mentioned, which is why I thought it had already been
changed.

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Controlling Driver Load Order
       [not found]                     ` <4BFEEA08.70401-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
@ 2010-05-27 22:09                       ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2010-05-27 22:09 UTC (permalink / raw)
  To: Ryan Mallon
  Cc: Robert Emanuele, Linus Walleij,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

> > Always ask which kernel is used, sigh...
> 
> Sorry? I didn't see a kernel version mentioned. I went looking because I
> had though that i2c-gpio was already subsys_initcall.

Sorry, I missed emphasizing that my comment was meant as a "note-to-myself".
You were perfectly right, of course, I should have done the same.

> >> There was a discussion a while back to make all of the embedded i2c
> >> busses be subsys_initcall since i2c is often a system bus on embedded
> > 
> > Oh, where was that? Can't recall (but couldn't recall that I acked the i2c-gpio
> > patch above as well ;))
> > 
> 
> Moving the embedded i2c busses to subsys_initcall was discussed here:
> http://lists.lm-sensors.org/pipermail/i2c/2008-June/004142.html. The
> i2c_gpio bus got mentioned, which is why I thought it had already been
> changed.

Thanks for the pointer!

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-05-27 22:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AANLkTikzDvWakd7JW3DzTHinjS3dAlqzPx6K8V2qMDG7@mail.gmail.com>
     [not found] ` <AANLkTinkY8JYh44UOEPflBUDyQ2wat_AKShRjA3HPxrf@mail.gmail.com>
     [not found]   ` <20100526235246.GA31068@pengutronix.de>
     [not found]     ` <AANLkTikj8yGSK5Ovud_k8f6jWloojqDJmQ_H6pD_IFgM@mail.gmail.com>
2010-05-27  4:13       ` Controlling Driver Load Order Wolfram Sang
     [not found]         ` <20100527041358.GA14070-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-05-27 17:07           ` Robert Emanuele
2010-05-27 21:01             ` Wolfram Sang
2010-05-27 21:09             ` Ryan Mallon
2010-05-27 21:42               ` Wolfram Sang
     [not found]                 ` <20100527214209.GC5636-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-05-27 21:54                   ` Ryan Mallon
     [not found]                     ` <4BFEEA08.70401-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
2010-05-27 22:09                       ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).