Skip to content

Commit

Permalink
stm32l5:pinmap Add suffix to all pins and add legacy pinmap
Browse files Browse the repository at this point in the history
   Pinmaps should not have contained GPIO_SPEED_xxx settings and
   all pins should have had suffixes to allow any pins attributes to
   be set. This is board dependent.

   This change adds CONFIG_STM32L5_USE_LEGACY_PINMAP to allow for
   lazy migration to using pinmaps with suffixes.

   The work required to do this can be aided by running tools/stm32_pinmap_tool.py.
   The tools will take a board.h file and a legacy pinmap and outut the required
   changes that one needs to make to a board.h file.

   Eventually, CONFIG_STM32L5_USE_LEGACY_PINMAP will be deprecated and the legacy
   pinmaps removed from NuttX.

   Any new boards added should set CONFIG_STM32L5_USE_LEGACY_PINMAP=n and
   fully define the pins in board.h
  • Loading branch information
davids5 authored and raiden00pl committed Apr 19, 2023
1 parent 7e48b58 commit ac6ad45
Show file tree
Hide file tree
Showing 5 changed files with 846 additions and 73 deletions.
20 changes: 20 additions & 0 deletions arch/arm/src/stm32l5/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,26 @@ config STM32L5_SRAM2_INIT
case, the board should handle the initialization itself at the appropriate
time.

config STM32L5_USE_LEGACY_PINMAP
bool "Use the legacy pinmap with GPIO_SPEED_xxx included."
default y
---help---
In the past, pinmap files included GPIO_SPEED_xxxMhz. These speed
settings should have come from the board.h as it describes the wiring
of the SoC to the board. The speed is really slew rate control and
therefore is related to the layout and can only be properly set
in board.h.

CONFIG_STM32L5_USE_LEGACY_PINMAP is provided, to allow lazy migration to
using pinmaps without speeds. The work required to do this can be aided
by running tools/stm32_pinmap_tool.py. The tools will take a board.h
file and a legacy pinmap and output the required changes that one needs
to make to a board.h file.

Eventually, CONFIG_STM32L5_USE_LEGACY_PINMAP will be deprecated and the
legacy pinmaps removed from NuttX. Any new boards added should set
CONFIG_STM32L5_USE_LEGACY_PINMAP=n and fully define the pins in board.h

comment "STM32L5 Peripherals"

menu "STM32L5 Peripheral Support"
Expand Down
144 changes: 72 additions & 72 deletions arch/arm/src/stm32l5/hardware/stm32l562xx_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* Alternative pin selections are provided with a numeric suffix like _1, _2,
* etc. Drivers, however, will use the pin selection without the numeric
* suffix. Additional definitions are required in the board.h file. For
* example, if FDCAN1_RX connects vis PA11 on some board, then the following
* example, if FDCAN1_RX connects via PA11 on some board, then the following
* definitions should appear inthe board.h header file for that board:
*
* #define GPIO_FDCAN1_RX GPIO_FDCAN1_RX_1
Expand All @@ -49,22 +49,22 @@

/* ADC */

#define GPIO_ADC12_IN1 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN0)
#define GPIO_ADC12_IN2 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN1)
#define GPIO_ADC12_IN3 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN2)
#define GPIO_ADC12_IN4 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN3)
#define GPIO_ADC12_IN5 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN0)
#define GPIO_ADC12_IN6 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN1)
#define GPIO_ADC12_IN7 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN2)
#define GPIO_ADC12_IN8 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN3)
#define GPIO_ADC12_IN9 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN4)
#define GPIO_ADC12_IN10 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN5)
#define GPIO_ADC12_IN11 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN6)
#define GPIO_ADC12_IN12 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN7)
#define GPIO_ADC12_IN13 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN4)
#define GPIO_ADC12_IN14 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN5)
#define GPIO_ADC12_IN15 (GPIO_ANALOG|GPIO_PORTB|GPIO_PIN0)
#define GPIO_ADC12_IN16 (GPIO_ANALOG|GPIO_PORTB|GPIO_PIN1)
#define GPIO_ADC12_IN1_0 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN0)
#define GPIO_ADC12_IN2_0 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN1)
#define GPIO_ADC12_IN3_0 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN2)
#define GPIO_ADC12_IN4_0 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN3)
#define GPIO_ADC12_IN5_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN0)
#define GPIO_ADC12_IN6_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN1)
#define GPIO_ADC12_IN7_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN2)
#define GPIO_ADC12_IN8_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN3)
#define GPIO_ADC12_IN9_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN4)
#define GPIO_ADC12_IN10_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN5)
#define GPIO_ADC12_IN11_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN6)
#define GPIO_ADC12_IN12_0 (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN7)
#define GPIO_ADC12_IN13_0 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN4)
#define GPIO_ADC12_IN14_0 (GPIO_ANALOG|GPIO_PORTC|GPIO_PIN5)
#define GPIO_ADC12_IN15_0 (GPIO_ANALOG|GPIO_PORTB|GPIO_PIN0)
#define GPIO_ADC12_IN16_0 (GPIO_ANALOG|GPIO_PORTB|GPIO_PIN1)

