Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-exynos4/include/mach/gpio.h |
| 2 | * |
| 3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com |
| 5 | * |
| 6 | * EXYNOS4 - 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 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 16 | /* Practically, GPIO banks up to GPZ are the configurable gpio banks */ |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 17 | |
| 18 | /* GPIO bank sizes */ |
| 19 | #define EXYNOS4_GPIO_A0_NR (8) |
| 20 | #define EXYNOS4_GPIO_A1_NR (6) |
| 21 | #define EXYNOS4_GPIO_B_NR (8) |
| 22 | #define EXYNOS4_GPIO_C0_NR (5) |
| 23 | #define EXYNOS4_GPIO_C1_NR (5) |
| 24 | #define EXYNOS4_GPIO_D0_NR (4) |
| 25 | #define EXYNOS4_GPIO_D1_NR (4) |
| 26 | #define EXYNOS4_GPIO_E0_NR (5) |
| 27 | #define EXYNOS4_GPIO_E1_NR (8) |
| 28 | #define EXYNOS4_GPIO_E2_NR (6) |
| 29 | #define EXYNOS4_GPIO_E3_NR (8) |
| 30 | #define EXYNOS4_GPIO_E4_NR (8) |
| 31 | #define EXYNOS4_GPIO_F0_NR (8) |
| 32 | #define EXYNOS4_GPIO_F1_NR (8) |
| 33 | #define EXYNOS4_GPIO_F2_NR (8) |
| 34 | #define EXYNOS4_GPIO_F3_NR (6) |
| 35 | #define EXYNOS4_GPIO_J0_NR (8) |
| 36 | #define EXYNOS4_GPIO_J1_NR (5) |
| 37 | #define EXYNOS4_GPIO_K0_NR (7) |
| 38 | #define EXYNOS4_GPIO_K1_NR (7) |
| 39 | #define EXYNOS4_GPIO_K2_NR (7) |
| 40 | #define EXYNOS4_GPIO_K3_NR (7) |
| 41 | #define EXYNOS4_GPIO_L0_NR (8) |
| 42 | #define EXYNOS4_GPIO_L1_NR (3) |
| 43 | #define EXYNOS4_GPIO_L2_NR (8) |
| 44 | #define EXYNOS4_GPIO_X0_NR (8) |
| 45 | #define EXYNOS4_GPIO_X1_NR (8) |
| 46 | #define EXYNOS4_GPIO_X2_NR (8) |
| 47 | #define EXYNOS4_GPIO_X3_NR (8) |
Marek Szyprowski | 47a9c0e | 2011-03-15 21:17:43 +0900 | [diff] [blame] | 48 | #define EXYNOS4_GPIO_Y0_NR (6) |
| 49 | #define EXYNOS4_GPIO_Y1_NR (4) |
| 50 | #define EXYNOS4_GPIO_Y2_NR (6) |
| 51 | #define EXYNOS4_GPIO_Y3_NR (8) |
| 52 | #define EXYNOS4_GPIO_Y4_NR (8) |
| 53 | #define EXYNOS4_GPIO_Y5_NR (8) |
| 54 | #define EXYNOS4_GPIO_Y6_NR (8) |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 55 | #define EXYNOS4_GPIO_Z_NR (7) |
| 56 | |
| 57 | /* GPIO bank numbers */ |
| 58 | |
| 59 | #define EXYNOS4_GPIO_NEXT(__gpio) \ |
| 60 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1) |
| 61 | |
| 62 | enum s5p_gpio_number { |
| 63 | EXYNOS4_GPIO_A0_START = 0, |
| 64 | EXYNOS4_GPIO_A1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A0), |
| 65 | EXYNOS4_GPIO_B_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A1), |
| 66 | EXYNOS4_GPIO_C0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_B), |
| 67 | EXYNOS4_GPIO_C1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C0), |
| 68 | EXYNOS4_GPIO_D0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C1), |
| 69 | EXYNOS4_GPIO_D1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D0), |
| 70 | EXYNOS4_GPIO_E0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D1), |
| 71 | EXYNOS4_GPIO_E1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E0), |
| 72 | EXYNOS4_GPIO_E2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E1), |
| 73 | EXYNOS4_GPIO_E3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E2), |
| 74 | EXYNOS4_GPIO_E4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E3), |
| 75 | EXYNOS4_GPIO_F0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E4), |
| 76 | EXYNOS4_GPIO_F1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F0), |
| 77 | EXYNOS4_GPIO_F2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F1), |
| 78 | EXYNOS4_GPIO_F3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F2), |
| 79 | EXYNOS4_GPIO_J0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F3), |
| 80 | EXYNOS4_GPIO_J1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J0), |
| 81 | EXYNOS4_GPIO_K0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J1), |
| 82 | EXYNOS4_GPIO_K1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K0), |
| 83 | EXYNOS4_GPIO_K2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K1), |
| 84 | EXYNOS4_GPIO_K3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K2), |
| 85 | EXYNOS4_GPIO_L0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K3), |
| 86 | EXYNOS4_GPIO_L1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L0), |
| 87 | EXYNOS4_GPIO_L2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L1), |
| 88 | EXYNOS4_GPIO_X0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L2), |
| 89 | EXYNOS4_GPIO_X1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X0), |
| 90 | EXYNOS4_GPIO_X2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X1), |
| 91 | EXYNOS4_GPIO_X3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X2), |
Marek Szyprowski | 47a9c0e | 2011-03-15 21:17:43 +0900 | [diff] [blame] | 92 | EXYNOS4_GPIO_Y0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X3), |
| 93 | EXYNOS4_GPIO_Y1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y0), |
| 94 | EXYNOS4_GPIO_Y2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y1), |
| 95 | EXYNOS4_GPIO_Y3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y2), |
| 96 | EXYNOS4_GPIO_Y4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y3), |
| 97 | EXYNOS4_GPIO_Y5_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y4), |
| 98 | EXYNOS4_GPIO_Y6_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y5), |
| 99 | EXYNOS4_GPIO_Z_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y6), |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | /* EXYNOS4 GPIO number definitions */ |
| 103 | #define EXYNOS4_GPA0(_nr) (EXYNOS4_GPIO_A0_START + (_nr)) |
| 104 | #define EXYNOS4_GPA1(_nr) (EXYNOS4_GPIO_A1_START + (_nr)) |
| 105 | #define EXYNOS4_GPB(_nr) (EXYNOS4_GPIO_B_START + (_nr)) |
| 106 | #define EXYNOS4_GPC0(_nr) (EXYNOS4_GPIO_C0_START + (_nr)) |
| 107 | #define EXYNOS4_GPC1(_nr) (EXYNOS4_GPIO_C1_START + (_nr)) |
| 108 | #define EXYNOS4_GPD0(_nr) (EXYNOS4_GPIO_D0_START + (_nr)) |
| 109 | #define EXYNOS4_GPD1(_nr) (EXYNOS4_GPIO_D1_START + (_nr)) |
| 110 | #define EXYNOS4_GPE0(_nr) (EXYNOS4_GPIO_E0_START + (_nr)) |
| 111 | #define EXYNOS4_GPE1(_nr) (EXYNOS4_GPIO_E1_START + (_nr)) |
| 112 | #define EXYNOS4_GPE2(_nr) (EXYNOS4_GPIO_E2_START + (_nr)) |
| 113 | #define EXYNOS4_GPE3(_nr) (EXYNOS4_GPIO_E3_START + (_nr)) |
| 114 | #define EXYNOS4_GPE4(_nr) (EXYNOS4_GPIO_E4_START + (_nr)) |
| 115 | #define EXYNOS4_GPF0(_nr) (EXYNOS4_GPIO_F0_START + (_nr)) |
| 116 | #define EXYNOS4_GPF1(_nr) (EXYNOS4_GPIO_F1_START + (_nr)) |
| 117 | #define EXYNOS4_GPF2(_nr) (EXYNOS4_GPIO_F2_START + (_nr)) |
| 118 | #define EXYNOS4_GPF3(_nr) (EXYNOS4_GPIO_F3_START + (_nr)) |
| 119 | #define EXYNOS4_GPJ0(_nr) (EXYNOS4_GPIO_J0_START + (_nr)) |
| 120 | #define EXYNOS4_GPJ1(_nr) (EXYNOS4_GPIO_J1_START + (_nr)) |
| 121 | #define EXYNOS4_GPK0(_nr) (EXYNOS4_GPIO_K0_START + (_nr)) |
| 122 | #define EXYNOS4_GPK1(_nr) (EXYNOS4_GPIO_K1_START + (_nr)) |
| 123 | #define EXYNOS4_GPK2(_nr) (EXYNOS4_GPIO_K2_START + (_nr)) |
| 124 | #define EXYNOS4_GPK3(_nr) (EXYNOS4_GPIO_K3_START + (_nr)) |
| 125 | #define EXYNOS4_GPL0(_nr) (EXYNOS4_GPIO_L0_START + (_nr)) |
| 126 | #define EXYNOS4_GPL1(_nr) (EXYNOS4_GPIO_L1_START + (_nr)) |
| 127 | #define EXYNOS4_GPL2(_nr) (EXYNOS4_GPIO_L2_START + (_nr)) |
| 128 | #define EXYNOS4_GPX0(_nr) (EXYNOS4_GPIO_X0_START + (_nr)) |
| 129 | #define EXYNOS4_GPX1(_nr) (EXYNOS4_GPIO_X1_START + (_nr)) |
| 130 | #define EXYNOS4_GPX2(_nr) (EXYNOS4_GPIO_X2_START + (_nr)) |
| 131 | #define EXYNOS4_GPX3(_nr) (EXYNOS4_GPIO_X3_START + (_nr)) |
Marek Szyprowski | 47a9c0e | 2011-03-15 21:17:43 +0900 | [diff] [blame] | 132 | #define EXYNOS4_GPY0(_nr) (EXYNOS4_GPIO_Y0_START + (_nr)) |
| 133 | #define EXYNOS4_GPY1(_nr) (EXYNOS4_GPIO_Y1_START + (_nr)) |
| 134 | #define EXYNOS4_GPY2(_nr) (EXYNOS4_GPIO_Y2_START + (_nr)) |
| 135 | #define EXYNOS4_GPY3(_nr) (EXYNOS4_GPIO_Y3_START + (_nr)) |
| 136 | #define EXYNOS4_GPY4(_nr) (EXYNOS4_GPIO_Y4_START + (_nr)) |
| 137 | #define EXYNOS4_GPY5(_nr) (EXYNOS4_GPIO_Y5_START + (_nr)) |
| 138 | #define EXYNOS4_GPY6(_nr) (EXYNOS4_GPIO_Y6_START + (_nr)) |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 139 | #define EXYNOS4_GPZ(_nr) (EXYNOS4_GPIO_Z_START + (_nr)) |
| 140 | |
| 141 | /* the end of the EXYNOS4 specific gpios */ |
| 142 | #define EXYNOS4_GPIO_END (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + 1) |
| 143 | #define S3C_GPIO_END EXYNOS4_GPIO_END |
| 144 | |
| 145 | /* define the number of gpios we need to the one after the GPZ() range */ |
| 146 | #define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ |
| 147 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) |
| 148 | |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 149 | #endif /* __ASM_ARCH_GPIO_H */ |