Subject: Re: SMBus implementation
To: Jared D. McNeill <jmcneill@invisible.ca>
From: Allen Briggs <briggs@netbsd.org>
List: tech-kern
Date: 10/28/2005 23:28:20
On Fri, Oct 28, 2005 at 11:46:30PM -0300, Jared D. McNeill wrote:
> The only downside that I can think of is that an smbus-compliant device
> might try to attach to a non-SMBus i2c host driver. smbus(4) children
> should only be allowed to speak "SMBus", not "I2C", to the target IC.

OK.  Thinking about this a bit more, I get stuck unless we define
smbus and attach smbus devices to either smbus directly-configured
or iic indirectly-configured.

As you know, the i2c devices aren't smart and will just match if
the address matches (or in the case of Michael's, if the match
function is called at all).

smbus devices have a standard mfg/dev in regs 0xfe/0xff, right?
So the match functions for these would presumably compare these
ids against a constant/list.

So I'd really be inclined to go the route of providing iic and
smbus attachments for smbus devices and make an smbus_attach_args
that looks something like:

	struct smbus_attach_args {
		struct i2c_attach_args	sma_ia;
		u_int8_t		sma_mfgid;
		u_int8_t		sma_devid;
	};

So the attach functions could be shared between smbus and iic,
but they would need separate match functions, cfattach_decl, etc.
It seems a little more than necessary, but I don't see a way
around it at the moment.

-allen

-- 
                  Use NetBSD!  http://www.NetBSD.org/