Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2001 23:11:31 +0200
From:      Willem van Engen <wvengen@stack.nl>
To:        hackers@freebsd.org
Subject:   Re: driver: probe not called when smbus child
Message-ID:  <3AC25383.FE903E16@stack.nl>

next in thread | raw e-mail | index | archive | help
Nicolas Souchu wrote:
>
> On Tue, Mar 20, 2001 at 04:50:09PM +0100, Willem van Engen wrote:
> > I'm trying to write a module which should be a child of the smbus.
> > When I make the driver a child of the isa bus, identify, probe,
> > and attach functions are properly called. I use the following
> > code to do that:
> >   DRIVER_MODULE(my, isa, my_driver, my_devclass, 0, 0);
> > But when I put it on the smbus using
> >   DRIVER_MODULE(my, smbus, my_driver, my_devclass, 0, 0);
> > only identify is called. The identify function is as follows:
> >
> >   static void
> >   my_identify(driver_t *driver, device_t parent)
> >   {
> >       devclass_t dc;
> >       device_t child;
> >
> >       printf("my: my_identify called\n");
> >       dc = devclass_find("my");
> >       if (devclass_get_device(dc, 0)==NULL) {
> >           child = BUS_ADD_CHILD(parent, 0, "my", -1);
> >       }
> >   }
> >
> > The driver only uses smbus calls, so I think the best parent
> > would be smbus.
>
> I'm currently working on this.
>
> > And when I do a smbus_request_bus, the call waits forever as
> > it seems. That seems sensible to me, because it asks the
> > parent for the bus and the isa bus can't grant requests for
> > the smbus. So I think the driver has to be a child of the smbus.
>
> requesting the smbus is needed when the smbus controller potentially
> share resources on another bus (like lpbb(4) does on ppbus).
>
> > Looking in the kernel sources, I see that the only smbus child
> > I can find, smb, (if there are others, I'm certainly interested)
> > is attached in the smbus code itself. So the next question rises:
> > Is it possible to have an smbus child in a dynamically loadable
> > module (I can't find smbus.ko in /modules, so loading the child
> > first and then smbus isn't an option I guess) ?
>
> Currently, smb is the only smbus child. This is due to the fact that
> most people prefer programming their SMB chips from user space.
>
> I have a patch and a complete modules/i2c tree for compiling smbus and
> smb as modules. You must be interested... But I have to fix some issues
> like identification and driver dynamic addition.
Sure! Do you have the patch somewhere? For development, I could live
with changing the smbus driver to add my driver statically. The
driver currently works with parent_add_child in driver_identify, but
the system freezes regularly when about 2 smbus reads / sec are made.
Maybe I can find out more with your patch.
>
> --
> Nicolas.Souchu@fr.alcove.com
> Alcôve - Open Source Software Engineer - http://www.alcove.com
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3AC25383.FE903E16>