Merge branch 'upstream/core' into upstream/xen
[sfrench/cifs-2.6.git] / arch / arm / mach-s5pv210 / include / mach / gpio.h
1 /* linux/arch/arm/mach-s5pv210/include/mach/gpio.h
2  *
3  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com/
5  *
6  * S5PV210 - GPIO lib support
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11 */
12
13 #ifndef __ASM_ARCH_GPIO_H
14 #define __ASM_ARCH_GPIO_H __FILE__
15
16 #define gpio_get_value  __gpio_get_value
17 #define gpio_set_value  __gpio_set_value
18 #define gpio_cansleep   __gpio_cansleep
19 #define gpio_to_irq     __gpio_to_irq
20
21 /* Practically, GPIO banks upto MP03 are the configurable gpio banks */
22
23 /* GPIO bank sizes */
24 #define S5PV210_GPIO_A0_NR      (8)
25 #define S5PV210_GPIO_A1_NR      (4)
26 #define S5PV210_GPIO_B_NR       (8)
27 #define S5PV210_GPIO_C0_NR      (5)
28 #define S5PV210_GPIO_C1_NR      (5)
29 #define S5PV210_GPIO_D0_NR      (4)
30 #define S5PV210_GPIO_D1_NR      (6)
31 #define S5PV210_GPIO_E0_NR      (8)
32 #define S5PV210_GPIO_E1_NR      (5)
33 #define S5PV210_GPIO_F0_NR      (8)
34 #define S5PV210_GPIO_F1_NR      (8)
35 #define S5PV210_GPIO_F2_NR      (8)
36 #define S5PV210_GPIO_F3_NR      (6)
37 #define S5PV210_GPIO_G0_NR      (7)
38 #define S5PV210_GPIO_G1_NR      (7)
39 #define S5PV210_GPIO_G2_NR      (7)
40 #define S5PV210_GPIO_G3_NR      (7)
41 #define S5PV210_GPIO_H0_NR      (8)
42 #define S5PV210_GPIO_H1_NR      (8)
43 #define S5PV210_GPIO_H2_NR      (8)
44 #define S5PV210_GPIO_H3_NR      (8)
45 #define S5PV210_GPIO_I_NR       (7)
46 #define S5PV210_GPIO_J0_NR      (8)
47 #define S5PV210_GPIO_J1_NR      (6)
48 #define S5PV210_GPIO_J2_NR      (8)
49 #define S5PV210_GPIO_J3_NR      (8)
50 #define S5PV210_GPIO_J4_NR      (5)
51
52 #define S5PV210_GPIO_MP01_NR    (8)
53 #define S5PV210_GPIO_MP02_NR    (4)
54 #define S5PV210_GPIO_MP03_NR    (8)
55
56 /* GPIO bank numbers */
57
58 /* CONFIG_S3C_GPIO_SPACE allows the user to select extra
59  * space for debugging purposes so that any accidental
60  * change from one gpio bank to another can be caught.
61 */
62
63 #define S5PV210_GPIO_NEXT(__gpio) \
64         ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
65
66 enum s5p_gpio_number {
67         S5PV210_GPIO_A0_START   = 0,
68         S5PV210_GPIO_A1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_A0),
69         S5PV210_GPIO_B_START    = S5PV210_GPIO_NEXT(S5PV210_GPIO_A1),
70         S5PV210_GPIO_C0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_B),
71         S5PV210_GPIO_C1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_C0),
72         S5PV210_GPIO_D0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_C1),
73         S5PV210_GPIO_D1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_D0),
74         S5PV210_GPIO_E0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_D1),
75         S5PV210_GPIO_E1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_E0),
76         S5PV210_GPIO_F0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_E1),
77         S5PV210_GPIO_F1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_F0),
78         S5PV210_GPIO_F2_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_F1),
79         S5PV210_GPIO_F3_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_F2),
80         S5PV210_GPIO_G0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_F3),
81         S5PV210_GPIO_G1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_G0),
82         S5PV210_GPIO_G2_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_G1),
83         S5PV210_GPIO_G3_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_G2),
84         S5PV210_GPIO_H0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_G3),
85         S5PV210_GPIO_H1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_H0),
86         S5PV210_GPIO_H2_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_H1),
87         S5PV210_GPIO_H3_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_H2),
88         S5PV210_GPIO_I_START    = S5PV210_GPIO_NEXT(S5PV210_GPIO_H3),
89         S5PV210_GPIO_J0_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_I),
90         S5PV210_GPIO_J1_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_J0),
91         S5PV210_GPIO_J2_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_J1),
92         S5PV210_GPIO_J3_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_J2),
93         S5PV210_GPIO_J4_START   = S5PV210_GPIO_NEXT(S5PV210_GPIO_J3),
94         S5PV210_GPIO_MP01_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J4),
95         S5PV210_GPIO_MP02_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP01),
96         S5PV210_GPIO_MP03_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP02),
97 };
98
99 /* S5PV210 GPIO number definitions */
100 #define S5PV210_GPA0(_nr)       (S5PV210_GPIO_A0_START + (_nr))
101 #define S5PV210_GPA1(_nr)       (S5PV210_GPIO_A1_START + (_nr))
102 #define S5PV210_GPB(_nr)        (S5PV210_GPIO_B_START + (_nr))
103 #define S5PV210_GPC0(_nr)       (S5PV210_GPIO_C0_START + (_nr))
104 #define S5PV210_GPC1(_nr)       (S5PV210_GPIO_C1_START + (_nr))
105 #define S5PV210_GPD0(_nr)       (S5PV210_GPIO_D0_START + (_nr))
106 #define S5PV210_GPD1(_nr)       (S5PV210_GPIO_D1_START + (_nr))
107 #define S5PV210_GPE0(_nr)       (S5PV210_GPIO_E0_START + (_nr))
108 #define S5PV210_GPE1(_nr)       (S5PV210_GPIO_E1_START + (_nr))
109 #define S5PV210_GPF0(_nr)       (S5PV210_GPIO_F0_START + (_nr))
110 #define S5PV210_GPF1(_nr)       (S5PV210_GPIO_F1_START + (_nr))
111 #define S5PV210_GPF2(_nr)       (S5PV210_GPIO_F2_START + (_nr))
112 #define S5PV210_GPF3(_nr)       (S5PV210_GPIO_F3_START + (_nr))
113 #define S5PV210_GPG0(_nr)       (S5PV210_GPIO_G0_START + (_nr))
114 #define S5PV210_GPG1(_nr)       (S5PV210_GPIO_G1_START + (_nr))
115 #define S5PV210_GPG2(_nr)       (S5PV210_GPIO_G2_START + (_nr))
116 #define S5PV210_GPG3(_nr)       (S5PV210_GPIO_G3_START + (_nr))
117 #define S5PV210_GPH0(_nr)       (S5PV210_GPIO_H0_START + (_nr))
118 #define S5PV210_GPH1(_nr)       (S5PV210_GPIO_H1_START + (_nr))
119 #define S5PV210_GPH2(_nr)       (S5PV210_GPIO_H2_START + (_nr))
120 #define S5PV210_GPH3(_nr)       (S5PV210_GPIO_H3_START + (_nr))
121 #define S5PV210_GPI(_nr)        (S5PV210_GPIO_I_START + (_nr))
122 #define S5PV210_GPJ0(_nr)       (S5PV210_GPIO_J0_START + (_nr))
123 #define S5PV210_GPJ1(_nr)       (S5PV210_GPIO_J1_START + (_nr))
124 #define S5PV210_GPJ2(_nr)       (S5PV210_GPIO_J2_START + (_nr))
125 #define S5PV210_GPJ3(_nr)       (S5PV210_GPIO_J3_START + (_nr))
126 #define S5PV210_GPJ4(_nr)       (S5PV210_GPIO_J4_START + (_nr))
127 #define S5PV210_MP01(_nr)       (S5PV210_GPIO_MP01_START + (_nr))
128 #define S5PV210_MP02(_nr)       (S5PV210_GPIO_MP02_START + (_nr))
129 #define S5PV210_MP03(_nr)       (S5PV210_GPIO_MP03_START + (_nr))
130
131 /* the end of the S5PV210 specific gpios */
132 #define S5PV210_GPIO_END        (S5PV210_MP03(S5PV210_GPIO_MP03_NR) + 1)
133 #define S3C_GPIO_END            S5PV210_GPIO_END
134
135 /* define the number of gpios we need to the one after the MP03() range */
136 #define ARCH_NR_GPIOS           (S5PV210_MP03(S5PV210_GPIO_MP03_NR) +   \
137                                  CONFIG_SAMSUNG_GPIO_EXTRA + 1)
138
139 #include <asm-generic/gpio.h>
140
141 #endif /* __ASM_ARCH_GPIO_H */