summaryrefslogtreecommitdiff
path: root/include/drivers/st
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@foss.st.com>2021-09-21 11:05:06 +0200
committerYann Gautier <yann.gautier@st.com>2022-02-01 16:35:28 +0100
commit417196faefe4c592e9ca1e71d4fd8c35603c8ebb (patch)
treea6726cf62fdc18a3e1e9529c73e7b647321d645a /include/drivers/st
parent6cacfe2959800a954cc646cea1233c449393d379 (diff)
downloadarm-trusted-firmware-417196faefe4c592e9ca1e71d4fd8c35603c8ebb.tar.gz
refactor(st-gpio): code improvements
No functional, change, but some improvements: - Declare set_gpio() as static (only called locally) - Handle the type ('open-drain') property independently from the mode one. - Replace mmio_clrbits_32() + mmio_setbits_32() with mmio_clrsetbits_32(). - Add a missing log - Add missing U() in macro definitions Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com> Change-Id: I1a79609609ac8e8001127ebefdb81def573f76fa
Diffstat (limited to 'include/drivers/st')
-rw-r--r--include/drivers/st/stm32_gpio.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/include/drivers/st/stm32_gpio.h b/include/drivers/st/stm32_gpio.h
index b07234515..c175fe420 100644
--- a/include/drivers/st/stm32_gpio.h
+++ b/include/drivers/st/stm32_gpio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2021, STMicroelectronics - All Rights Reserved
+ * Copyright (c) 2015-2022, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -26,31 +26,31 @@
#define GPIO_ALTERNATE_(_x) U(_x)
#define GPIO_ALTERNATE_MASK U(0x0F)
-#define GPIO_MODE_INPUT 0x00
-#define GPIO_MODE_OUTPUT 0x01
-#define GPIO_MODE_ALTERNATE 0x02
-#define GPIO_MODE_ANALOG 0x03
+#define GPIO_MODE_INPUT U(0x00)
+#define GPIO_MODE_OUTPUT U(0x01)
+#define GPIO_MODE_ALTERNATE U(0x02)
+#define GPIO_MODE_ANALOG U(0x03)
#define GPIO_MODE_MASK U(0x03)
-#define GPIO_OPEN_DRAIN U(0x10)
+#define GPIO_TYPE_PUSH_PULL U(0x00)
+#define GPIO_TYPE_OPEN_DRAIN U(0x01)
+#define GPIO_TYPE_MASK U(0x01)
-#define GPIO_SPEED_LOW 0x00
-#define GPIO_SPEED_MEDIUM 0x01
-#define GPIO_SPEED_HIGH 0x02
-#define GPIO_SPEED_VERY_HIGH 0x03
+#define GPIO_SPEED_LOW U(0x00)
+#define GPIO_SPEED_MEDIUM U(0x01)
+#define GPIO_SPEED_HIGH U(0x02)
+#define GPIO_SPEED_VERY_HIGH U(0x03)
#define GPIO_SPEED_MASK U(0x03)
-#define GPIO_NO_PULL 0x00
-#define GPIO_PULL_UP 0x01
-#define GPIO_PULL_DOWN 0x02
+#define GPIO_NO_PULL U(0x00)
+#define GPIO_PULL_UP U(0x01)
+#define GPIO_PULL_DOWN U(0x02)
#define GPIO_PULL_MASK U(0x03)
#ifndef __ASSEMBLER__
#include <stdint.h>
int dt_set_pinctrl_config(int node);
-void set_gpio(uint32_t bank, uint32_t pin, uint32_t mode, uint32_t speed,
- uint32_t pull, uint32_t alternate, uint8_t status);
void set_gpio_secure_cfg(uint32_t bank, uint32_t pin, bool secure);
void set_gpio_reset_cfg(uint32_t bank, uint32_t pin);
#endif /*__ASSEMBLER__*/