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

gpio/stm32: use dts extracted information to populate instances settings #10629

Closed
erwango opened this issue Oct 16, 2018 · 1 comment
Closed
Labels
area: GPIO Enhancement Changes/Updates/Additions to existing features Good first issue Good for a first time contributor to take platform: STM32 ST Micro STM32

Comments

@erwango
Copy link
Member

erwango commented Oct 16, 2018

STM32 gpio driver does not use dts generated defines for instances configuration:

	GPIO_DEVICE_INIT("GPIO" #__SUFFIX, __suffix,			\
			 GPIO##__SUFFIX##_BASE, STM32_PORT##__SUFFIX,	\
			 LL_APB2_GRP1_PERIPH_AFIO |			\
			 STM32_PERIPH_GPIO##__SUFFIX,			\
			 STM32_CLOCK_BUS_GPIO)

When possible replace with information extracted from dts:

/* gpio@48001c00 */
#define ST_STM32_GPIO_48001C00_BASE_ADDRESS		0x48001c00
#define ST_STM32_GPIO_48001C00_CLOCK_BITS_0		128
#define ST_STM32_GPIO_48001C00_CLOCK_BUS_0		1
#define ST_STM32_GPIO_48001C00_CLOCK_CONTROLLER		"STM32_CLK_RCC"
#define ST_STM32_GPIO_48001C00_LABEL			"GPIOH"
#define ST_STM32_GPIO_48001C00_SIZE			1024
#define ST_STM32_GPIO_48001C00_CLOCK_BITS		ST_STM32_GPIO_48001C00_CLOCK_BITS_0
#define ST_STM32_GPIO_48001C00_CLOCK_BUS		ST_STM32_GPIO_48001C00_CLOCK_BUS_0

To do this, matching configuration CONFIG_ should be declared in various soc/arm/st_stm32/stm32xx/dts_fixup.hfiles

@erwango erwango added area: GPIO platform: STM32 ST Micro STM32 Good first issue Good for a first time contributor to take labels Oct 16, 2018
@nashif nashif added the Enhancement Changes/Updates/Additions to existing features label Oct 16, 2018
@everclear72216
Copy link
Contributor

I'd like to give this one a shot for my debut.

everclear72216 added a commit to everclear72216/zephyr that referenced this issue Oct 31, 2018
The information extracted from the device tree is now used to initialize
GPIO device instances. Up until now the GPIO device driver made no use
of this information. Actual instance creation is still controlled using
the Kconfig method. Missing GPIO device tree nodes were added in the
process for STM32L073, STM32F413 and STM32F373.

The information for gpio instance initialization has already been
present for supported STM32 SoCs but remained unused. Changes in the
device tree had no effect on GPIO functionality and was essentially
redundant. Using the device tree for hardware description seems
plausible and less painful than a myriad of defines in some SoC
description header.

The change was implemented under the assumption that current device
trees provide a correct description of the SoCs. Base register addresses
and RCC register bits were not explicitly checked for each device.

Manual tests were executed on:
	- NUCLEO-F103RB
	- STM32F429I-DISCO
	- STM32F746G-DISCO
	- NUCLEO-F767ZI

Manual tests consisted of blinky on different GPIOs and pins on each
board.

sanitycheck was executed for all STM32 based boards

Fixes: zephyrproject-rtos#10629

Signed-off-by: Martin Bertsche <martin72216@googlemail.com>
galak pushed a commit that referenced this issue Nov 9, 2018
The information extracted from the device tree is now used to initialize
GPIO device instances. Up until now the GPIO device driver made no use
of this information. Actual instance creation is still controlled using
the Kconfig method. Missing GPIO device tree nodes were added in the
process for STM32L073, STM32F413 and STM32F373.

The information for gpio instance initialization has already been
present for supported STM32 SoCs but remained unused. Changes in the
device tree had no effect on GPIO functionality and was essentially
redundant. Using the device tree for hardware description seems
plausible and less painful than a myriad of defines in some SoC
description header.

The change was implemented under the assumption that current device
trees provide a correct description of the SoCs. Base register addresses
and RCC register bits were not explicitly checked for each device.

Manual tests were executed on:
	- NUCLEO-F103RB
	- STM32F429I-DISCO
	- STM32F746G-DISCO
	- NUCLEO-F767ZI

Manual tests consisted of blinky on different GPIOs and pins on each
board.

sanitycheck was executed for all STM32 based boards

Fixes: #10629

Signed-off-by: Martin Bertsche <martin72216@googlemail.com>
nashif pushed a commit that referenced this issue Nov 13, 2018
The information extracted from the device tree is now used to initialize
GPIO device instances. Up until now the GPIO device driver made no use
of this information. Actual instance creation is still controlled using
the Kconfig method. Missing GPIO device tree nodes were added in the
process for STM32L073, STM32F413 and STM32F373.

The information for gpio instance initialization has already been
present for supported STM32 SoCs but remained unused. Changes in the
device tree had no effect on GPIO functionality and was essentially
redundant. Using the device tree for hardware description seems
plausible and less painful than a myriad of defines in some SoC
description header.

The change was implemented under the assumption that current device
trees provide a correct description of the SoCs. Base register addresses
and RCC register bits were not explicitly checked for each device.

Manual tests were executed on:
	- NUCLEO-F103RB
	- STM32F429I-DISCO
	- STM32F746G-DISCO
	- NUCLEO-F767ZI

Manual tests consisted of blinky on different GPIOs and pins on each
board.

sanitycheck was executed for all STM32 based boards

Fixes: #10629

Signed-off-by: Martin Bertsche <martin72216@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: GPIO Enhancement Changes/Updates/Additions to existing features Good first issue Good for a first time contributor to take platform: STM32 ST Micro STM32
Projects
None yet
Development

No branches or pull requests

3 participants