linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [rtc-linux] i2c/rtc init dependency problem
       [not found] ` <152584230909240758h674ffe3cw4d5e6baef5efc9b8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-09-24 15:19   ` Wolfram Sang
       [not found]     ` <8b192c78-6ebf-42ec-b334-756f56cc5400@g6g2000vbr.googlegroups.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-09-24 15:19 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw
  Cc: Ben Dooks, Alexander Bigga, Paul Gortmaker,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

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


Does this patch work for you? I can't test but made a similar one recently...

=== 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-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---

 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");
-- 
1.6.3.3


-- 
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: [rtc-linux] Re: i2c/rtc init dependency problem
       [not found]       ` <8b192c78-6ebf-42ec-b334-756f56cc5400-kR2RjjGg49OEYCl0FQ7J0FYGCWtFR9XvQQ4Iyu8u01E@public.gmane.org>
@ 2009-09-25  6:58         ` Wolfram Sang
       [not found]           ` <20090925065843.GA4125-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-09-25  6:58 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw
  Cc: jon-7zJyie9iPacdnm+yROfE0A, linux-i2c-u79uwXL29TY76Z2rM5mHXA

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


> 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

-- 
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: [rtc-linux] Re: i2c/rtc init dependency problem
       [not found]           ` <20090925065843.GA4125-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2009-09-25 14:49             ` Jon Ringle
       [not found]               ` <152584230909250749w305b5202tba55bfedd742fea9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Ringle @ 2009-09-25 14:49 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Fri, Sep 25, 2009 at 2:58 AM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 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-QuOWvOcGbXPmgbJ3gnzNPw@public.gmane.org) (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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
[    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

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

* Re: [rtc-linux] Re: i2c/rtc init dependency problem
       [not found]               ` <152584230909250749w305b5202tba55bfedd742fea9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-09-25 18:38                 ` Jon Ringle
       [not found]                   ` <152584230909251138r7051a279k71e10ac778e28742-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Ringle @ 2009-09-25 18:38 UTC (permalink / raw)
  To: Wolfram Sang, Alexander Bigga
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

Alexander:

On Fri, Sep 25, 2009 at 10:49 AM, Jon Ringle <jon-7zJyie9iPacdnm+yROfE0A@public.gmane.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

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

* Re: [rtc-linux] Re: i2c/rtc init dependency problem
       [not found]                   ` <152584230909251138r7051a279k71e10ac778e28742-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-09-25 18:45                     ` Jean Delvare
       [not found]                       ` <20090925204533.69681f35-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Delvare @ 2009-09-25 18:45 UTC (permalink / raw)
  To: Jon Ringle
  Cc: Wolfram Sang, Alexander Bigga, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

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-7zJyie9iPacdnm+yROfE0A@public.gmane.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()

-- 
Jean Delvare

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

* Re: [rtc-linux] Re: i2c/rtc init dependency problem
       [not found]                       ` <20090925204533.69681f35-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-09-25 19:13                         ` Jon Ringle
       [not found]                           ` <152584230909251213l8f9663eo39151206e9ec8cd4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Ringle @ 2009-09-25 19:13 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Wolfram Sang, Alexander Bigga, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Fri, Sep 25, 2009 at 2:45 PM, Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.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

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

* Re: [rtc-linux] Re: i2c/rtc init dependency problem
       [not found]                           ` <152584230909251213l8f9663eo39151206e9ec8cd4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-09-25 20:19                             ` Jon Ringle
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Ringle @ 2009-09-25 20:19 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Wolfram Sang, Alexander Bigga, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Fri, Sep 25, 2009 at 3:13 PM, Jon Ringle <jon-7zJyie9iPacdnm+yROfE0A@public.gmane.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

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

end of thread, other threads:[~2009-09-25 20:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <152584230909240758h674ffe3cw4d5e6baef5efc9b8@mail.gmail.com>
     [not found] ` <152584230909240758h674ffe3cw4d5e6baef5efc9b8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-24 15:19   ` [rtc-linux] i2c/rtc init dependency problem Wolfram Sang
     [not found]     ` <8b192c78-6ebf-42ec-b334-756f56cc5400@g6g2000vbr.googlegroups.com>
     [not found]       ` <8b192c78-6ebf-42ec-b334-756f56cc5400-kR2RjjGg49OEYCl0FQ7J0FYGCWtFR9XvQQ4Iyu8u01E@public.gmane.org>
2009-09-25  6:58         ` [rtc-linux] " Wolfram Sang
     [not found]           ` <20090925065843.GA4125-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-09-25 14:49             ` Jon Ringle
     [not found]               ` <152584230909250749w305b5202tba55bfedd742fea9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-25 18:38                 ` Jon Ringle
     [not found]                   ` <152584230909251138r7051a279k71e10ac778e28742-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-25 18:45                     ` Jean Delvare
     [not found]                       ` <20090925204533.69681f35-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-25 19:13                         ` Jon Ringle
     [not found]                           ` <152584230909251213l8f9663eo39151206e9ec8cd4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-25 20:19                             ` Jon Ringle

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).