Re: [PATCH] fix ppc ioremap prototype

Jes Sorensen
2003-09-04T16:37:13Z

>>>>> "Deepak" == Deepak Saxena <dsaxena@mvista.com> writes:

Deepak> What happens if I have a device that can be either ISA or
Deepak> connected directly to a local memory bus? The driver should be
Deepak> able to ioremap(some resource) and then read/write the device
Deepak> without having to have ugly #ifdefs to deal with different bus
Deepak> types.

You can't do that reliably, some architectures requires different
access for ISA vs PCI vs random-other busses. The driver needs to be
aware what bus it's trying to go through.

Deepak> Example in point is the CS8900a device which is hooked
Deepak> up directly to a FPGA on the local memory bus with the
Deepak> bytelanes backwards. The ammount of hacking done in the
Deepak> driver to get around that is ugly. It would be much nicer if
Deepak> the driver still just did read*/write* and the platform level
Deepak> code could deal with all the translation issues. This requires
Deepak> a generic API for all I/O devices.

That might be nicer from the driver perspective but it will make
readb/writeb a lot more complex and inefficient for no reason on some
architectures.

The driver will have to know whether it's on a PCI, ISA or directly
attached anyway when it's probing so it's perfectly reasonable to
expect it to deal with that when it's accessing the registers as well.

Cheers,
Jes