Skip to content

Commit cb51abc

Browse files
committed
fix: scripts: mp1 series eth pin config
STM32MP1 series has different Ethernet namings than what is specified in stm32-pinctrl-config.yaml, so I did put another config file with one regex; `ETH[12]_(CLK|COL|CRS|CRS_DV|GTX_CLK|MDC|MDIO|PHY_INTN|PPS_OUT|REF_CLK|RX_CLK|RX_CTL|RX_DV|RX_ER|RXD|TX_CLK|TX_CTL|TX_EN|TX_ER|TXD)` Signed-off-by: Arif Balik <[email protected]>
1 parent 468e5ad commit cb51abc

File tree

2 files changed

+245
-0
lines changed

2 files changed

+245
-0
lines changed

scripts/genpinctrl/genpinctrl.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
CONFIG_F1_FILE = SCRIPT_DIR / "stm32f1-pinctrl-config.yaml"
4040
"""Configuration file for F1 series."""
4141

42+
CONFIG_MP1_FILE = SCRIPT_DIR / "stm32mp1-pinctrl-config.yaml"
43+
"""Configuration file for MP1 series."""
44+
4245
PINCTRL_TEMPLATE = "pinctrl-template.j2"
4346
"""pinctrl template file."""
4447

@@ -597,6 +600,9 @@ def main(data_path, output):
597600
with open(CONFIG_F1_FILE) as f:
598601
config_f1 = yaml.load(f, Loader=yaml.Loader)
599602

