xref: /rk3399_ARM-atf/include/dt-bindings/gpio/stm32-gpio.h (revision aba583498e36b166990da883dc8a8debb8eaf816)
1*deb9c864SPascal Paillet /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2*deb9c864SPascal Paillet /*
3*deb9c864SPascal Paillet  * Copyright (C) 2024 STMicroelectronics - All Rights Reserved
4*deb9c864SPascal Paillet  * Author: Paillet Pascal <p.paillet@foss.st.com> for STMicroelectronics.
5*deb9c864SPascal Paillet  */
6*deb9c864SPascal Paillet 
7*deb9c864SPascal Paillet #ifndef DT_BINDINGS_STM32_GPIO_H
8*deb9c864SPascal Paillet #define DT_BINDINGS_STM32_GPIO_H
9*deb9c864SPascal Paillet 
10*deb9c864SPascal Paillet /* Bank IDs used in GPIO driver API */
11*deb9c864SPascal Paillet #define GPIO_BANK_A			0U
12*deb9c864SPascal Paillet #define GPIO_BANK_B			1U
13*deb9c864SPascal Paillet #define GPIO_BANK_C			2U
14*deb9c864SPascal Paillet #define GPIO_BANK_D			3U
15*deb9c864SPascal Paillet #define GPIO_BANK_E			4U
16*deb9c864SPascal Paillet #define GPIO_BANK_F			5U
17*deb9c864SPascal Paillet #define GPIO_BANK_G			6U
18*deb9c864SPascal Paillet #define GPIO_BANK_H			7U
19*deb9c864SPascal Paillet #define GPIO_BANK_I			8U
20*deb9c864SPascal Paillet #define GPIO_BANK_J			9U
21*deb9c864SPascal Paillet #define GPIO_BANK_K			10U
22*deb9c864SPascal Paillet #define GPIO_BANK_Z			25U
23*deb9c864SPascal Paillet 
24*deb9c864SPascal Paillet /* Bit 0 is used to set GPIO in input mode */
25*deb9c864SPascal Paillet #define GPIOF_DIR_OUT			0x0
26*deb9c864SPascal Paillet #define GPIOF_DIR_IN			0x1
27*deb9c864SPascal Paillet 
28*deb9c864SPascal Paillet /* Bit 1 is used to set GPIO high level during init */
29*deb9c864SPascal Paillet #define GPIOF_INIT_LOW			0x0
30*deb9c864SPascal Paillet #define GPIOF_INIT_HIGH			0x2
31*deb9c864SPascal Paillet 
32*deb9c864SPascal Paillet #define GPIOF_IN			(GPIOF_DIR_IN)
33*deb9c864SPascal Paillet #define GPIOF_OUT_INIT_LOW		(GPIOF_DIR_OUT | GPIOF_INIT_LOW)
34*deb9c864SPascal Paillet #define GPIOF_OUT_INIT_HIGH		(GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
35*deb9c864SPascal Paillet 
36*deb9c864SPascal Paillet /* Bit 2 is used to set GPIO pull up */
37*deb9c864SPascal Paillet #define GPIOF_PULL_UP			0x4
38*deb9c864SPascal Paillet /* Bit 3 is used to set GPIO pull down */
39*deb9c864SPascal Paillet #define GPIOF_PULL_DOWN			0x8
40*deb9c864SPascal Paillet 
41*deb9c864SPascal Paillet #endif /* DT_BINDINGS_STM32_GPIO_H */
42