Subject: Re: New i2c framework
To: Ben Harris <bjh21@netbsd.org>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 07/28/2003 10:44:52
On Monday, July 28, 2003, at 10:31  AM, Ben Harris wrote:

> It seems to me that it ought to be possible to avoid the need for all 
> these
> functions that just call i2c_bitbang_* by having the latter take a 
> cookie
> that includes a reference to the relevant bbops structure.  I suppose 
> that
> just replaces code indirection with data indirection, though, so it 
> may not
> be worth the effort.

Well, I structured the code this way for two reasons:

	1. It's the way I structured the MII bit-bang module.

	2. On some platforms, it might be necessary to e.g. switch register
	   banks, turn off interrupts, or something else, for the duration of
	   the bit-bang operation.  This is essentially the reasons the MII
	   code is structured this way.  See sys/dev/ic/elinkxl.c, function
	   ex_mii_readreg() for an example of the bank-switching thing.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>