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

spi: stm32: convert remaining boards that support SPI to using dts #5836

Closed
2 of 8 tasks
dwagenk opened this issue Jan 26, 2018 · 6 comments · Fixed by #5883
Closed
2 of 8 tasks

spi: stm32: convert remaining boards that support SPI to using dts #5836

dwagenk opened this issue Jan 26, 2018 · 6 comments · Fixed by #5883
Labels
area: Boards area: Devicetree area: SPI SPI bus Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32

Comments

@dwagenk
Copy link
Contributor

dwagenk commented Jan 26, 2018

As a follow up to #5582 we need to convert the stm32 boards, that already support SPI to using dts for SPI configuration.
Right now building e.g. tests\drivers\spi\spi_loopback for nucleo_f091rc fails, because spi_ll_stm32.c driver relies on SPI_BASE_ADDRESS, SPINAME, SPIIRQ and SPI_IRQ_PRI wich are not defined yet for this board.

I guess this affects the following boards (i generated this list by searching which boards are stm32 based and have a default pinmux for SPI in their pinmux.c):

  • 96b_carbon
  • 96b_neonkey
  • disco_l475_iot1
  • nucleo_f091rc
  • nucleo_f334r8
  • nucleo_f401re
  • nucleo_l432kc
  • nucleo_l476rg
@erwango
Copy link
Member

erwango commented Jan 26, 2018

As part of this issue, it would be good to populate .fixup files under dts rather than in boards.
(and move existing SPI .fixup parts)
Would contribute to #5707

@dwagenk
Copy link
Contributor Author

dwagenk commented Jan 29, 2018

I've got a question regarding what to enable per default. Since dts.fixup is now moved to soc family level, there's not much work left for enabling SPI on these boards again.
What is the effect of

&spiX {
	status = "ok";
};

in dts? Right now it doesn't matter, if I add it to .dts, as long as the CONFIG_SPI_X is set, it works (as long as it doesn't use some undefined PINMUX definitions).
Should all spiX that are present on a board be populated with status = "ok"; in boards dts file? or just the ones that are enabled by default when CONFIG_SPI is set?
I tried to just follow the way it is done for I2C, but it is not consistent there either.


if this is correct, then we can close this issue without any further action, because SPI on these boards work correctly, as long as CONFIG_SPI and CONFIG_SPI_X are set, right?

@ydamigos
Copy link
Collaborator

@dwagenk It enables the generation of the following defines:

#define ST_STM32_SPI_XXXXXXX_BASE_ADDRESS_0
#define ST_STM32_SPI_XXXXXXX_BASE_ADDRESS_1
#define ST_STM32_SPI_XXXXXXX_IRQ_0
#define ST_STM32_SPI_XXXXXXX_IRQ_0_PRIORITY
#define ST_STM32_SPI_XXXXXXX_LABEL
#define ST_STM32_SPI_XXXXXXX_BASE_ADDRESS

For now, we need to enable spiX both in boards dts file and in Kconfig file. Later, it should be done only in boards dts file.

PR #5865 introduce a new approach and checks if CONFIG_SPIX_BASE_ADDRESS is defined in the driver to enable SPIX device.

@dwagenk
Copy link
Contributor Author

dwagenk commented Jan 29, 2018

OK, so for now I would add status = "ok"; to dts for all SPIs that a board supports and then just activate one of them as defualt SPI in boards Kconfig.default.
Sounds good?

@ydamigos
Copy link
Collaborator

Yes, the ones that the board enables in Kconfig.defconfig.

@dwagenk
Copy link
Contributor Author

dwagenk commented Jan 29, 2018

OK, thanks for the clarification!

@nashif nashif added the Enhancement Changes/Updates/Additions to existing features label Feb 6, 2018
galak pushed a commit that referenced this issue Feb 20, 2018
Configure SPI using DT for the following STM32 boards:

96b_neonkey
nucleo_f091rc
nucleo_f334r8
nucleo_f401re
nucleo_l432kc
nucleo_l476rg

SPI nodes in <board>.dts file are populated matching boards existing
pinmux default configuration and enabled in Kconfig.defconfig if
SPI is enabled.

For nucleo_l476rg board SPI2 and SPI3 nodes are not yet added, because
of missing pinmux defines.

Fixes #5836

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: Devicetree area: SPI SPI bus 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.

4 participants