cvs commit: src/sys/dev/iicbus iicbus.c

John-Mark Gurney gurney_j at efn.org
Sun May 16 23:50:46 PDT 2004


Nate Lawson wrote this message on Sun, May 16, 2004 at 22:41 -0700:
> On Sun, 16 May 2004, Joerg Wunsch wrote:
> > joerg       2004/05/16 14:11:46 PDT
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     sys/dev/iicbus       iicbus.c
> >   Log:
> >   After successfully attaching an iicbus instance, instead of using a
> >   NULL name in device_add_child(), explicitly name all of our known
> >   child drivers in order to give them a chance to attach to us.
> >   Otherwise, only the first one present would be probed and attached.
> >
> >   Reviewed by:    nsouch
> >   MFC after:      1 month
> >
> >   Revision  Changes    Path
> >   1.19      +3 -1      src/sys/dev/iicbus/iicbus.c
> >
> > --- src/sys/dev/iicbus/iicbus.c:1.18	Wed May 12 06:43:41 2004
> > +++ src/sys/dev/iicbus/iicbus.c	Sun May 16 14:11:46 2004
> > @@ -140,7 +140,9 @@
> >  #endif
> >
> >  	/* attach any known device */
> > -	device_add_child(dev, NULL, -1);
> > +	device_add_child(dev, "ic", -1);
> > +	device_add_child(dev, "iic", -1);
> > +	device_add_child(dev, "iicsmb", -1);
> >
> >  	bus_generic_attach(dev);
> 
> Can more than one of these be active at a time?  Or are they different
> implementations of the same thing?  If this is the case, it's better to
> add one child and have the ic, iic, and iicsmb drivers all probe it and
> return negative values in order of preference for the device.  Or if the
> child drivers can tell whether or not they're present, use an identify
> method to let them detect themselves.

Yes, more than one of these can be active at the same time...

What really needs to happen is iic to be taught about the resource
which is chip id... then some of the problems of identify and multiple
probes can go away...

Currently there is no code in the iicbus to prevent two chips from
attaching to the same i2c bus address causing possible problems...

If someone is interested in learning some newbus/resource code, I can
provide some pointers on what the general design should look like...

/me who fought with the problem of multiple probing i2c devices when
writing the Zoran driver.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the cvs-src mailing list