GNU Linux-libre 4.9.332-gnu1
[releases.git] / arch / arm / mach-s3c64xx / include / mach / gpio-samsung.h
1 /*
2  * Copyright 2008 Openmoko, Inc.
3  * Copyright 2008 Simtec Electronics
4  *      http://armlinux.simtec.co.uk/
5  *      Ben Dooks <ben@simtec.co.uk>
6  *
7  * S3C6400 - GPIO lib support
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12 */
13
14 #ifndef GPIO_SAMSUNG_S3C64XX_H
15 #define GPIO_SAMSUNG_S3C64XX_H
16
17 #ifdef CONFIG_GPIO_SAMSUNG
18
19 /* GPIO bank sizes */
20 #define S3C64XX_GPIO_A_NR       (8)
21 #define S3C64XX_GPIO_B_NR       (7)
22 #define S3C64XX_GPIO_C_NR       (8)
23 #define S3C64XX_GPIO_D_NR       (5)
24 #define S3C64XX_GPIO_E_NR       (5)
25 #define S3C64XX_GPIO_F_NR       (16)
26 #define S3C64XX_GPIO_G_NR       (7)
27 #define S3C64XX_GPIO_H_NR       (10)
28 #define S3C64XX_GPIO_I_NR       (16)
29 #define S3C64XX_GPIO_J_NR       (12)
30 #define S3C64XX_GPIO_K_NR       (16)
31 #define S3C64XX_GPIO_L_NR       (15)
32 #define S3C64XX_GPIO_M_NR       (6)
33 #define S3C64XX_GPIO_N_NR       (16)
34 #define S3C64XX_GPIO_O_NR       (16)
35 #define S3C64XX_GPIO_P_NR       (15)
36 #define S3C64XX_GPIO_Q_NR       (9)
37
38 /* GPIO bank numbes */
39
40 /* CONFIG_S3C_GPIO_SPACE allows the user to select extra
41  * space for debugging purposes so that any accidental
42  * change from one gpio bank to another can be caught.
43 */
44
45 #define S3C64XX_GPIO_NEXT(__gpio) \
46         ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
47
48 enum s3c_gpio_number {
49         S3C64XX_GPIO_A_START = 0,
50         S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
51         S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
52         S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
53         S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
54         S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
55         S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
56         S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
57         S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
58         S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
59         S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
60         S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
61         S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
62         S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
63         S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
64         S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
65         S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
66 };
67
68 /* S3C64XX GPIO number definitions. */
69
70 #define S3C64XX_GPA(_nr)        (S3C64XX_GPIO_A_START + (_nr))
71 #define S3C64XX_GPB(_nr)        (S3C64XX_GPIO_B_START + (_nr))
72 #define S3C64XX_GPC(_nr)        (S3C64XX_GPIO_C_START + (_nr))
73 #define S3C64XX_GPD(_nr)        (S3C64XX_GPIO_D_START + (_nr))
74 #define S3C64XX_GPE(_nr)        (S3C64XX_GPIO_E_START + (_nr))
75 #define S3C64XX_GPF(_nr)        (S3C64XX_GPIO_F_START + (_nr))
76 #define S3C64XX_GPG(_nr)        (S3C64XX_GPIO_G_START + (_nr))
77 #define S3C64XX_GPH(_nr)        (S3C64XX_GPIO_H_START + (_nr))
78 #define S3C64XX_GPI(_nr)        (S3C64XX_GPIO_I_START + (_nr))
79 #define S3C64XX_GPJ(_nr)        (S3C64XX_GPIO_J_START + (_nr))
80 #define S3C64XX_GPK(_nr)        (S3C64XX_GPIO_K_START + (_nr))
81 #define S3C64XX_GPL(_nr)        (S3C64XX_GPIO_L_START + (_nr))
82 #define S3C64XX_GPM(_nr)        (S3C64XX_GPIO_M_START + (_nr))
83 #define S3C64XX_GPN(_nr)        (S3C64XX_GPIO_N_START + (_nr))
84 #define S3C64XX_GPO(_nr)        (S3C64XX_GPIO_O_START + (_nr))
85 #define S3C64XX_GPP(_nr)        (S3C64XX_GPIO_P_START + (_nr))
86 #define S3C64XX_GPQ(_nr)        (S3C64XX_GPIO_Q_START + (_nr))
87
88 /* the end of the S3C64XX specific gpios */
89 #define S3C64XX_GPIO_END        (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
90 #define S3C_GPIO_END            S3C64XX_GPIO_END
91
92 /* define the number of gpios we need to the one after the GPQ() range */
93 #define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
94
95 #endif /* GPIO_SAMSUNG */
96 #endif /* GPIO_SAMSUNG_S3C64XX_H */
97