diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2005-09-15 08:00:25 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-09-15 08:00:25 -0400 |
commit | 917afce1000d978dfd3f07da5da9d864bc49c77e (patch) | |
tree | fd8487f4cf64dc5be9559820a1f4c3e6c759aad2 /include/asm-arm | |
parent | fea2efe3bba15f0aa8f840fbe052699808187cb6 (diff) |
[ARM] 2911/1: ixp2000_reg_{read,write} accessors
Patch from Lennert Buytenhek
This patch:
- changes the ixp2000_reg_write accessor to take a 'volatile void *'
instead of a 'volatile unsigned long *', which then allows passing in
a u32 * as first argument without being greeted with a warning; and
- adds an ixp2000_reg_read accessor.
We can then use these accessors in ixp2000 code to access on-chip
peripherals, instead of directly dereferencing pointers. This is for
use by the ixp2000 microengine driver which was recently announced on
netdev. We can't use readl/writel on the ixp2000 since it is usually
run in big-endian mode, and on big-endian platforms, readl/writel
perform byteswapping.
A future patch will remove the readback from ixp2000_reg_write, since
it's not needed to prevent erratum #66, and add manual readbacks to the
places that need them (writes are not synchronous since we map in device
space using XCB=101 nowadays), such as interrupt disabling and GPIO
manipulation. See also:
http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2005-February/027084.html
Patch has been ACKed by Jeff Garzik.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm')
-rw-r--r-- | include/asm-arm/arch-ixp2000/platform.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h index c0caf3e3e6fd..6519498dbe25 100644 --- a/include/asm-arm/arch-ixp2000/platform.h +++ b/include/asm-arm/arch-ixp2000/platform.h | |||
@@ -31,20 +31,24 @@ | |||
31 | 31 | ||
32 | #include <asm/system.h> /* Pickup local_irq_ functions */ | 32 | #include <asm/system.h> /* Pickup local_irq_ functions */ |
33 | 33 | ||
34 | static inline void ixp2000_reg_write(volatile unsigned long *reg, unsigned long val) | 34 | static inline void ixp2000_reg_write(volatile void *reg, unsigned long val) |
35 | { | 35 | { |
36 | volatile unsigned long dummy; | 36 | unsigned long dummy; |
37 | unsigned long flags; | 37 | unsigned long flags; |
38 | 38 | ||
39 | local_irq_save(flags); | 39 | local_irq_save(flags); |
40 | *reg = val; | 40 | *((volatile unsigned long *)reg) = val; |
41 | barrier(); | 41 | barrier(); |
42 | dummy = *reg; | 42 | dummy = *((volatile unsigned long *)reg); |
43 | local_irq_restore(flags); | 43 | local_irq_restore(flags); |
44 | } | 44 | } |
45 | #else | 45 | #else |
46 | #define ixp2000_reg_write(reg, val) (*reg = val) | 46 | static inline void ixp2000_reg_write(volatile void *reg, unsigned long val) |
47 | { | ||
48 | *((volatile unsigned long *)reg) = val; | ||
49 | } | ||
47 | #endif /* IXDP2400 || IXDP2401 */ | 50 | #endif /* IXDP2400 || IXDP2401 */ |
51 | #define ixp2000_reg_read(reg) (*((volatile unsigned long *)reg)) | ||
48 | 52 | ||
49 | /* | 53 | /* |
50 | * Boards may multiplex different devices on the 2nd channel of | 54 | * Boards may multiplex different devices on the 2nd channel of |