Ben Dooks | 67c2add | 2008-12-12 00:24:29 +0000 | [diff] [blame] | 1 | /* arch/arm/mach-s3c2410/include/mach/gpio-nrs.h |
| 2 | * |
| 3 | * Copyright (c) 2008 Simtec Electronics |
| 4 | * http://armlinux.simtec.co.uk/ |
| 5 | * Ben Dooks <ben@simtec.co.uk> |
| 6 | * |
| 7 | * S3C2410 - GPIO bank numbering |
| 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 | |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 14 | #ifndef __MACH_GPIONRS_H |
| 15 | #define __MACH_GPIONRS_H |
| 16 | |
Ben Dooks | 67c2add | 2008-12-12 00:24:29 +0000 | [diff] [blame] | 17 | #define S3C2410_GPIONO(bank,offset) ((bank) + (offset)) |
| 18 | |
Ben Dooks | 67c2add | 2008-12-12 00:24:29 +0000 | [diff] [blame] | 19 | #define S3C2410_GPIO_BANKG (32*6) |
| 20 | #define S3C2410_GPIO_BANKH (32*7) |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 21 | |
Ben Dooks | 4ac2a39 | 2010-05-17 15:12:33 +0900 | [diff] [blame] | 22 | /* GPIO sizes for various SoCs: |
| 23 | * |
| 24 | * 2442 |
| 25 | * 2410 2412 2440 2443 2416 |
| 26 | * ---- ---- ---- ---- ---- |
| 27 | * A 23 22 25 16 25 |
| 28 | * B 11 11 11 11 9 |
| 29 | * C 16 15 16 16 16 |
| 30 | * D 16 16 16 16 16 |
| 31 | * E 16 16 16 16 16 |
| 32 | * F 8 8 8 8 8 |
| 33 | * G 16 16 16 16 8 |
| 34 | * H 11 11 9 15 15 |
| 35 | * J -- -- 13 16 -- |
| 36 | * K -- -- -- -- 16 |
| 37 | * L -- -- -- 15 7 |
| 38 | * M -- -- -- 2 2 |
| 39 | */ |
| 40 | |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 41 | /* GPIO bank sizes */ |
| 42 | #define S3C2410_GPIO_A_NR (32) |
| 43 | #define S3C2410_GPIO_B_NR (32) |
| 44 | #define S3C2410_GPIO_C_NR (32) |
| 45 | #define S3C2410_GPIO_D_NR (32) |
| 46 | #define S3C2410_GPIO_E_NR (32) |
| 47 | #define S3C2410_GPIO_F_NR (32) |
| 48 | #define S3C2410_GPIO_G_NR (32) |
| 49 | #define S3C2410_GPIO_H_NR (32) |
Ben Dooks | 7ced5ea | 2010-05-03 17:19:49 +0900 | [diff] [blame] | 50 | #define S3C2410_GPIO_J_NR (32) /* technically 16. */ |
| 51 | #define S3C2410_GPIO_K_NR (32) /* technically 16. */ |
| 52 | #define S3C2410_GPIO_L_NR (32) /* technically 15. */ |
| 53 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 54 | |
| 55 | #if CONFIG_S3C_GPIO_SPACE != 0 |
Peter Korsgaard | ce19de0 | 2011-10-10 19:55:58 +0900 | [diff] [blame] | 56 | #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 57 | #endif |
| 58 | |
| 59 | #define S3C2410_GPIO_NEXT(__gpio) \ |
| 60 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0) |
| 61 | |
| 62 | #ifndef __ASSEMBLY__ |
| 63 | |
| 64 | enum s3c_gpio_number { |
| 65 | S3C2410_GPIO_A_START = 0, |
| 66 | S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A), |
| 67 | S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B), |
| 68 | S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C), |
| 69 | S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D), |
| 70 | S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), |
| 71 | S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), |
| 72 | S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), |
Ben Dooks | 7ced5ea | 2010-05-03 17:19:49 +0900 | [diff] [blame] | 73 | S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H), |
| 74 | S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J), |
| 75 | S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K), |
| 76 | S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L), |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | #endif /* __ASSEMBLY__ */ |
| 80 | |
| 81 | /* S3C2410 GPIO number definitions. */ |
| 82 | |
| 83 | #define S3C2410_GPA(_nr) (S3C2410_GPIO_A_START + (_nr)) |
| 84 | #define S3C2410_GPB(_nr) (S3C2410_GPIO_B_START + (_nr)) |
| 85 | #define S3C2410_GPC(_nr) (S3C2410_GPIO_C_START + (_nr)) |
| 86 | #define S3C2410_GPD(_nr) (S3C2410_GPIO_D_START + (_nr)) |
| 87 | #define S3C2410_GPE(_nr) (S3C2410_GPIO_E_START + (_nr)) |
| 88 | #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) |
| 89 | #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) |
| 90 | #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) |
Ben Dooks | 7ced5ea | 2010-05-03 17:19:49 +0900 | [diff] [blame] | 91 | #define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr)) |
| 92 | #define S3C2410_GPK(_nr) (S3C2410_GPIO_K_START + (_nr)) |
| 93 | #define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) |
| 94 | #define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 95 | |
Ben Dooks | 070276d | 2009-05-17 22:32:23 +0100 | [diff] [blame] | 96 | /* compatibility until drivers can be modified */ |
| 97 | |
| 98 | #define S3C2410_GPA0 S3C2410_GPA(0) |
| 99 | #define S3C2410_GPA1 S3C2410_GPA(1) |
| 100 | #define S3C2410_GPA3 S3C2410_GPA(3) |
| 101 | #define S3C2410_GPA7 S3C2410_GPA(7) |
| 102 | |
| 103 | #define S3C2410_GPE0 S3C2410_GPE(0) |
| 104 | #define S3C2410_GPE1 S3C2410_GPE(1) |
| 105 | #define S3C2410_GPE2 S3C2410_GPE(2) |
| 106 | #define S3C2410_GPE3 S3C2410_GPE(3) |
| 107 | #define S3C2410_GPE4 S3C2410_GPE(4) |
| 108 | #define S3C2410_GPE5 S3C2410_GPE(5) |
| 109 | #define S3C2410_GPE6 S3C2410_GPE(6) |
| 110 | #define S3C2410_GPE7 S3C2410_GPE(7) |
| 111 | #define S3C2410_GPE8 S3C2410_GPE(8) |
| 112 | #define S3C2410_GPE9 S3C2410_GPE(9) |
| 113 | #define S3C2410_GPE10 S3C2410_GPE(10) |
| 114 | |
| 115 | #define S3C2410_GPH10 S3C2410_GPH(10) |
| 116 | |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 117 | #endif /* __MACH_GPIONRS_H */ |
| 118 | |