Re: [RFC] Add IO primitives for Wishbone bus

From: Arnd Bergmann
Date: Mon Oct 04 2010 - 04:37:53 EST


On Monday 04 October 2010 09:40:37 Jonas Bonn wrote:
> Is this an acceptable solution or is there another way that would be
> better? The problem at hand is how best to write a driver for a device
> when the device has the same endianess as the CPU and that endianess is
> arbitrary... for soft cores (OpenRISC in my case), this is a relevant problem,
> as the device endianess is determined along with the CPU core endianess
> at synthesis time...

Looks good in principle, the only possible problem I can see is if you
have both little-endian and big-endian wishbone devices in the same
system, which I assume could happen at some point.

If you want to be able to handle that cleanly, you should pass the device
into the accessor function as well.

It would also be good to provide a matching wb_iomap() function that
returns an iomem token you can use here (see pci_iomap).

A more complex implementation would detect the endianess at wb_iomap
time and return a token that encodes the endianess, which the regular
ioread/iowrite multiplexors can handle then. You probably don't need
to go that far, unless you expect wishbone to become ubiquitous in
the near future.

Arnd
--
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/