Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2008 Simtec Electronics
0004  *  http://armlinux.simtec.co.uk/
0005  *  Ben Dooks <ben@simtec.co.uk>
0006  *
0007  * S3C2410 - GPIO lib support
0008  */
0009 
0010 /* some boards require extra gpio capacity to support external
0011  * devices that need GPIO.
0012  */
0013 
0014 #ifndef GPIO_SAMSUNG_S3C24XX_H
0015 #define GPIO_SAMSUNG_S3C24XX_H
0016 
0017 #include "map.h"
0018 
0019 /*
0020  * GPIO sizes for various SoCs:
0021  *
0022  *   2410 2412 2440 2443 2416
0023  *             2442
0024  *   ---- ---- ---- ---- ----
0025  * A  23   22   25   16   27
0026  * B  11   11   11   11   11
0027  * C  16   16   16   16   16
0028  * D  16   16   16   16   16
0029  * E  16   16   16   16   16
0030  * F  8    8    8    8    8
0031  * G  16   16   16   16   8
0032  * H  11   11   11   15   15
0033  * J  --   --   13   16   --
0034  * K  --   --   --   --   16
0035  * L  --   --   --   15   14
0036  * M  --   --   --   2    2
0037  */
0038 
0039 /* GPIO bank sizes */
0040 
0041 #define S3C2410_GPIO_A_NR   (32)
0042 #define S3C2410_GPIO_B_NR   (32)
0043 #define S3C2410_GPIO_C_NR   (32)
0044 #define S3C2410_GPIO_D_NR   (32)
0045 #define S3C2410_GPIO_E_NR   (32)
0046 #define S3C2410_GPIO_F_NR   (32)
0047 #define S3C2410_GPIO_G_NR   (32)
0048 #define S3C2410_GPIO_H_NR   (32)
0049 #define S3C2410_GPIO_J_NR   (32)    /* technically 16. */
0050 #define S3C2410_GPIO_K_NR   (32)    /* technically 16. */
0051 #define S3C2410_GPIO_L_NR   (32)    /* technically 15. */
0052 #define S3C2410_GPIO_M_NR   (32)    /* technically 2. */
0053 
0054 #if CONFIG_S3C_GPIO_SPACE != 0
0055 #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
0056 #endif
0057 
0058 #define S3C2410_GPIO_NEXT(__gpio) \
0059     ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0)
0060 
0061 #ifndef __ASSEMBLY__
0062 
0063 enum s3c_gpio_number {
0064     S3C2410_GPIO_A_START = 0,
0065     S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A),
0066     S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B),
0067     S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C),
0068     S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D),
0069     S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
0070     S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
0071     S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
0072     S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
0073     S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J),
0074     S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K),
0075     S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L),
0076 };
0077 
0078 #endif /* __ASSEMBLY__ */
0079 
0080 /* S3C2410 GPIO number definitions. */
0081 
0082 #define S3C2410_GPA(_nr)    (S3C2410_GPIO_A_START + (_nr))
0083 #define S3C2410_GPB(_nr)    (S3C2410_GPIO_B_START + (_nr))
0084 #define S3C2410_GPC(_nr)    (S3C2410_GPIO_C_START + (_nr))
0085 #define S3C2410_GPD(_nr)    (S3C2410_GPIO_D_START + (_nr))
0086 #define S3C2410_GPE(_nr)    (S3C2410_GPIO_E_START + (_nr))
0087 #define S3C2410_GPF(_nr)    (S3C2410_GPIO_F_START + (_nr))
0088 #define S3C2410_GPG(_nr)    (S3C2410_GPIO_G_START + (_nr))
0089 #define S3C2410_GPH(_nr)    (S3C2410_GPIO_H_START + (_nr))
0090 #define S3C2410_GPJ(_nr)    (S3C2410_GPIO_J_START + (_nr))
0091 #define S3C2410_GPK(_nr)    (S3C2410_GPIO_K_START + (_nr))
0092 #define S3C2410_GPL(_nr)    (S3C2410_GPIO_L_START + (_nr))
0093 #define S3C2410_GPM(_nr)    (S3C2410_GPIO_M_START + (_nr))
0094 
0095 #ifdef CONFIG_CPU_S3C244X
0096 #define S3C_GPIO_END    (S3C2410_GPJ(0) + 32)
0097 #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
0098 #define S3C_GPIO_END    (S3C2410_GPM(0) + 32)
0099 #else
0100 #define S3C_GPIO_END    (S3C2410_GPH(0) + 32)
0101 #endif
0102 
0103 #endif /* GPIO_SAMSUNG_S3C24XX_H */