603+
with open(CONFIG_MP1_FILE) as f:
604+
config_mp1 = yaml.load(f, Loader=yaml.Loader)
605+
600606
env = Environment(
601607
trim_blocks=True, lstrip_blocks=True, loader=FileSystemLoader(SCRIPT_DIR)
602608
)
@@ -643,6 +649,8 @@ def main(data_path, output):
643649
for signal in pin["signals"]:
644650
if family == "STM32F1":
645651
selected_config = config_f1
652+
elif family == "STM32MP1":
653+
selected_config = config_mp1
646654
else:
647655
selected_config = config
648656

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Configuration file for pinctrl generation (MP1 series only).
2+
#
3+
# This file contains a list of pin configuration templates used to generate the
4+
# pinctrl files. Each entry can have the following fields:
5+
#
6+
# - name (mandatory): This is the pin function name, e.g. UART_TX. It is used
7+
# to group pin configurations alphabetically in the generated pinctrl files.
8+
#
9+
# - match (mandatory): This is a regular expression used to match against
10+
# STM32 xml database pin configuration names. The regular expression should
11+
# be as precise as possible. Note that it needs to be escaped here in the
12+
# configuration file.
13+
# Note: Specific "ANALOG" value allows generation of analog pins
14+
# configuration
15+
#
16+
# - mode (optional): Mode setting (analog, alternate). Mode needs to
17+
# be set according to the following rules:
18+
# * Pin operates in analog configuration: analog
19+
# * Pin operates in alternate function configuration: alternate
20+
# In default case, mode could be infered from CubeMX SoC description files
21+
# and can be omitted.
22+
#
23+
# - bias (optional): Bias setting (disable, pull-up, pull-down). Equivalent to
24+
# "disable" (a.k.a floating) if not set.
25+
#
26+
# - drive (optional): Drive setting (push-pull, open-drain). Equivalent to
27+
# "push-pull" if not set.
28+
#
29+
# - slew-rate (optional): Slew rate setting (low-speed, medium-speed,
30+
# high-speed, very-high-speed). Equivalent to "low-speed" if not set.
31+
#
32+
# - variant (optional): Defines an alternative pin configuration. This is used
33+
# to provide multiple configurations of a pin function (slave, master,
34+
# low-power, ...).
35+
#
36+
37+
---
38+
- name: Analog
39+
match: "ANALOG"
40+
mode: analog
41+
42+
- name: ADC_IN / ADC_INN / ADC_INP
43+
match: "^ADC(?:\\d+)?_IN[NP]?\\d+$"
44+
45+
- name: ADC_VINM / ADC_VINP
46+
match: "^ADC(?:\\d+)?_VIN[PM]\\d+$"
47+
48+
- name: CAN_RX
49+
match: "^CAN\\d*_RX$"
50+
bias: pull-up
51+
52+
- name: CAN_TX
53+
match: "^CAN\\d*_TX$"
54+
55+
- name: DAC_OUT
56+
match: "^DAC(?:\\d+)?_OUT\\d+$"
57+
58+
- name: DCMI
59+
match: "^DCMI_(?:HSYNC|PIXCLK|VSYNC|D(?:[0-9]|1[0-3]))$"
60+
slew-rate: very-high-speed
61+
62+
- name: DCMIPP
63+
match: "^DCMIPP_(?:HSYNC|PIXCLK|VSYNC|D(?:[0-9]|1[0-5]))$"
64+
slew-rate: very-high-speed
65+
66+
- name: DFSDM
67+
match: "^DFSDM[1-2]_(DATIN[0-7]|CKIN[0-7]|CKOUT)$"
68+
slew-rate: very-high-speed
69+
mode: alternate
70+
71+
- name: ETH
72+
match: "^ETH[12]_(CLK|COL|CRS|CRS_DV|GTX_CLK|MDC|MDIO|PHY_INTN|PPS_OUT|REF_CLK|RX_CLK|RX_CTL|RX_DV|RX_ER|RXD[0-3]|TX_CLK|TX_CTL|TX_EN|TX_ER|TXD[0-3])$"
73+
slew-rate: very-high-speed
74+
75+
- name: FDCAN_RX
76+
match: "^FDCAN\\d+_RX$"
77+
78+
- name: FDCAN_TX
79+
match: "^FDCAN\\d+_TX$"
80+
81+
- name: FMC
82+
match: "^FMC_(?:NL|NADV|CLK|NBL[0-3]|A\\d+|D\\d+|NE[1-4]|NOE|NWE|NWAIT|NCE|INT|SDCLK|SDNWE|SDCKE[0-1]|SDNE[0-1]|SDNRAS|SDNCAS)$"
83+
bias: pull-up
84+
slew-rate: very-high-speed
85+
86+
- name: HRTIM_CH
87+
match: "^HRTIM\\d+_CH[A-F]\\d+$"
88+
89+
- name: HRTIM_EEV
90+
match: "^HRTIM\\d+_EEV\\d+$"
91+
92+
- name: HRTIM_FLT
93+
match: "^HRTIM\\d+_FLT[A-F]\\d+$"
94+
95+
- name: HRTIM_SCIN / HRTIM_SCOUT
96+
match: "^HRTIM\\d+_SC(IN|OUT)$"
97+
98+
- name: HSPI
99+
match: "^HSPI(.*)(?:CLK|NCS|DQS[0-1]|IO\\d+)$"
100+
slew-rate: very-high-speed
101+
102+
- name: I2C_SCL
103+
match: "^I2C\\d+_SCL$"
104+
drive: open-drain
105+
bias: pull-up
106+
107+
- name: I2C_SDA
108+
match: "^I2C\\d+_SDA$"
109+
drive: open-drain
110+
bias: pull-up
111+
112+
- name: I2C_SMBA
113+
match: "^I2C\\d+_SMBA$"
114+
bias: pull-up
115+
116+
- name: I2S_MCK
117+
match: "^I2S\\d+_MCK$"
118+
slew-rate: very-high-speed
119+
120+
- name: I2S_CK
121+
match: "^I2S\\d+_CK$"
122+
slew-rate: very-high-speed
123+
124+
- name: I2S_WS
125+
match: "^I2S\\d+_WS$"
126+
127+
- name: I2S_SD
128+
match: "^I2S\\d+_SD$"
129+
130+
- name: I3C_SCL
131+
match: "^I3C\\d+_SCL$"
132+
slew-rate: very-high-speed
133+
134+
- name: I3C_SDA
135+
match: "^I3C\\d+_SDA$"
136+
slew-rate: very-high-speed
137+
138+
- name: JTAG PORT
139+
match: ^(SYS|DEBUG)_((JTMS-)?SWDIO|(JTCK-)?SWCLK|JTDI|JTDO(-TRACESWO|-SWO)?|(N)?JTRST)$
140+
141+
- name: LTDC
142+
match: "^LTDC_(?:DE|CLK|HSYNC|VSYNC|R[0-7]|G[0-7]|B[0-7])$"
143+
144+
- name: OCTOSPI
145+
match: "^OCTOSPI(.*)(?:CLK|NCS|DQS|IO[0-7])$"
146+
slew-rate: very-high-speed
147+
148+
- name: RCC_MCO
149+
match: "^RCC_MCO_?(\\d+)?$"
150+
mode: alternate
151+
slew-rate: very-high-speed
152+
153+
- name: QUADSPI
154+
match: "^QUADSPI(\\d+)?_(?:CLK|NCS|BK1_NCS|BK1_IO[0-3]|BK2_NCS|BK2_IO[0-3])$"
155+
slew-rate: very-high-speed
156+
157+
- name: XSPIM
158+
match: "^XSPIM(.*)(?:CLK|NCS[1-2]|DQS[0-1]|IO\\d+)$"
159+
slew-rate: very-high-speed
160+
161+
- name: SAI
162+
match: "^SAI\\d+_(?:D\\d+)?(?:CK\\d+)?(?:FS_A)?(?:FS_B)?(?:MCLK_A)?(?:MCLK_B)?(?:SD_A)?(?:SD_B)?(?:SCK_A)?(?:SCK_B)?(?:EXTCLK)?$"
163+
164+
- name: SDMMC
165+
match: "^SDMMC\\d+_(?:CK)?(?:CKIN)?(?:CDIR)?(?:CMD)?(?:D\\d+)?(?:D0DIR)?(?:D123DIR)?$"
166+
slew-rate: very-high-speed
167+
bias: pull-up
168+
169+
- name: SDIO
170+
match: "^SDIO_(?:CK)?(?:CKIN)?(?:CDIR)?(?:CMD)?(?:D\\d+)?(?:D0DIR)?(?:D123DIR)?$"
171+
slew-rate: very-high-speed
172+
bias: pull-up
173+
174+
- name: SPI_MISO
175+
match: "^SPI\\d+_MISO$"
176+
bias: pull-down
177+
178+
- name: SPI_MOSI
179+
match: "^SPI\\d+_MOSI$"
180+
bias: pull-down
181+
182+
# NOTE: The SPI_SCK pins speed must be set to very-high-speed to avoid last data
183+
# bit corruption which is a known issue on multiple STM32F4 series SPI
184+
# peripheral (ref. ES0182 Rev 12, 2.5.12, p. 22).
185+
- name: SPI_SCK
186+
match: "^SPI\\d+_SCK$"
187+
slew-rate: very-high-speed
188+
bias: pull-down
189+
190+
- name: SPI_NSS
191+
match: "^SPI\\d+_NSS$"
192+
bias: pull-up
193+
194+
- name: TIM_BKIN
195+
match: "^TIM\\d+_BKIN\\d?$"
196+
197+
- name: TIM_CH / TIM_CHN
198+
match: "^TIM\\d+_CH\\d+N?$"
199+
200+
- name: TSC
201+
match: "^TSC_(?:G\\d+_IO\\d+|SYNC)$"
202+
203+
- name: UART_CTS / USART_CTS / LPUART_CTS
204+
match: "^(?:LP)?US?ART\\d+_CTS$"
205+
bias: pull-up
206+
207+
- name: UART_RTS / USART_RTS / LPUART_RTS
208+
match: "^(?:LP)?US?ART\\d+_RTS$"
209+
drive: push-pull
210+
211+
- name: UART_DE / USART_DE / LPUART_DE
212+
match: "^(?:LP)?US?ART\\d+_DE$"
213+
drive: push-pull
214+
215+
- name: UART_TX / USART_TX / LPUART_TX
216+
match: "^(?:LP)?US?ART\\d+_TX$"
217+
bias: pull-up
218+
219+
- name: UART_RX / USART_RX / LPUART_RX
220+
match: "^(?:LP)?US?ART\\d+_RX$"
221+
222+
- name: UCPD
223+
match: "^UCPD\\d+_CC\\d+N?$"
224+
mode: analog
225+
226+
- name: USB_OTG_FS
227+
match: "^USB_OTG_FS_(?:DM)?(?:DP)?(?:SOF)?(?:ID)?(?:VBUS)?$"
228+
229+
- name: USB_OTG_HS
230+
match: "^USB_OTG_HS_(?:DM)?(?:DP)?(?:SOF)?(?:ID)?(?:VBUS)?$"
231+
232+
- name: USB_OTG_HS_ULPI
233+
match: "^USB_OTG_HS_ULPI_(?:CK)?(?:DIR)?(?:STP)?(?:NXT)?(?:D\\d+)?$"
234+
slew-rate: high-speed
235+
236+
- name: USB
237+
match: "^USB_(?:DM)?(?:DP)?(?:NOE)?$"

0 commit comments

Comments
 (0)