Re: Being more anal about iospace accesses..

From: Linus Torvalds
Date: Wed Sep 15 2004 - 17:56:54 EST




On Wed, 15 Sep 2004, Deepak Saxena wrote:
>
> Since we are on the subject of io-access, I would like a
> clarification/opinion on the read*/write* & in*/out* accessors
> (and now the ioread/write equivalents). Are these functions only meant
> to be used for PCI memory-mapped devices or _any_ memory mapped devices?

It really depends on the bus architecture.

At some point, if the bus is different enough from a "normal" setup, you
should just use your own accessor functions. Trying to overload
"readl/writel" is just too painful.

However, at that point you should also realize that you can't re-use _any_
of the existing chip drivers, and you'll have to write your own. If the
bus is exotic enough, that's not a problem, and you'd have to do that
anyway. But there really aren't all that many "exotic" buses around any
more.

Quite frankly, of your two suggested interfaces, I would select neither.
I'd just say that if your bus is special enough, just write your own
drivers, and use

cookie = ixp4xx_iomap(dev, xx);
...
ixp4xx_iowrite(val, cookie + offset);

which is perfectly valid. You don't have to make these devices even _look_
like a PCI device. Why should you?

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/