Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright 2008 Openmoko, Inc.
0004  * Copyright 2008 Simtec Electronics
0005  *  http://armlinux.simtec.co.uk/
0006  *  Ben Dooks <ben@simtec.co.uk>
0007  *
0008  * S3C6400 - GPIO lib support
0009  */
0010 
0011 #ifndef GPIO_SAMSUNG_S3C64XX_H
0012 #define GPIO_SAMSUNG_S3C64XX_H
0013 
0014 #ifdef CONFIG_GPIO_SAMSUNG
0015 
0016 /* GPIO bank sizes */
0017 #define S3C64XX_GPIO_A_NR   (8)
0018 #define S3C64XX_GPIO_B_NR   (7)
0019 #define S3C64XX_GPIO_C_NR   (8)
0020 #define S3C64XX_GPIO_D_NR   (5)
0021 #define S3C64XX_GPIO_E_NR   (5)
0022 #define S3C64XX_GPIO_F_NR   (16)
0023 #define S3C64XX_GPIO_G_NR   (7)
0024 #define S3C64XX_GPIO_H_NR   (10)
0025 #define S3C64XX_GPIO_I_NR   (16)
0026 #define S3C64XX_GPIO_J_NR   (12)
0027 #define S3C64XX_GPIO_K_NR   (16)
0028 #define S3C64XX_GPIO_L_NR   (15)
0029 #define S3C64XX_GPIO_M_NR   (6)
0030 #define S3C64XX_GPIO_N_NR   (16)
0031 #define S3C64XX_GPIO_O_NR   (16)
0032 #define S3C64XX_GPIO_P_NR   (15)
0033 #define S3C64XX_GPIO_Q_NR   (9)
0034 
0035 /* GPIO bank numbes */
0036 
0037 /* CONFIG_S3C_GPIO_SPACE allows the user to select extra
0038  * space for debugging purposes so that any accidental
0039  * change from one gpio bank to another can be caught.
0040 */
0041 
0042 #define S3C64XX_GPIO_NEXT(__gpio) \
0043     ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
0044 
0045 enum s3c_gpio_number {
0046     S3C64XX_GPIO_A_START = 0,
0047     S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
0048     S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
0049     S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
0050     S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
0051     S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
0052     S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
0053     S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
0054     S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
0055     S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
0056     S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
0057     S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
0058     S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
0059     S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
0060     S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
0061     S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
0062     S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
0063 };
0064 
0065 /* S3C64XX GPIO number definitions. */
0066 
0067 #define S3C64XX_GPA(_nr)    (S3C64XX_GPIO_A_START + (_nr))
0068 #define S3C64XX_GPB(_nr)    (S3C64XX_GPIO_B_START + (_nr))
0069 #define S3C64XX_GPC(_nr)    (S3C64XX_GPIO_C_START + (_nr))
0070 #define S3C64XX_GPD(_nr)    (S3C64XX_GPIO_D_START + (_nr))
0071 #define S3C64XX_GPE(_nr)    (S3C64XX_GPIO_E_START + (_nr))
0072 #define S3C64XX_GPF(_nr)    (S3C64XX_GPIO_F_START + (_nr))
0073 #define S3C64XX_GPG(_nr)    (S3C64XX_GPIO_G_START + (_nr))
0074 #define S3C64XX_GPH(_nr)    (S3C64XX_GPIO_H_START + (_nr))
0075 #define S3C64XX_GPI(_nr)    (S3C64XX_GPIO_I_START + (_nr))
0076 #define S3C64XX_GPJ(_nr)    (S3C64XX_GPIO_J_START + (_nr))
0077 #define S3C64XX_GPK(_nr)    (S3C64XX_GPIO_K_START + (_nr))
0078 #define S3C64XX_GPL(_nr)    (S3C64XX_GPIO_L_START + (_nr))
0079 #define S3C64XX_GPM(_nr)    (S3C64XX_GPIO_M_START + (_nr))
0080 #define S3C64XX_GPN(_nr)    (S3C64XX_GPIO_N_START + (_nr))
0081 #define S3C64XX_GPO(_nr)    (S3C64XX_GPIO_O_START + (_nr))
0082 #define S3C64XX_GPP(_nr)    (S3C64XX_GPIO_P_START + (_nr))
0083 #define S3C64XX_GPQ(_nr)    (S3C64XX_GPIO_Q_START + (_nr))
0084 
0085 /* the end of the S3C64XX specific gpios */
0086 #define S3C64XX_GPIO_END    (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
0087 #define S3C_GPIO_END        S3C64XX_GPIO_END
0088 
0089 /* define the number of gpios we need to the one after the GPQ() range */
0090 #define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
0091 
0092 #endif /* GPIO_SAMSUNG */
0093 #endif /* GPIO_SAMSUNG_S3C64XX_H */
0094