Re: Initcall ordering

2010-04-24 Thread Gary Thomas

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:
i...@3100 {
#address-cells = 1;
#size-cells = 0;
cell-index = 1;
compatible = fsl-i2c;
reg = 0x3100 0x100;
interrupts = 15 0x8;
interrupt-parent = ipic;
dfsrr;

t...@01 {
compatible = ti,tsc2007;
reg = 0x48;
};

l...@01 {
compatible = philips,leds-pca955x;
reg = 0x60;
};
};

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

RedBoot e
Memory - 0x0 0x800 (128MB)
ENET0: local-mac-address - 00:07:d2:01:00:2e
ENET1: local-mac-address - 00:07:d2:01:00:2f
CPU clock-frequency - 0x27c19cc0 (667MHz)
CPU timebase-frequency - 0x4f64b50 (83MHz)
CPU bus-frequency - 0x13d92d40 (333MHz)

zImage starting: loaded at 0x0040 (sp: 0x005d0034)
Allocating 0x3cedb8 bytes for kernel ...
gunzipping (0x - 0x0040d000:0x005ce961)...done 0x3b3c14 bytes

Linux/PowerPC load: console=ttyS0,38400 root=/dev/mtdblock3 rootfstype=jffs2 rw 
initcall_debug=1
Finalizing device tree... flat tree at 0x5dc300
Using ASP8347E machine description
Linux version 2.6.28-svn5105 (gtho...@titan) (gcc version 4.3.2 
(crosstool-ng-svn_unkn...@20090118.021742) ) #19 Sat Apr 24 08:12:18 MDT 2010
console [udbg0] enabled
setup_arch: bootmem
asp834x_setup_arch()
DB FPGA at fdfee000
Found FSL PCI host bridge at 0xff008500. Firmware bus number: 0-0
PCI host bridge /p...@ff008500 (primary) ranges:
 MEM 0xc000..0xcfff - 0xc000 
  IO 0xb800..0xb80f - 0x
arch: exit
Zone PFN ranges:
  DMA  0x - 0x8000
  Normal   0x8000 - 0x8000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0x - 0x8000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyS0,38400 root=/dev/mtdblock3 rootfstype=jffs2 
rw initcall_debug=1
IPIC (128 IRQ sources) at fdeeb700
PID hash table entries: 512 (order: 9, 2048 bytes)
clocksource: timebase mult[300c4ce] shift[22] registered
Console: colour dummy device 80x25
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 125864k/131072k available (3608k kernel code, 5052k reserved, 160k 
data, 107k bss, 176k init)
Calibrating delay loop... 166.40 BogoMIPS (lpj=332800)
Mount-cache hash table entries: 512
calling  spawn_ksoftirqd+0x0/0x58 @ 1
initcall spawn_ksoftirqd+0x0/0x58 returned 0 after 0 usecs
calling  net_ns_init+0x0/0x1a0 @ 1
net_namespace: 288 bytes
initcall net_ns_init+0x0/0x1a0 returned 0 after 3906 usecs
calling  sysctl_init+0x0/0x4c @ 1
initcall sysctl_init+0x0/0x4c returned 0 after 0 usecs
calling  ksysfs_init+0x0/0xd8 @ 1
initcall ksysfs_init+0x0/0xd8 returned 0 after 0 usecs
calling  init_jiffies_clocksource+0x0/0x28 @ 1
initcall init_jiffies_clocksource+0x0/0x28 returned 0 after 0 usecs
calling  filelock_init+0x0/0x48 @ 1
initcall filelock_init+0x0/0x48 returned 0 after 0 usecs
calling  init_misc_binfmt+0x0/0x5c @ 1
initcall init_misc_binfmt+0x0/0x5c returned 0 after 0 usecs
calling  init_script_binfmt+0x0/0x28 @ 1
initcall init_script_binfmt+0x0/0x28 returned 0 after 0 usecs
calling  init_elf_binfmt+0x0/0x28 @ 1
initcall init_elf_binfmt+0x0/0x28 returned 0 after 0 usecs
calling  random32_init+0x0/0xcc @ 1
initcall random32_init+0x0/0xcc returned 0 after 0 usecs
calling  sock_init+0x0/0x84 @ 1
initcall sock_init+0x0/0x84 returned 0 after 0 usecs
calling  netlink_proto_init+0x0/0x170 @ 1
NET: Registered protocol family 16
initcall netlink_proto_init+0x0/0x170 returned 0 after 3906 

Re: Initcall ordering

2010-04-23 Thread Gary Thomas

On 04/23/2010 09:56 AM, 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.

What can I do about this? Has the problem been seen before?
I can provide more data, as required.

note: I'm currently using 2.6.28, but I will be moving to 2.6.32
soon in case it matters, but I'd rather find/understand/fix this
in 2.6.28 if possible.


A possibly related question: how can I2C devices work as
modules when the device address + probe info is in the device
tree?  Given the behaviour I'm seeing (I2C device probes only
happen when the bus is enumerated), how is this supposed to
work?

... maybe I'm missing something fundamental?

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Initcall ordering

2010-04-23 Thread Wolfram Sang
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.s...@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.s...@pengutronix.de
---
 drivers/i2c/busses/i2c-mpc.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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 adr...@humboldt.co.uk);

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


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev