From deb9c864eac86b4c7a57ec5bf90d301f7f741bd0 Mon Sep 17 00:00:00 2001
From: Pascal Paillet
Date: Tue, 15 Mar 2022 15:20:00 +0100
Subject: [PATCH] feat(dt-bindings): describe ST GPIO banks and config
Describe GPIO banks configs so that it can be used in
an STM32MP device-tree file.
Signed-off-by: Pascal Paillet
Change-Id: If5dd05aae314cbb3189eb02c9fe555b832ac2bdb
---
include/dt-bindings/gpio/stm32-gpio.h | 41 +++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 include/dt-bindings/gpio/stm32-gpio.h
diff --git a/include/dt-bindings/gpio/stm32-gpio.h b/include/dt-bindings/gpio/stm32-gpio.h
new file mode 100644
index 000000000..2c7a0f154
--- /dev/null
+++ b/include/dt-bindings/gpio/stm32-gpio.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
+/*
+ * Copyright (C) 2024 STMicroelectronics - All Rights Reserved
+ * Author: Paillet Pascal for STMicroelectronics.
+ */
+
+#ifndef DT_BINDINGS_STM32_GPIO_H
+#define DT_BINDINGS_STM32_GPIO_H
+
+/* Bank IDs used in GPIO driver API */
+#define GPIO_BANK_A 0U
+#define GPIO_BANK_B 1U
+#define GPIO_BANK_C 2U
+#define GPIO_BANK_D 3U
+#define GPIO_BANK_E 4U
+#define GPIO_BANK_F 5U
+#define GPIO_BANK_G 6U
+#define GPIO_BANK_H 7U
+#define GPIO_BANK_I 8U
+#define GPIO_BANK_J 9U
+#define GPIO_BANK_K 10U
+#define GPIO_BANK_Z 25U
+
+/* Bit 0 is used to set GPIO in input mode */
+#define GPIOF_DIR_OUT 0x0
+#define GPIOF_DIR_IN 0x1
+
+/* Bit 1 is used to set GPIO high level during init */
+#define GPIOF_INIT_LOW 0x0
+#define GPIOF_INIT_HIGH 0x2
+
+#define GPIOF_IN (GPIOF_DIR_IN)
+#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
+#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
+
+/* Bit 2 is used to set GPIO pull up */
+#define GPIOF_PULL_UP 0x4
+/* Bit 3 is used to set GPIO pull down */
+#define GPIOF_PULL_DOWN 0x8
+
+#endif /* DT_BINDINGS_STM32_GPIO_H */