/* FDCAN */

Expand All @@ -77,7 +77,7 @@

/* Clocks outputs */

#define GPIO_MCO (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN8)
#define GPIO_MCO_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN8)

/* Comparators */

Expand Down Expand Up @@ -171,11 +171,11 @@

/* JTAG */

#define GPIO_JTCK_SWCLK (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN14)
#define GPIO_JTDI (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN15)
#define GPIO_JTDO (GPIO_ALT|GPIO_AF0|GPIO_PORTB|GPIO_PIN3)
#define GPIO_JTMS_SWDAT (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN13)
#define GPIO_JTRST (GPIO_ALT|GPIO_AF0|GPIO_PORTB|GPIO_PIN4)
#define GPIO_JTCK_SWCLK_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN14)
#define GPIO_JTDI_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN15)
#define GPIO_JTDO_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTB|GPIO_PIN3)
#define GPIO_JTMS_SWDAT_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN13)
#define GPIO_JTRST_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTB|GPIO_PIN4)

/* OCTOSPI */

Expand Down Expand Up @@ -221,7 +221,7 @@

/* RTC */

#define GPIO_RTC_REFIN (GPIO_ALT|GPIO_AF0|GPIO_PORTB|GPIO_PIN15)
#define GPIO_RTC_REFIN_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTB|GPIO_PIN15)

/* SAI */

Expand Down Expand Up @@ -606,52 +606,52 @@
#define GPIO_TSC_SYNC_1 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN10)
#define GPIO_TSC_SYNC_2 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN2)

#define GPIO_TSC_G1_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN12)
#define GPIO_TSC_G1_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN13)
#define GPIO_TSC_G1_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN14)
#define GPIO_TSC_G1_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN3)

#define GPIO_TSC_G2_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN4)
#define GPIO_TSC_G2_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN5)
#define GPIO_TSC_G2_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN6)
#define GPIO_TSC_G2_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN7)

#define GPIO_TSC_G3_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN2)
#define GPIO_TSC_G3_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN10)
#define GPIO_TSC_G3_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN11)
#define GPIO_TSC_G3_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN12)

#define GPIO_TSC_G4_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN6)
#define GPIO_TSC_G4_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN7)
#define GPIO_TSC_G4_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN8)
#define GPIO_TSC_G4_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN9)

#define GPIO_TSC_G5_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN10)
#define GPIO_TSC_G5_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN11)
#define GPIO_TSC_G5_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN12)
#define GPIO_TSC_G5_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN13)

#define GPIO_TSC_G6_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN10)
#define GPIO_TSC_G6_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN11)
#define GPIO_TSC_G6_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN12)
#define GPIO_TSC_G6_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN13)

#define GPIO_TSC_G7_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN2)
#define GPIO_TSC_G7_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN3)
#define GPIO_TSC_G7_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN4)
#define GPIO_TSC_G7_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN5)

#define GPIO_TSC_G8_IO1 (GPIO_ALT|GPIO_AF9|GPIO_PORTF|GPIO_PIN14)
#define GPIO_TSC_G8_IO2 (GPIO_ALT|GPIO_AF9|GPIO_PORTF|GPIO_PIN15)
#define GPIO_TSC_G8_IO3 (GPIO_ALT|GPIO_AF9|GPIO_PORTG|GPIO_PIN0)
#define GPIO_TSC_G8_IO4 (GPIO_ALT|GPIO_AF9|GPIO_PORTG|GPIO_PIN1)
#define GPIO_TSC_G1_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN12)
#define GPIO_TSC_G1_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN13)
#define GPIO_TSC_G1_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN14)
#define GPIO_TSC_G1_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN3)

#define GPIO_TSC_G2_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN4)
#define GPIO_TSC_G2_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN5)
#define GPIO_TSC_G2_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN6)
#define GPIO_TSC_G2_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTB|GPIO_PIN7)

#define GPIO_TSC_G3_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN2)
#define GPIO_TSC_G3_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN10)
#define GPIO_TSC_G3_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN11)
#define GPIO_TSC_G3_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN12)

#define GPIO_TSC_G4_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN6)
#define GPIO_TSC_G4_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN7)
#define GPIO_TSC_G4_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN8)
#define GPIO_TSC_G4_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTC|GPIO_PIN9)

