Skip to content

Conversation

@gmarull
Copy link
Member

@gmarull gmarull commented Oct 14, 2021

This PR adds an initial implementation of a pinctrl driver for STM32 based on the pinctrl API proposal in #37572. The driver is based on the existing pinmux driver and supports both F1 and non-F1 series.

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 <[email protected]>
Use the new pinctrl API to configure pins.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
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 <[email protected]>
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 <[email protected]>
@gmarull
Copy link
Member Author

gmarull commented Oct 26, 2021

@erwango should now be ready, but I haven't tested if latest additions to the pinmux driver work all as expected, feel free to take this PR if you want. I'm not sure what is the approach you want to follow. Since migration is easy in this case, all drivers could be ported to avoid coexistence of CONFIG_PINCTRL=y and CONFIG_PINMUX=y.

@carlescufi carlescufi mentioned this pull request Oct 26, 2021
29 tasks
@erwango
Copy link
Member

erwango commented Nov 5, 2021

FYI, on going on my side, should be completed next week

@gmarull
Copy link
Member Author

gmarull commented Nov 9, 2021

Superseded by #40194

@gmarull gmarull closed this Nov 9, 2021
@gmarull gmarull deleted the pinctrl-stm32 branch November 9, 2021 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants