Subject: Re: OHCI question...
To: Masao Uebayashi <uebayasi@brains.co.jp>
From: Lennart Augustsson <lennart@augustsson.net>
List: tech-kern
Date: 11/01/2005 10:15:22
Masao Uebayashi wrote:
> Hi!  We have a similar patch for MPC5200 in a local tree, where
> registers are big-endian.
> 
> 
>>1) add logic to ohci.c to support run-time conditionalized byte 
>>swapping.  Probably via a function pointer in the softc, this would 
>>work, but might be a little bit slower.  (I'd conditionalize this 
>>support via a new OHCI_NATIVE_ORDER or somesuch.)
> 
> 
> I'm in favor of this approach.
> 

I do too.  Having another version of the driver seems wrong.

But I wouldn't want to penalize ports that don't require dynamic
swapping either.  You could define some new swapping macros
OHTOLE32() and OLE32TOH() that can be defined to either the
usual swapping functions if the conditional swapper.

Furthermore, those macros could have the conditional test inside
them so there doesn't have to be a function call for each swap.
(Assuming there is a performance problem.  I actually doubt there
is.)

	-- Lennart