#define GPIO_TSC_G5_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN10)
#define GPIO_TSC_G5_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN11)
#define GPIO_TSC_G5_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN12)
#define GPIO_TSC_G5_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN13)

#define GPIO_TSC_G6_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN10)
#define GPIO_TSC_G6_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN11)
#define GPIO_TSC_G6_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN12)
#define GPIO_TSC_G6_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTD|GPIO_PIN13)

#define GPIO_TSC_G7_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN2)
#define GPIO_TSC_G7_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN3)
#define GPIO_TSC_G7_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN4)
#define GPIO_TSC_G7_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTE|GPIO_PIN5)

#define GPIO_TSC_G8_IO1_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTF|GPIO_PIN14)
#define GPIO_TSC_G8_IO2_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTF|GPIO_PIN15)
#define GPIO_TSC_G8_IO3_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTG|GPIO_PIN0)
#define GPIO_TSC_G8_IO4_0 (GPIO_ALT|GPIO_AF9|GPIO_PORTG|GPIO_PIN1)

#define GPIO_IR_OUT_1 (GPIO_ALT|GPIO_AF1|GPIO_PORTA|GPIO_PIN13)
#define GPIO_IR_OUT_2 (GPIO_ALT|GPIO_AF1|GPIO_PORTB|GPIO_PIN9)

/* Trace */

#define GPIO_TRACECK (GPIO_ALT|GPIO_AF0|GPIO_PORTE|GPIO_PIN2)
#define GPIO_TRACECK_0 (GPIO_ALT|GPIO_AF0|GPIO_PORTE|GPIO_PIN2)
#define GPIO_TRACED0_1 (GPIO_ALT|GPIO_AF0|GPIO_PORTC|GPIO_PIN1)
#define GPIO_TRACED0_2 (GPIO_ALT|GPIO_AF0|GPIO_PORTC|GPIO_PIN9)
#define GPIO_TRACED0_3 (GPIO_ALT|GPIO_AF0|GPIO_PORTE|GPIO_PIN3)
Expand Down Expand Up @@ -712,13 +712,13 @@
#define GPIO_UART4_TX_2 (GPIO_ALT|GPIO_AF8|GPIO_PORTC|GPIO_PIN10)
#define GPIO_UART4_RX_1 (GPIO_ALT|GPIO_AF8|GPIO_PORTA|GPIO_PIN1)
#define GPIO_UART4_RX_2 (GPIO_ALT|GPIO_AF8|GPIO_PORTC|GPIO_PIN11)
#define GPIO_UART4_CTS (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN7)
#define GPIO_UART4_RTS_DE (GPIO_ALT|GPIO_AF8|GPIO_PORTA|GPIO_PIN15)
#define GPIO_UART4_CTS_0 (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN7)
#define GPIO_UART4_RTS_DE_0 (GPIO_ALT|GPIO_AF8|GPIO_PORTA|GPIO_PIN15)

#define GPIO_UART5_TX (GPIO_ALT|GPIO_AF8|GPIO_PORTC|GPIO_PIN12)
#define GPIO_UART5_RX (GPIO_ALT|GPIO_AF8|GPIO_PORTD|GPIO_PIN2)
#define GPIO_UART5_CTS (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN5)
#define GPIO_UART5_RTS_DE (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN4)
#define GPIO_UART5_TX_0 (GPIO_ALT|GPIO_AF8|GPIO_PORTC|GPIO_PIN12)
#define GPIO_UART5_RX_0 (GPIO_ALT|GPIO_AF8|GPIO_PORTD|GPIO_PIN2)
#define GPIO_UART5_CTS_0 (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN5)
#define GPIO_UART5_RTS_DE_0 (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN4)

#define GPIO_LPUART1_TX_1 (GPIO_ALT|GPIO_AF8|GPIO_PORTA|GPIO_PIN2)
#define GPIO_LPUART1_TX_2 (GPIO_ALT|GPIO_AF8|GPIO_PORTB|GPIO_PIN11)
Expand All @@ -737,8 +737,8 @@

/* USB */

#define GPIO_USB_DM (GPIO_ALT|GPIO_AF10|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN11)
#define GPIO_USB_DP (GPIO_ALT|GPIO_AF10|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN12)
#define GPIO_USB_DM_0 (GPIO_ALT|GPIO_AF10|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN11)
#define GPIO_USB_DP_0 (GPIO_ALT|GPIO_AF10|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN12)
#define GPIO_USB_NOE_1 (GPIO_ALT|GPIO_AF10|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN13)
#define GPIO_USB_NOE_2 (GPIO_ALT|GPIO_AF10|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)

Expand Down
Loading

0 comments on commit ac6ad45

Please sign in to comment.