ARM: s3c: make headers local if possible
[linux-2.6-microblaze.git] / arch / arm / mach-s3c / gpio-samsung-s3c24xx.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2008 Simtec Electronics
4  *      http://armlinux.simtec.co.uk/
5  *      Ben Dooks <ben@simtec.co.uk>
6  *
7  * S3C2410 - GPIO lib support
8  */
9
10 /* some boards require extra gpio capacity to support external
11  * devices that need GPIO.
12  */
13
14 #ifndef GPIO_SAMSUNG_S3C24XX_H
15 #define GPIO_SAMSUNG_S3C24XX_H
16
17 #include "map.h"
18
19 /*
20  * GPIO sizes for various SoCs:
21  *
22  *   2410 2412 2440 2443 2416
23  *             2442
24  *   ---- ---- ---- ---- ----
25  * A  23   22   25   16   27
26  * B  11   11   11   11   11
27  * C  16   16   16   16   16
28  * D  16   16   16   16   16
29  * E  16   16   16   16   16
30  * F  8    8    8    8    8
31  * G  16   16   16   16   8
32  * H  11   11   11   15   15
33  * J  --   --   13   16   --
34  * K  --   --   --   --   16
35  * L  --   --   --   15   14
36  * M  --   --   --   2    2
37  */
38
39 /* GPIO bank sizes */
40
41 #define S3C2410_GPIO_A_NR       (32)
42 #define S3C2410_GPIO_B_NR       (32)
43 #define S3C2410_GPIO_C_NR       (32)
44 #define S3C2410_GPIO_D_NR       (32)
45 #define S3C2410_GPIO_E_NR       (32)
46 #define S3C2410_GPIO_F_NR       (32)
47 #define S3C2410_GPIO_G_NR       (32)
48 #define S3C2410_GPIO_H_NR       (32)
49 #define S3C2410_GPIO_J_NR       (32)    /* technically 16. */
50 #define S3C2410_GPIO_K_NR       (32)    /* technically 16. */
51 #define S3C2410_GPIO_L_NR       (32)    /* technically 15. */
52 #define S3C2410_GPIO_M_NR       (32)    /* technically 2. */
53
54 #if CONFIG_S3C_GPIO_SPACE != 0
55 #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
56 #endif
57
58 #define S3C2410_GPIO_NEXT(__gpio) \
59         ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0)
60
61 #ifndef __ASSEMBLY__
62
63 enum s3c_gpio_number {
64         S3C2410_GPIO_A_START = 0,
65         S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A),
66         S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B),
67         S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C),
68         S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D),
69         S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
70         S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
71         S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
72         S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
73         S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J),
74         S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K),
75         S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L),
76 };
77
78 #endif /* __ASSEMBLY__ */
79
80 /* S3C2410 GPIO number definitions. */
81
82 #define S3C2410_GPA(_nr)        (S3C2410_GPIO_A_START + (_nr))
83 #define S3C2410_GPB(_nr)        (S3C2410_GPIO_B_START + (_nr))
84 #define S3C2410_GPC(_nr)        (S3C2410_GPIO_C_START + (_nr))
85 #define S3C2410_GPD(_nr)        (S3C2410_GPIO_D_START + (_nr))
86 #define S3C2410_GPE(_nr)        (S3C2410_GPIO_E_START + (_nr))
87 #define S3C2410_GPF(_nr)        (S3C2410_GPIO_F_START + (_nr))
88 #define S3C2410_GPG(_nr)        (S3C2410_GPIO_G_START + (_nr))
89 #define S3C2410_GPH(_nr)        (S3C2410_GPIO_H_START + (_nr))
90 #define S3C2410_GPJ(_nr)        (S3C2410_GPIO_J_START + (_nr))
91 #define S3C2410_GPK(_nr)        (S3C2410_GPIO_K_START + (_nr))
92 #define S3C2410_GPL(_nr)        (S3C2410_GPIO_L_START + (_nr))
93 #define S3C2410_GPM(_nr)        (S3C2410_GPIO_M_START + (_nr))
94
95 #ifdef CONFIG_CPU_S3C244X
96 #define S3C_GPIO_END    (S3C2410_GPJ(0) + 32)
97 #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
98 #define S3C_GPIO_END    (S3C2410_GPM(0) + 32)
99 #else
100 #define S3C_GPIO_END    (S3C2410_GPH(0) + 32)
101 #endif
102
103 #endif /* GPIO_SAMSUNG_S3C24XX_H */