Skip to content

Conversation

@erwango
Copy link
Member

@erwango erwango commented Nov 17, 2021

Add a pinctrl API which allows usage of custom reg in pinctrl_dev_config definition.

Additionaly, update STM32 PWM driver to use pinctrl API in general and this new API in particular.

Based on #40194, only consider the 4 last commits

gmarull and others added 10 commits November 17, 2021 16:32
Add initial version for STM32 pinctrl driver. Driver has been written
re-using many of the already existing parts in
drivers/pinmux/pinmux_stm32.c.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Use the new pinctrl API to configure pins.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Enable the pin control driver on all STM32 based boards. The following
script has been used to do this task:

```
from pathlib import Path
import re

for fpath in Path(".").glob("boards/arm/**/*_defconfig"):
    lines = open(fpath).readlines()

    is_stm32 = False
    for line in lines:
        if "CONFIG_SOC_SERIES_STM32" in line:
            is_stm32 = True
            break

    if not is_stm32:
        continue

    lines += ["\n", "# enable pin controller\n", "CONFIG_PINCTRL=y\n"]

    with open(fpath, "w") as f:
        f.writelines(lines)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add the pinctrl state name (default) for the UART/USART/LPUART
peripherals. Changes performed using the following Python script run
from the repository root:

```
from pathlib import Path
import re

for fpath in Path(".").glob("boards/arm/**/*.dts"):
    lines = open(fpath).readlines()

    is_stm32 = False
    for line in lines:
        if "stm32" in line:
            is_stm32 = True
            break

    if not is_stm32:
        continue

    with open(fpath, "w") as f:
        for line in lines:
            f.write(line)

            m = re.match(r"(\s+)pinctrl-0.*us?art.*", line)
            if m:
                f.write(m.group(1) + "pinctrl-names = \"default\";\n")
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Add the pinctrl state name (default) for the ADC peripherals.
Changes performed based on the script proposed in
"boards: arm: stm32: add pinctrl state name for UART peripheral"

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Add the pinctrl state name (default) for the CAN peripherals.
Changes performed based on the script proposed in
"boards: arm: stm32: add pinctrl state name for UART peripheral"

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Add the pinctrl state name (default) for the FDCAN peripherals.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
@erwango
Copy link
Member Author

erwango commented Nov 19, 2021

Closing in favor of #40515

@erwango erwango closed this Nov 19, 2021
@erwango erwango deleted the dev_pinctrl_stm32_pwm branch January 19, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ADC Analog-to-Digital Converter (ADC) area: Boards area: Build System area: CAN area: DAC Digital-to-Analog Converter area: Devicetree area: Disk Access area: Ethernet area: Flash area: I2C area: I2S area: PWM Pulse Width Modulation area: SPI SPI bus area: UART Universal Asynchronous Receiver-Transmitter area: USB Universal Serial Bus platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants