From owner-cvs-src@FreeBSD.ORG  Sun May 16 23:50:46 2004
Return-Path: <owner-cvs-src@FreeBSD.ORG>
Delivered-To: cvs-src@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 25D1016A4CE
	for <cvs-src@FreeBSD.org>; Sun, 16 May 2004 23:50:46 -0700 (PDT)
Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6299E43D62
	for <cvs-src@FreeBSD.org>; Sun, 16 May 2004 23:50:44 -0700 (PDT)
	(envelope-from jmg@hydrogen.funkthat.com)
Received: (qmail 19816 invoked from network); 17 May 2004 06:50:43 -0000
Received: from gate.funkthat.com (HELO hydrogen.funkthat.com) ([69.17.45.168])
          (envelope-sender <jmg@hydrogen.funkthat.com>)
          by mail1.speakeasy.net (qmail-ldap-1.03) with SMTP
          for <nate@root.org>; 17 May 2004 06:50:43 -0000
Received: from hydrogen.funkthat.com (oxqvcp@localhost.funkthat.com
	[127.0.0.1])i4H6ogEx004244;	Sun, 16 May 2004 23:50:43 -0700 (PDT)
	(envelope-from jmg@hydrogen.funkthat.com)
Received: (from jmg@localhost)
	by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id i4H6ofYT004243;
	Sun, 16 May 2004 23:50:41 -0700 (PDT)
Date: Sun, 16 May 2004 23:50:41 -0700
From: John-Mark Gurney <gurney_j@efn.org>
To: Nate Lawson <nate@root.org>
Message-ID: <20040517065041.GN601@funkthat.com>
References: <20040516211200.6651916A4D9@hub.freebsd.org>
	<20040516223701.K15923@root.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20040516223701.K15923@root.org>
User-Agent: Mutt/1.4.1i
X-Operating-System: FreeBSD 4.2-RELEASE i386
X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31  96 7A 22 B3 D8 56 36 F4
X-Files: The truth is out there
X-URL: http://resnet.uoregon.edu/~gurney_j/
X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html
cc: cvs-src@FreeBSD.org
cc: src-committers@FreeBSD.org
cc: cvs-all@FreeBSD.org
cc: Joerg Wunsch <joerg@FreeBSD.org>
Subject: Re: cvs commit: src/sys/dev/iicbus iicbus.c
X-BeenThere: cvs-src@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
Reply-To: John-Mark Gurney <gurney_j@efn.org>
List-Id: CVS commit messages for the src tree <cvs-src.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/cvs-src>,
	<mailto:cvs-src-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/cvs-src>
List-Post: <mailto:cvs-src@freebsd.org>
List-Help: <mailto:cvs-src-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/cvs-src>,
	<mailto:cvs-src-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 17 May 2004 06:50:46 -0000

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