Subject: Re: SMBus implementation
To: Michael <macallan18@earthlink.net>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: tech-kern
Date: 10/28/2005 21:45:10
On Fri, 2005-10-28 at 20:34 -0400, Michael wrote:
> Hello,
> 
> > I now have iic attaching to viapcib, but it just occurred to me that
> > to attach to iic I need to specify an 'addr'. How does isapnp@isa get
> > around this? Is it simply possible because ISA doesn't have strict
> > requirements on attach args? Will anybody scream bloody murder if I
> > make 'addr' optional in i2c_attach_args?
> 
> I'm not sure. Many iic devices have at least partially hardcoded
> addresses, usually you can choose between two by pulling a pin low or
> high.
> The problem is that these addresses aren't necessarily unique since the
> address space is pretty small and not all devices can be reliably probed
> ( you can check if /a/ device is there but you can't always be sure it
> really is what you're looking for )

In the SMBus world, compliant devices can be enumerated. This is why
'smbus@iic' is required (as simon said, similar to isapnp@isa); unless
'smbus' support is added directly into iic, but that would be just plain
wrong.

I guess the options are either:
 1. Allow 'addr' to be optional; regular I2C devices may fail to attach
if unspecified.
 2. Add a hack to i2cbus to only allow a "smbus" device to attach
without a specified addr.
 3. Add an 'iic_bus_find' (or similarly named) that looks for busses
attached to the iic, that doesn't use i2c_attach_args to attach to the
iic?

Cheers,
Jared