diff mbox

Re: i2c/rtc init dependency problem

Message ID 20090924151953.GD3154@pengutronix.de
State Rejected, archived
Headers show

Commit Message

Wolfram Sang Sept. 24, 2009, 3:19 p.m. UTC
Does this patch work for you? I can't test but made a similar one recently...

Comments

Jon Ringle Sept. 25, 2009, 5:48 a.m. UTC | #1
On Sep 24, 11:19 am, Wolfram Sang <w.s...@pengutronix.de> wrote:
> Does this patch work for you? I can't test but made a similar one recently...

I get the following error with this patch:
IOP3xx-I2C: probe of IOP3xx-I2C.0 failed with error -5

Jon

PS Please CC me I am not on the rtc-linux ml.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
Wolfram Sang Sept. 25, 2009, 6:58 a.m. UTC | #2
> I get the following error with this patch:
> IOP3xx-I2C: probe of IOP3xx-I2C.0 failed with error -5

Looking at the probe-routine, this means request_irq failed? Is there something
else needed to get that irq?

Regards,

   Wolfram
Jon Ringle Sept. 25, 2009, 2:49 p.m. UTC | #3
On Fri, Sep 25, 2009 at 2:58 AM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Looking at the probe-routine, this means request_irq failed? Is there something
> else needed to get that irq?

Sorry about that. I had inadvertently removed CONFIG_CPU_IXP46X
causing NR_IRQS to be set to low.

