pinctrl: stm32: replace magic values with defines for STM32_PINMODE
Subsystems (2)
PATCH 1/1 pinctrl: stm32: replace magic values with defines for STM32_PINMODE
Makes the code easier to follow and allows using the new macros in PBL code for early pinmuxing of e.g. the debug UART.
Signed-off-by Ahmad Fatoum <[email protected]>
--- drivers/pinctrl/pinctrl-stm32.c | 6 +++--- include/soc/stm32/gpio.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-stm32.c +3 -3
@@ -63,11 +63,11 @@ static inline u32 stm32_gpio_get_mode(u32 function) {switch (function) {case STM32_PIN_GPIO : -return 0 ; +return STM32_PINMODE_GPIO ; case STM32_PIN_AF(0) ... STM32_PIN_AF(15): -return 2 ; +return STM32_PINMODE_AF ;case STM32_PIN_ANALOG : -return 3 ; +return STM32_PINMODE_ANALOG ; }return 0 ;
include/soc/stm32/gpio.h +4 -0
@@ -25,6 +25,10 @@#define STM32_PIN_AF (x) ((x) + 1)#define STM32_PIN_ANALOG (STM32_PIN_AF(15) + 1) +#define STM32_PINMODE_GPIO 0 +#define STM32_PINMODE_AF 2 +#define STM32_PINMODE_ANALOG 3 +#define STM32_GPIO_PINS_PER_BANK 16enum stm32_pin_bias {STM32_PIN_NO_BIAS ,STM32_PIN_PULL_UP ,STM32_PIN_PULL_DOWN };
Signature · 7 lines
2.33.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 8 lines · Ahmad Fatoum
Makes the code easier to follow and allows using the new macros in PBL code for early pinmuxing of e.g. the debug UART.
Signed-off-by Ahmad Fatoum <[email protected]>--- drivers/pinctrl/pinctrl-stm32.c | 6 +++--- include/soc/stm32/gpio.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox