stm32_gpio: move to pinctrl framework - #6050
Closed
etienne-lms wants to merge 26 commits into
Closed
Conversation
etienne-lms
marked this pull request as draft
May 26, 2023 07:54
Contributor
Author
|
I convert this P-R into DRAF mode as the series is a bit long and I fear it will take time to land. I also wanted to push another P-R for intergrating There fore I plan is rather to keep this P-R for the big picture and create samller P-Rs for step by step integration of these 2 features. |
NOTE: change under review at OP-TEE#6052 Adds an helper function (dt_stm32_gpio_bank()) to register GPIO banks in stm32_gpio driver based on DT pinctrl nodes. GPIO banks are registered in a local list from which will be later used to find a bank based on its ID number. The function is expected to be called from the driver probe sequence. The function ensures a bank is not registered twice. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
NOTE: change under review at OP-TEE#6052 This change makes stm32_gpio driver to register GPIO bank when the driver of probed on compatible pin control instances found in the device tree. This change however does not yet register pinctrl providers to DT_DRIVER framework. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
NOTE: change under review at OP-TEE#6052 Fixes the names of the macro used as stm32_gpio.h header file guard. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
NOTE: under review at OP-TEE#6041 Renames struct dt_driver_phandle_args to struct dt_pargs to shorten the label and prevent ugly line breaks in function signatures. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
NOTE: under review at OP-TEE#6049 Fixes pinctrl_free_state() when CFG_DRIVERS_PINCTRL is disabled as the API function has no return value. The issue is reported by GCC with an error trace like the below: core/include/drivers/pinctrl.h: In function ‘pinctrl_free_state’: lib/libutee/include/tee_api_defines.h:117:43: error: ‘return’ with a value, in function returning void [-Werror=return-type] 117 | #define TEE_ERROR_NOT_SUPPORTED 0xFFFF000A | ^~~~~~~~~~ core/include/drivers/pinctrl.h:158:16: note: in expansion of macro ‘TEE_ERROR_NOT_SUPPORTED’ 158 | return TEE_ERROR_NOT_SUPPORTED; | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from core/include/drivers/stm32_uart.h:10, from core/arch/arm/plat-stm32mp1/main.c:14: core/include/drivers/pinctrl.h:156:6: note: declared here 156 | void pinctrl_free_state(struct pinctrl_state *state __unused) | ^~~~~~~~~~~~~~~~~~ Fixes: 9aec039 ("drivers: pinctrl: add pinctrl support") Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
NOTE: under review at OP-TEE#6053 Get output data pin configuration from DT node property "output-high" and "output-low". Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
NOTE: under review at OP-TEE#6056 Adds a put operation handler for a GPIO consumer driver to be able to release the GPIO resources it has allocated when getting its GPIO. This is needed for example, when such a consumer driver must defer its probe sequence and will get again its GPIO making gpio_dt_alloc_pin() to be called again. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Changes stm32_gpio driver to register GPIO provider resources for each GPIO bank registered when CFG_DRIVERS_GPIO is enabled. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Enables CFG_DRIVERS_GPIO for platform stm32mp1. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes stm32_gpio API functions to access GPIOs as the driver has moved to the generic GPIO framework and consumer driver should use the generic API to access GPIOs. The driver now expects CFG_DRIVERS_GPIO is enabled. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Changes stm32_gpio driver to support generic pin control framework (CFG_DRIVERS_PINCTRL=y). Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Adds helper function stm32_gpio_pinctrl_bank_pin() to get an array of bank and pin IDs related to a pin control state. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Adds helper function stm32_pinctrl_set_secure_cfg() to set the GPIO pin secure state (secure or non-secure) for each pin referenced by a pin control state. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Adds shared resources helper functions stm32mp_register_secure_pinctrl() and stm32mp_register_non_secure_pinctrl() for when a platform driver registers pins from a pin control state with secure or non-secure attribute. These function are required when CFG_DRIVERS_PINCTRL is enabled. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Updates stm32_uart driver for when CFG_DRIVERS_PINCTRL is enabled making UART driver to get pin control configuration using the generic pin control framework. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Updates stm32_i2c driver for when CFG_DRIVERS_PINCTRL is enabled making I2C driver to get pin control configuration using the generic pin control framework. When enabled, stm32_i2c driver get the active and standby pin control configuration from the device tree. SE050 and STM32MP1 PMIC drivers that use the stm32_i2c bus are both updated accordingly. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Changes platform stm32mp1 configuration to always enable CFG_DRIVERS_PINCTRL. The platform requires pinctrl_apply_state() to be unpaged has it can be used during PM suspend and resume sequences. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Adds helper function stm32_gpio_get_bank() in stm32_gpio to retrieve a GPIO bank instance from the bank ID. This change will allow a later change to remove now useless platform helper functions stm32_get_gpio_bank_base() and stm32_get_gpio_bank_clk(). Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Replaces 32bit operand raw left shift with use of SHIFT_U32() macro. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes stm32mp1 platform helper functions stm32_get_gpio_bank_clock() and stm32_get_gpio_bank_clk(). Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes stm32mp1 platform helper function stm32_get_gpio_bank_base(). Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes platform function stm32mp_gpio_bank_is_shared() that is not used. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes implementation when CFG_DRIVERS_PINCTRL is disables as stm32mp1 platform configuration enforces the switch is enabled. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes implementation when CFG_DRIVERS_PINCTRL is disables as stm32mp1 platform configuration enforces the switch is enabled. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Removes implementation when CFG_DRIVERS_PINCTRL is disables as stm32mp1 platform configuration enforces the switch is enabled. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Moves macros and structures definitions from stm32_gpio.h header file to the driver source file as these definition do not need to be visible from other drivers thank to pin control abstraction. Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
etienne-lms
force-pushed
the
stm32-pinctrl
branch
from
May 30, 2023 07:46
8a84e2a to
0a0c12c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This P-R ports stm32_gpio driver to the recently merged pinctrl framework.
The series includes 2 changes already under review in specific P-Rs: #6041 and #6049.
Checkpatch complains on false positive warnings on several commits of this series because of a structure field names
od, for example: