162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2008 Openmoko, Inc.
462306a36Sopenharmony_ci * Copyright 2008 Simtec Electronics
562306a36Sopenharmony_ci *	http://armlinux.simtec.co.uk/
662306a36Sopenharmony_ci *	Ben Dooks <ben@simtec.co.uk>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * S3C6400 - GPIO lib support
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef GPIO_SAMSUNG_S3C64XX_H
1262306a36Sopenharmony_ci#define GPIO_SAMSUNG_S3C64XX_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#ifdef CONFIG_GPIO_SAMSUNG
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* GPIO bank sizes */
1762306a36Sopenharmony_ci#define S3C64XX_GPIO_A_NR	(8)
1862306a36Sopenharmony_ci#define S3C64XX_GPIO_B_NR	(7)
1962306a36Sopenharmony_ci#define S3C64XX_GPIO_C_NR	(8)
2062306a36Sopenharmony_ci#define S3C64XX_GPIO_D_NR	(5)
2162306a36Sopenharmony_ci#define S3C64XX_GPIO_E_NR	(5)
2262306a36Sopenharmony_ci#define S3C64XX_GPIO_F_NR	(16)
2362306a36Sopenharmony_ci#define S3C64XX_GPIO_G_NR	(7)
2462306a36Sopenharmony_ci#define S3C64XX_GPIO_H_NR	(10)
2562306a36Sopenharmony_ci#define S3C64XX_GPIO_I_NR	(16)
2662306a36Sopenharmony_ci#define S3C64XX_GPIO_J_NR	(12)
2762306a36Sopenharmony_ci#define S3C64XX_GPIO_K_NR	(16)
2862306a36Sopenharmony_ci#define S3C64XX_GPIO_L_NR	(15)
2962306a36Sopenharmony_ci#define S3C64XX_GPIO_M_NR	(6)
3062306a36Sopenharmony_ci#define S3C64XX_GPIO_N_NR	(16)
3162306a36Sopenharmony_ci#define S3C64XX_GPIO_O_NR	(16)
3262306a36Sopenharmony_ci#define S3C64XX_GPIO_P_NR	(15)
3362306a36Sopenharmony_ci#define S3C64XX_GPIO_Q_NR	(9)
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* GPIO bank numbes */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
3862306a36Sopenharmony_ci * space for debugging purposes so that any accidental
3962306a36Sopenharmony_ci * change from one gpio bank to another can be caught.
4062306a36Sopenharmony_ci*/
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define S3C64XX_GPIO_NEXT(__gpio) \
4362306a36Sopenharmony_ci	((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cienum s3c_gpio_number {
4662306a36Sopenharmony_ci	S3C64XX_GPIO_A_START = 0,
4762306a36Sopenharmony_ci	S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
4862306a36Sopenharmony_ci	S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
4962306a36Sopenharmony_ci	S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
5062306a36Sopenharmony_ci	S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
5162306a36Sopenharmony_ci	S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
5262306a36Sopenharmony_ci	S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
5362306a36Sopenharmony_ci	S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
5462306a36Sopenharmony_ci	S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
5562306a36Sopenharmony_ci	S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
5662306a36Sopenharmony_ci	S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
5762306a36Sopenharmony_ci	S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
5862306a36Sopenharmony_ci	S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
5962306a36Sopenharmony_ci	S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
6062306a36Sopenharmony_ci	S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
6162306a36Sopenharmony_ci	S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
6262306a36Sopenharmony_ci	S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* S3C64XX GPIO number definitions. */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define S3C64XX_GPA(_nr)	(S3C64XX_GPIO_A_START + (_nr))
6862306a36Sopenharmony_ci#define S3C64XX_GPB(_nr)	(S3C64XX_GPIO_B_START + (_nr))
6962306a36Sopenharmony_ci#define S3C64XX_GPC(_nr)	(S3C64XX_GPIO_C_START + (_nr))
7062306a36Sopenharmony_ci#define S3C64XX_GPD(_nr)	(S3C64XX_GPIO_D_START + (_nr))
7162306a36Sopenharmony_ci#define S3C64XX_GPE(_nr)	(S3C64XX_GPIO_E_START + (_nr))
7262306a36Sopenharmony_ci#define S3C64XX_GPF(_nr)	(S3C64XX_GPIO_F_START + (_nr))
7362306a36Sopenharmony_ci#define S3C64XX_GPG(_nr)	(S3C64XX_GPIO_G_START + (_nr))
7462306a36Sopenharmony_ci#define S3C64XX_GPH(_nr)	(S3C64XX_GPIO_H_START + (_nr))
7562306a36Sopenharmony_ci#define S3C64XX_GPI(_nr)	(S3C64XX_GPIO_I_START + (_nr))
7662306a36Sopenharmony_ci#define S3C64XX_GPJ(_nr)	(S3C64XX_GPIO_J_START + (_nr))
7762306a36Sopenharmony_ci#define S3C64XX_GPK(_nr)	(S3C64XX_GPIO_K_START + (_nr))
7862306a36Sopenharmony_ci#define S3C64XX_GPL(_nr)	(S3C64XX_GPIO_L_START + (_nr))
7962306a36Sopenharmony_ci#define S3C64XX_GPM(_nr)	(S3C64XX_GPIO_M_START + (_nr))
8062306a36Sopenharmony_ci#define S3C64XX_GPN(_nr)	(S3C64XX_GPIO_N_START + (_nr))
8162306a36Sopenharmony_ci#define S3C64XX_GPO(_nr)	(S3C64XX_GPIO_O_START + (_nr))
8262306a36Sopenharmony_ci#define S3C64XX_GPP(_nr)	(S3C64XX_GPIO_P_START + (_nr))
8362306a36Sopenharmony_ci#define S3C64XX_GPQ(_nr)	(S3C64XX_GPIO_Q_START + (_nr))
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* the end of the S3C64XX specific gpios */
8662306a36Sopenharmony_ci#define S3C64XX_GPIO_END	(S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
8762306a36Sopenharmony_ci#define S3C_GPIO_END		S3C64XX_GPIO_END
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* define the number of gpios we need to the one after the GPQ() range */
9062306a36Sopenharmony_ci#define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#endif /* GPIO_SAMSUNG */
9362306a36Sopenharmony_ci#endif /* GPIO_SAMSUNG_S3C64XX_H */
9462306a36Sopenharmony_ci
95