However, it still does not work with your patch. In the dump below I see:
[    0.250000] i2c-core: driver [dummy] registered
...
[    0.290000] i2c-adapter i2c-0: adapter [IOP3xx-I2C] registered
...
[    3.780000] i2c-core: driver [rtc-m41t80] registered
[    3.790000] i2c /dev entries driver
[    3.790000] i2c-core: driver [dev_driver] registered
[    3.800000] i2c-dev: adapter [IOP3xx-I2C] registered as minor 0
[    3.800000] i2c-core: driver [lm75] registered
[    3.830000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x48
...
[    4.050000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)



Full dump:
[    0.000000] Linux version 2.6.31-isc (ringlej@git.ringle.lan) (gcc
version 4.3.2 (OSELAS.Toolchain-1.99.3) ) #4 PREEMPT Fri Sep 25
10:35:53 EDT 2009
[    0.000000] CPU: XScale-IXP46x Family [69054202] revision 2
(ARMv5TE), cr=000039ff
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Vertical RSC4 board
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 65536
[    0.000000] free_area_init_node: node 0, pgdat c0557a8c,
node_mem_map c4000000
[    0.000000]   DMA zone: 128 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 16256 pages, LIFO batch:3
[    0.000000]   Normal zone: 384 pages used for memmap
[    0.000000]   Normal zone: 48768 pages, LIFO batch:15
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0,115200
maclist_ids=00:10:f4:04:09:b4 boot=jffs2 loglevel=8 dynamic_printk
[    0.000000] maclist_setup(00:10:f4:04:09:b4)
[    0.000000] maclist_add(00:10:f4:04:09:b4)
[    0.000000] PID hash table entries: 1024 (order: 10, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 256MB = 256MB total
[    0.000000] Memory: 253756KB available (3796K code, 301K data,
1404K init, 0K highmem)
[    0.000000] SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1
[    0.000000] NR_IRQS:64
[    0.000000] Calibrating delay loop... 532.48 BogoMIPS (lpj=2662400)
[    0.250000] Security Framework initialized
[    0.250000] Mount-cache hash table entries: 512
[    0.250000] CPU: Testing write buffer coherency: ok
[    0.250000] NET: Registered protocol family 16
[    0.250000] i2c-core: driver [dummy] registered
[    0.250000] IXP4xx: Using 32MiB expansion bus window size
[    0.260000] PCI: IXP4xx is target - No bus scan performed
[    0.270000] PCI: IXP4xx Using direct access for memory space
[    0.290000] bio: create slab <bio-0> at 0
[    0.290000] usbcore: registered new interface driver usbfs
[    0.290000] usbcore: registered new interface driver hub
[    0.290000] usbcore: registered new device driver usb
[    0.290000] i2c-adapter i2c-0: adapter [IOP3xx-I2C] registered
[    0.300000] Switched to high resolution mode on CPU 0
[    0.300000] NET: Registered protocol family 2
[    0.300000] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.300000] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    0.300000] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[    0.300000] TCP: Hash tables configured (established 8192 bind 8192)
[    0.300000] TCP reno registered
[    0.300000] NET: Registered protocol family 1
[    2.850000] IXP4xx Queue Manager initialized.
[    2.860000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.860000] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    2.860000] aufs 2-31
[    2.860000] msgmni has been set to 496
[    2.860000] alg: No test for cipher_null (cipher_null-generic)
[    2.860000] alg: No test for ecb(cipher_null) (ecb-cipher_null)
[    2.860000] alg: No test for digest_null (digest_null-generic)
[    2.860000] alg: No test for compress_null (compress_null-generic)
[    2.870000] alg: No test for stdrng (krng)
[    2.870000] io scheduler noop registered (default)
[    3.380000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    3.390000] serial8250.0: ttyS0 at MMIO 0xc8000000 (irq = 15) is a XScale
[    3.390000] console [ttyS0] enabled
[    3.720000] serial8250.0: ttyS1 at MMIO 0xc8001000 (irq = 13) is a XScale
[    3.740000] IXP4xx MII Bus: probed
[    3.740000] eth0: MII PHY 3 on NPE-B
[    3.750000] usbcore: registered new interface driver usbserial
[    3.750000] USB Serial support registered for generic
[    3.760000] usbcore: registered new interface driver usbserial_generic
[    3.760000] usbserial: USB Serial Driver core
[    3.770000] pxa25x_udc: version 30-June-2007
[    3.770000] pxa25x_udc: unrecognized processor: 69054202
[    3.780000] i2c-core: driver [rtc-m41t80] registered
[    3.790000] i2c /dev entries driver
[    3.790000] i2c-core: driver [dev_driver] registered
[    3.800000] i2c-dev: adapter [IOP3xx-I2C] registered as minor 0
[    3.800000] i2c-core: driver [lm75] registered
[    3.830000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x48
[    3.840000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x48, len=0
[    3.840000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x48, len=1
[    3.850000] i2c-adapter i2c-0: master_xfer[1] R, addr=0x48, len=2
[    3.850000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x48, len=1
[    3.860000] i2c-adapter i2c-0: master_xfer[1] R, addr=0x48, len=1
[    3.870000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x48, len=1
[    3.870000] i2c-adapter i2c-0: master_xfer[1] R, addr=0x48, len=2
[    3.880000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x48, len=1
[    3.890000] i2c-adapter i2c-0: master_xfer[1] R, addr=0x48, len=2
[    3.890000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x49
[    3.900000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x49, len=0
[    3.910000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4a
[    3.910000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x4a, len=0
[    3.920000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4b
[    3.930000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x4b, len=0
[    3.930000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4c
[    3.940000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x4c, len=0
[    3.950000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4d
[    3.950000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x4d, len=0
[    3.960000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4e
[    3.970000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x4e, len=0
[    3.970000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4f
[    3.980000] i2c-adapter i2c-0: master_xfer[0] W, addr=0x4f, len=0
[    3.990000] IXP4xx Watchdog Timer: heartbeat 60 sec
[    3.990000] TCP cubic registered
[    3.990000] NET: Registered protocol family 10
[    4.000000] lo: Disabled Privacy Extensions
[    4.000000] NET: Registered protocol family 17
[    4.010000] Bridge firewalling registered
[    4.010000] RPC: Registered udp transport module.
[    4.020000] RPC: Registered tcp transport module.
[    4.020000] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
[    4.030000] All bugs added by David S. Miller <davem@redhat.com>
[    4.040000] XScale DSP coprocessor detected.
[    4.040000] start led_timer
[    4.050000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    4.050000] Freeing init memory: 1404K

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
Jon Ringle Sept. 25, 2009, 6:38 p.m. UTC | #4
Alexander:

On Fri, Sep 25, 2009 at 10:49 AM, Jon Ringle <jon@ringle.org> wrote:
> However, it still does not work with your patch. In the dump below I see:
> [    0.250000] i2c-core: driver [dummy] registered
> ...
> [    0.290000] i2c-adapter i2c-0: adapter [IOP3xx-I2C] registered
> ...
> [    3.780000] i2c-core: driver [rtc-m41t80] registered
[Note: missing i2c-adapter i2c-0 debug msgs expected when rtc-m41t80 probe]
> [    3.790000] i2c /dev entries driver
> [    3.790000] i2c-core: driver [dev_driver] registered
> [    3.800000] i2c-dev: adapter [IOP3xx-I2C] registered as minor 0
> [    3.800000] i2c-core: driver [lm75] registered
> [    3.830000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x48
> ...
> [    4.050000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

I think the problem is that rtc-m41t80 does not provide either of the following:
    struct i2c_driver: detect and address_data (both are null)
as required by i2c_detect()
  -> called by __attach_adapter()
  -> called by i2c_register_driver()
  -> called by i2c_add_driver()
  -> called by m41t80_rtc_init()

*or*
    struct i2c_driver: attach_adapter (null)
as required by __attach_adapter()
  -> called by i2c_register_driver()
  -> called by i2c_add_driver()
  -> called by m41t80_rtc_init()

Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
Jean Delvare Sept. 25, 2009, 6:45 p.m. UTC | #5
On Fri, 25 Sep 2009 14:38:39 -0400, Jon Ringle wrote:
> Alexander:
> 
> On Fri, Sep 25, 2009 at 10:49 AM, Jon Ringle <jon@ringle.org> wrote:
> > However, it still does not work with your patch. In the dump below I see:
> > [    0.250000] i2c-core: driver [dummy] registered
> > ...
> > [    0.290000] i2c-adapter i2c-0: adapter [IOP3xx-I2C] registered
> > ...
> > [    3.780000] i2c-core: driver [rtc-m41t80] registered
> [Note: missing i2c-adapter i2c-0 debug msgs expected when rtc-m41t80 probe]
> > [    3.790000] i2c /dev entries driver
> > [    3.790000] i2c-core: driver [dev_driver] registered
> > [    3.800000] i2c-dev: adapter [IOP3xx-I2C] registered as minor 0
> > [    3.800000] i2c-core: driver [lm75] registered
> > [    3.830000] i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x48
> > ...
> > [    4.050000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> 
> I think the problem is that rtc-m41t80 does not provide either of the following:
>     struct i2c_driver: detect and address_data (both are null)
> as required by i2c_detect()

This should be OK. detect and address_data are optional and only needed
for drivers which autodetect their devices. The rtc-m41t80 probably
doesn't want to do this. The device should be declared by the arch or
platform.

>   -> called by __attach_adapter()
>   -> called by i2c_register_driver()
>   -> called by i2c_add_driver()
>   -> called by m41t80_rtc_init()
> 
> *or*
>     struct i2c_driver: attach_adapter (null)

This legacy method no longer exists, so I certainly hope it isn't
implemented ;)

> as required by __attach_adapter()
>   -> called by i2c_register_driver()
>   -> called by i2c_add_driver()
>   -> called by m41t80_rtc_init()
Jon Ringle Sept. 25, 2009, 7:13 p.m. UTC | #6
On Fri, Sep 25, 2009 at 2:45 PM, Jean Delvare <khali@linux-fr.org> wrote:
> On Fri, 25 Sep 2009 14:38:39 -0400, Jon Ringle wrote:
>> I think the problem is that rtc-m41t80 does not provide either of the following:
>>     struct i2c_driver: detect and address_data (both are null)
>> as required by i2c_detect()
>
> This should be OK. detect and address_data are optional and only needed
> for drivers which autodetect their devices. The rtc-m41t80 probably
> doesn't want to do this. The device should be declared by the arch or
> platform.

Can you point me to an example of how one declares a i2c device?

Thanks,
Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
Jon Ringle Sept. 25, 2009, 8:19 p.m. UTC | #7
On Fri, Sep 25, 2009 at 3:13 PM, Jon Ringle <jon@ringle.org> wrote:
> Can you point me to an example of how one declares a i2c device?

I discovered i2c_register_board_info and friends, which I think is
what I'm looking for...

Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
Jon Ringle Sept. 25, 2009, 9:35 p.m. UTC | #8
On Sep 24, 11:19 am, Wolfram Sang <w.s...@pengutronix.de> wrote:
> Does this patch work for you? I can't test but made a similar one recently...

This patch was not necessary. My issue was fixed by declaring the i2c
devices in platform setup code using i2c_register_board_info() et al.

Thanks,
Jon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
diff mbox

Patch

=== snip

Subject: [PATCH] i2c-iop3xx: make bus available early

As I2C is used by PMICs also, make the busses available early via
subsys_initcall().

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

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

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index a75c75e..922fa3f 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -535,6 +535,7 @@  i2c_iop3xx_init (void)
 {
 	return platform_driver_register(&iop3xx_i2c_driver);
 }
+subsys_initcall(i2c_iop3xx_init);
 
 static void __exit 
 i2c_iop3xx_exit (void)
@@ -542,9 +543,7 @@  i2c_iop3xx_exit (void)
 	platform_driver_unregister(&iop3xx_i2c_driver);
 	return;
 }
-
-module_init (i2c_iop3xx_init);
-module_exit (i2c_iop3xx_exit);
+module_exit(i2c_iop3xx_exit);
 
 MODULE_AUTHOR("D-TACQ Solutions Ltd <www.d-tacq.com>");
 MODULE_DESCRIPTION("IOP3xx iic algorithm and driver");