tree-wide: fix assorted typos all over the place
[linux-block.git] / arch / arm / mach-lh7a40x / include / mach / hardware.h
CommitLineData
a09e64fb 1/* arch/arm/mach-lh7a40x/include/mach/hardware.h
1da177e4
LT
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 *
a09e64fb 5 * [ Substantially cribbed from arch/arm/mach-pxa/include/mach/hardware.h ]
1da177e4
LT
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 */
12
13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H
15
2295196c
MS
16#include <asm/sizes.h> /* Added for the sake of amba-clcd driver */
17
1da177e4
LT
18#define io_p2v(x) (0xf0000000 | (((x) & 0xfff00000) >> 4) | ((x) & 0x0000ffff))
19#define io_v2p(x) ( (((x) & 0x0fff0000) << 4) | ((x) & 0x0000ffff))
20
21#ifdef __ASSEMBLY__
22
23# define __REG(x) io_p2v(x)
24# define __PREG(x) io_v2p(x)
25
26#else
27
28# if 0
29# define __REG(x) (*((volatile u32 *)io_p2v(x)))
30# else
31/*
32 * This __REG() version gives the same results as the one above, except
33 * that we are fooling gcc somehow so it generates far better and smaller
af901ca1 34 * assembly code for access to contiguous registers. It's a shame that gcc
1da177e4
LT
35 * doesn't guess this by itself.
36 */
37#include <asm/types.h>
38typedef struct { volatile u32 offset[4096]; } __regbase;
39# define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
40# define __REG(x) __REGP(io_p2v(x))
41typedef struct { volatile u16 offset[4096]; } __regbase16;
42# define __REGP16(x) ((__regbase16 *)((x)&~4095))->offset[((x)&4095)>>1]
43# define __REG16(x) __REGP16(io_p2v(x))
44typedef struct { volatile u8 offset[4096]; } __regbase8;
45# define __REGP8(x) ((__regbase8 *)((x)&~4095))->offset[(x)&4095]
46# define __REG8(x) __REGP8(io_p2v(x))
47#endif
48
49/* Let's kick gcc's ass again... */
50# define __REG2(x,y) \
51 ( __builtin_constant_p(y) ? (__REG((x) + (y))) \
52 : (*(volatile u32 *)((u32)&__REG(x) + (y))) )
53
54# define __PREG(x) (io_v2p((u32)&(x)))
55
56#endif
57
2295196c
MS
58#define MASK_AND_SET(v,m,s) (v) = ((v)&~(m))|(s)
59
1da177e4
LT
60#include "registers.h"
61
62#endif /* _ASM_ARCH_HARDWARE_H */