-
Notifications
You must be signed in to change notification settings - Fork 1k
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
core: pm: add unregister_pm_cb() + stm32mp257f-ev1 GPIO and console support #7014
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- For "drivers: stm32_rif: tag unused parameters as __unused":
Reviewed-by: Jerome Forissier <[email protected]>
- For "core: pm: add unregister_pm_cb()":
One comment, then:
Acked-by: Jerome Forissier <[email protected]>
static inline void unregister_pm_core_service_cb(pm_callback callback, | ||
void *handle) | ||
{ | ||
enum pm_callback_order order = PM_CB_ORDER_CORE_SERVICE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local variable not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was to keep alignment with parentheses without exceeding the character per lign limit. Do you suggest I change it nevertheless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK then it's fine as it is. In fact PM_CALLBACK_HANDLE_INITIALIZER
is too long, it should have been called PM_CB_HANDLE_INITIALIZER
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, we could also shorten struct pm_callback_handle
to struct pm_cb_handle
:)
static inline void unregister_pm_core_service_cb(pm_callback callback, | ||
void *handle) | ||
{ | ||
enum pm_callback_order order = PM_CB_ORDER_CORE_SERVICE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, we could also shorten struct pm_callback_handle
to struct pm_cb_handle
:)
Updated with comments applied, I will add all tags at the end of the review |
Comments addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some late comments.
I'm fine you fix and squash all fixup commits. I'll make a last review run afterward.
core/drivers/stm32_gpio.c
Outdated
/** | ||
* Compatibility information of supported banks | ||
* | ||
* @gpioz: True if bank is a GPIOZ bank | ||
* @secure_control: Identify GPIO security bank capability. | ||
* @secure_control: Identify RIF presence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: s/secure_control/secure_extended/
core/drivers/stm32_gpio.c
Outdated
res = stm32_rif_acquire_semaphore(bank->base + GPIO_SEMCR(i), | ||
GPIO_MAX_CID_SUPPORTED); | ||
if (res) { | ||
EMSG("Could not acquire semaphore for pin %u", i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: print also the GPIO bank ID to ease debugging. Eg.
E.g. replace for pin %u", i)
with for pin %C%u", 'A' + bank->bank_id, i)
This comment applies also to lines 797 and 806.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with few other occurences as well
core/drivers/stm32_gpio.c
Outdated
panic(); | ||
|
||
nb_rif_conf = MIN((unsigned int)(lenp / sizeof(uint32_t)), | ||
bank->ngpios); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If think we should rather report an error if lenp / sizeof(uint32_t) > bank->ngpios
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put an assert but let me know if an error case handling feels better to you
When CFG_STM32_RIF is not set, inclusion of this header file causes warnings because of function parameters not being tagged as unused. Tag them properly. Signed-off-by: Gatien Chevallier <[email protected]> Fixes: 1506f47 ("drivers: firewall: add stm32_rif driver for common RIF features")
Add support for stm32mp25x platforms by adding RIF support to the driver. GPIO banks are RIF-aware peripherals, meaning that they are responsible for setting their own RIF configuration. While there, remove the use of set_bank_gpio_non_secure() as it is of no use since a pin not configured as secured in the device tree will already result being non-secure. Signed-off-by: Gatien Chevallier <[email protected]>
Add unregister_pm_cb() API function and its helper variants to allow unregistering a PM callback entry. This can be needed for example in the GPIO framework where gpio_put() can release a GPIO that a driver no more consumed. In case a PM callback was previously registered for such a GPIO, consumer driver needs mean to unregister it. This change implies that the PM callbacks list is protected from concurrent accesses hence add a lock for that purpose. Signed-off-by: Gatien Chevallier <[email protected]>
Save and restore during PM suspend/resume sequences the state of the consumed GPIOs. Consumers are expected to get their GPIOs using the DT resources hence register a PM handle when the GPIO is requested (stm32_gpio_get_dt()) so that the dependency order established during drivers initialization is satisfied during PM suspend and resume sequences. PM handle is unregistered when consumer releases the GPIO which requires the handles to be referenced in a list so that we can find it back. Signed-off-by: Gatien Chevallier <[email protected]>
Populate USART2 node and enable console support on USART2 on stm32mp257f-ev1 board. Signed-off-by: Gatien Chevallier <[email protected]>
Add initial RIF GPIO configuration for stm32mp257f-ev1 board. Signed-off-by: Gatien Chevallier <[email protected]>
Comments addressed |
This P-R implements: