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 | |
| 19 | #define S3C2410_GPIO_BANKA (32*0) |
| 20 | #define S3C2410_GPIO_BANKB (32*1) |
| 21 | #define S3C2410_GPIO_BANKC (32*2) |
| 22 | #define S3C2410_GPIO_BANKD (32*3) |
| 23 | #define S3C2410_GPIO_BANKE (32*4) |
| 24 | #define S3C2410_GPIO_BANKF (32*5) |
| 25 | #define S3C2410_GPIO_BANKG (32*6) |
| 26 | #define S3C2410_GPIO_BANKH (32*7) |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 27 | |
| 28 | /* GPIO bank sizes */ |
| 29 | #define S3C2410_GPIO_A_NR (32) |
| 30 | #define S3C2410_GPIO_B_NR (32) |
| 31 | #define S3C2410_GPIO_C_NR (32) |
| 32 | #define S3C2410_GPIO_D_NR (32) |
| 33 | #define S3C2410_GPIO_E_NR (32) |
| 34 | #define S3C2410_GPIO_F_NR (32) |
| 35 | #define S3C2410_GPIO_G_NR (32) |
| 36 | #define S3C2410_GPIO_H_NR (32) |
Ben Dooks | 7ced5ea | 2010-05-03 17:19:49 +0900 | [diff] [blame^] | 37 | #define S3C2410_GPIO_J_NR (32) /* technically 16. */ |
| 38 | #define S3C2410_GPIO_K_NR (32) /* technically 16. */ |
| 39 | #define S3C2410_GPIO_L_NR (32) /* technically 15. */ |
| 40 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 41 | |
| 42 | #if CONFIG_S3C_GPIO_SPACE != 0 |
| 43 | #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment |
| 44 | #endif |
| 45 | |
| 46 | #define S3C2410_GPIO_NEXT(__gpio) \ |
| 47 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0) |
| 48 | |
| 49 | #ifndef __ASSEMBLY__ |
| 50 | |
| 51 | enum s3c_gpio_number { |
| 52 | S3C2410_GPIO_A_START = 0, |
| 53 | S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A), |
| 54 | S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B), |
| 55 | S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C), |
| 56 | S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D), |
| 57 | S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), |
| 58 | S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), |
| 59 | S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), |
Ben Dooks | 7ced5ea | 2010-05-03 17:19:49 +0900 | [diff] [blame^] | 60 | S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H), |
| 61 | S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J), |
| 62 | S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K), |
| 63 | S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L), |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | #endif /* __ASSEMBLY__ */ |
| 67 | |
| 68 | /* S3C2410 GPIO number definitions. */ |
| 69 | |
| 70 | #define S3C2410_GPA(_nr) (S3C2410_GPIO_A_START + (_nr)) |
| 71 | #define S3C2410_GPB(_nr) (S3C2410_GPIO_B_START + (_nr)) |
| 72 | #define S3C2410_GPC(_nr) (S3C2410_GPIO_C_START + (_nr)) |
| 73 | #define S3C2410_GPD(_nr) (S3C2410_GPIO_D_START + (_nr)) |
| 74 | #define S3C2410_GPE(_nr) (S3C2410_GPIO_E_START + (_nr)) |
| 75 | #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) |
| 76 | #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) |
| 77 | #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) |
Ben Dooks | 7ced5ea | 2010-05-03 17:19:49 +0900 | [diff] [blame^] | 78 | #define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr)) |
| 79 | #define S3C2410_GPK(_nr) (S3C2410_GPIO_K_START + (_nr)) |
| 80 | #define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) |
| 81 | #define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 82 | |
Ben Dooks | 070276d | 2009-05-17 22:32:23 +0100 | [diff] [blame] | 83 | /* compatibility until drivers can be modified */ |
| 84 | |
| 85 | #define S3C2410_GPA0 S3C2410_GPA(0) |
| 86 | #define S3C2410_GPA1 S3C2410_GPA(1) |
| 87 | #define S3C2410_GPA3 S3C2410_GPA(3) |
| 88 | #define S3C2410_GPA7 S3C2410_GPA(7) |
| 89 | |
| 90 | #define S3C2410_GPE0 S3C2410_GPE(0) |
| 91 | #define S3C2410_GPE1 S3C2410_GPE(1) |
| 92 | #define S3C2410_GPE2 S3C2410_GPE(2) |
| 93 | #define S3C2410_GPE3 S3C2410_GPE(3) |
| 94 | #define S3C2410_GPE4 S3C2410_GPE(4) |
| 95 | #define S3C2410_GPE5 S3C2410_GPE(5) |
| 96 | #define S3C2410_GPE6 S3C2410_GPE(6) |
| 97 | #define S3C2410_GPE7 S3C2410_GPE(7) |
| 98 | #define S3C2410_GPE8 S3C2410_GPE(8) |
| 99 | #define S3C2410_GPE9 S3C2410_GPE(9) |
| 100 | #define S3C2410_GPE10 S3C2410_GPE(10) |
| 101 | |
| 102 | #define S3C2410_GPH10 S3C2410_GPH(10) |
| 103 | |
Ben Dooks | 75cbcff | 2009-05-17 22:44:33 +0100 | [diff] [blame] | 104 | #endif /* __MACH_GPIONRS_H */ |
| 105 | |