Patchwork Initcall ordering

login
register
mail settings
Submitter Wolfram Sang
Date April 24, 2010, 1:24 a.m.
Message ID <20100424012427.GA21255@pengutronix.de>
Download mbox | patch
Permalink /patch/50881/
State Rejected
Headers show

Comments

Wolfram Sang - April 24, 2010, 1:24 a.m.
Hi Gary,

(adding linux-i2c)

On Fri, Apr 23, 2010 at 09:56:07AM -0600, Gary Thomas wrote:
> I'm having trouble with the I2C devices on my 8347 platform.
> The problem is that I2C device probe() functions are only called
> once, as the I2C bus is being initialized (in this case fsl_i2c_init())
> I have 2 devices on this bus, one device gets it's initcall
> before fsl_i2c_init, the second one does not :-(  This means
> that the second device is never probed.

Can you try this patch?

From: Wolfram Sang <w.sang@pengutronix.de>
Date: Sat, 24 Apr 2010 03:18:16 +0200
Subject: [PATCH] i2c/mpc: use subsys_initcall() to allow early usage of devices

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 drivers/i2c/busses/i2c-mpc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Gary Thomas - April 24, 2010, 2:26 p.m.
On 04/23/2010 07:24 PM, Wolfram Sang wrote:
> Hi Gary,
>
> (adding linux-i2c)
>
> On Fri, Apr 23, 2010 at 09:56:07AM -0600, Gary Thomas wrote:
>> I'm having trouble with the I2C devices on my 8347 platform.
>> The problem is that I2C device probe() functions are only called
>> once, as the I2C bus is being initialized (in this case fsl_i2c_init())
>> I have 2 devices on this bus, one device gets it's initcall
>> before fsl_i2c_init, the second one does not :-(  This means
>> that the second device is never probed.
>
> Can you try this patch?

No improvement, I'm afraid.

Boot log with initcall_debug=1 attached.  I have 2 devices on I2C-1
   0x48 == tsc2007 touch screen controller
   0x60 == pca9551 LED controller
You can see that the tsc2007 driver gets initialized before the bus
starts, but the pca9551 driver comes too late and never gets probed :-(

Here's the snippet of my device tree:
		i2c@3100 {
			#address-cells = <1>;
			#size-cells = <0>;
			cell-index = <1>;
			compatible = "fsl-i2c";
			reg = <0x3100 0x100>;
			interrupts = <15 0x8>;
			interrupt-parent = <&ipic>;
			dfsrr;

			ts@01 {
				compatible = "ti,tsc2007";
				reg = <0x48>;
			};

			leds@01 {
				compatible = "philips,leds-pca955x";
				reg = <0x60>;
			};
		};

Patch

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index f1321f7..32a3bae 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -693,13 +693,12 @@  static int __init fsl_i2c_init(void)
 		       " of_register_platform_driver failed (%i)\n", rv);
 	return rv;
 }
+subsys_initcall(fsl_i2c_init);
 
 static void __exit fsl_i2c_exit(void)
 {
 	of_unregister_platform_driver(&mpc_i2c_driver);
 }
-
-module_init(fsl_i2c_init);
 module_exit(fsl_i2c_exit);
 
 MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>");