Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32: Transition to device tree based pinctrl configuration #28999

Closed
erwango opened this issue Oct 7, 2020 · 9 comments · Fixed by #29723
Closed

STM32: Transition to device tree based pinctrl configuration #28999

erwango opened this issue Oct 7, 2020 · 9 comments · Fixed by #29723
Assignees
Labels
Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32
Milestone

Comments

@erwango
Copy link
Member

erwango commented Oct 7, 2020

Following merge of #25996, STM32 boards should now be converted to the use of device tree pinctrl definitions.

This ticket aims at tracking the task completion:

Drivers (PR) Status Boards Status Macros deprecation Status
Serial (#25996) Merged #28954, #28940 Merged #29723 Review
PWM (#28858) Merged #28858 Merged - -
I2C (#29057) Merged #29151 Merged - -
SPI (#29231) Merged #29267 Merged - -
I2S (#29484) Merged #29484 Merged - -
ADC (#29112) Merged #29112 Merged - -
DAC (#29037) Merged #29037 Merged - -
Ethernet (#29246) Merged #29246 Merged - -
CAN (#29076) Merged #29076 Merged - -
USB (#29403) Merged #29431 Merged - -
SDMMC (#29477) Merged #29477 Merged - -

For all people that would like to help on this task:
Thanks! But also:
Zephyr github CI could easily be swamped by changes impacting several boards.
Since this task might create numerous PRs impacting lot of boards, please tests changes locally before submission:

./scripts/sanitycheck -T samples/hello_world/ --cmake-only -l -a arm

Noteworthy related PRs

#29057 (merged):

  • Introduced a DT helper macro renaming from ST_STM32_DT_PINCTRL to ST_STM32_DT_INST_PINCTRL
  • ST_STM32_DT_PINCTRL could now be used for drivers that can't use device instances in driver init macros

#29055 (merged):

  • GPIO driver impact due to late pin initialization timing

zephyrproject-rtos/hal_stm32#73 (merged):

  • Required to get all STM32F1 signals

#29276

  • Centralize F1 remap code
  • Rework stm32_dt_pinctrl API into a single function stm32_dt_pinctrl_configure
@erwango erwango added the Enhancement Changes/Updates/Additions to existing features label Oct 7, 2020
@erwango erwango added this to the v2.5.0 milestone Oct 7, 2020
@erwango erwango self-assigned this Oct 7, 2020
@erwango erwango added the platform: STM32 ST Micro STM32 label Oct 7, 2020
@galak
Copy link
Collaborator

galak commented Oct 7, 2020

I'm also doing a test to see if we maybe split board changes into 3 groups (nucleo, stm32, other) w/regards to PRs will pass CI.

@galak
Copy link
Collaborator

galak commented Oct 7, 2020

@erwango / @lochej / @gmarull I've worked up a python script to convert pinmux.c into .dts. Seems to work for a good number of cases (I2C, SPI, ADC, DAC, I2S). There are some corner cases that need some discussion / understanding.

@gmarull
Copy link
Member

gmarull commented Oct 7, 2020

It would be great if you can share the script @galak . Once all boards get the right pinctrl included (I guess it will be the case after uart PR) it will help a lot. I can take a couple more drivers, it’s rather quick to add support for pinctrl, so together with the script we can finally get rid of pinmux in a few days :-)

@galak
Copy link
Collaborator

galak commented Oct 8, 2020

It would be great if you can share the script @galak . Once all boards get the right pinctrl included (I guess it will be the case after uart PR) it will help a lot. I can take a couple more drivers, it’s rather quick to add support for pinctrl, so together with the script we can finally get rid of pinmux in a few days :-)

Happy to share, just need to figure out best way to do that:

Here are some areas that we need to look into:

I2C: [I2C2 missing]
nucleo_f030r8 - pinmux.c wrong?
stm32vl_disco - STM32F100RBT6B - GPIO-STM32F100x8_gpio_v1_0_Modes.xml missing I2C2?
stm32_min_dev_black (stm32f103xb) / stm32_min_dev_blue (stm32f103xb)/ olimexino_stm32 / olimex_stm32_h103 - GPIO-STM32F103x8_gpio_v1_0_Modes.xml missing I2C2?
waveshare_open103z - GPIO-STM32F103xC_gpio_v1_0_Modes.xml missing I2C2

CAN:
waveshare_open103z [can missing]
olimexino_stm32 [can missing]
stm32f3_disco [can missing]
stm32f072b_disco [can missing]
nucleo_l452re [can/can1]
nucleo_l452re_p [can/can1]

USB:
disco_l475_iot1 - missing usb_otg_fs_id_*
b_l4s5i_iot01a - missing usb_otg_fs_id_*
nucleo_l4r5zi - missing usb_otg_fs_id_*
waveshare_open103z - usb_dm_* missing
nucleo_wb55rg - usb_dm_* missing

@galak
Copy link
Collaborator

galak commented Oct 8, 2020

Here the current script:

https://github.com/galak/zephyr/tree/st-pin-convert
https://raw.githubusercontent.com/galak/zephyr/695016205558bd3b1c2711b46bf5af842ccb5a2b/boards/arm/st-pin-convert.py

Its kinda in a hackish state and currently line 29 can be hacked to enable different driver classes (mac/sdmmc1 don't have any pins define in the dtsi files right now so they don't do anything).

@martinjaeger
Copy link
Member

Just implemented the DAC part and updated the table. I think we can summarize all board updates into a single commit, as it's only a few lines of code changed in most cases.

I can look into the CAN driver later (or tomorrow) as I'm working on that anyway at the moment.

@galak
Copy link
Collaborator

galak commented Oct 8, 2020

Just implemented the DAC part and updated the table. I think we can summarize all board updates into a single commit, as it's only a few lines of code changed in most cases.

I can look into the CAN driver later (or tomorrow) as I'm working on that anyway at the moment.

@martinjaeger for CAN be aware of zephyrproject-rtos/hal_stm32#70

@erwango
Copy link
Member Author

erwango commented Oct 8, 2020

@galak, @gmarull, @lochej, @martinjaeger
Please note important change done in API in #29057

@KozhinovAlexander
Copy link
Collaborator

KozhinovAlexander commented Oct 13, 2020

@gmarull

Just tested ETH pinctrl dt generation for STM32 as follows (add modules/hal/stm32/scripts/genpinctrl/stm32-pinctrl-config.yaml):

- name: ETH
  match: "^ETH_*"
  mode: alternate
  bias: disable

Could we give it a try?

Just for info: For h7series all the pins have very high speed, no push-pull and AF11 (see zephyr/drivers/pinmux/stm32/pinmux_stm32h7.h)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants