Registered User mNo edit summary |
Registered User mNo edit summary Tag: 2017 source edit |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{ApplicableFor | <noinclude>{{ApplicableFor | ||
|MPUs list=STM32MP13x | |MPUs list=STM32MP13x, STM32MP25x | ||
|MPUs checklist=STM32MP13x,STM32MP15x | |MPUs checklist=STM32MP13x,STM32MP15x,STM32MP25x | ||
}}</noinclude> | }}</noinclude> | ||
== Purpose == | == Purpose == | ||
This article describes the configuration of the PWR wake-up pins for a usage in Linux.<br> | This article describes the configuration of the PWR wake-up pins for a usage in Linux, based on OP-TEE driver.<br> | ||
The PWR Wake-up pins are used to wake-up from Standby from an external device.<br> | The PWR Wake-up pins are used to wake-up from Standby from an external device.<br> | ||
This article does not describe how to configure a wake-up pin to use it internally in | This article does not describe how to configure a wake-up pin to use it internally in OP-TEE.<br> | ||
This article is applicable only if the [[PWR internal peripheral|PWR]] peripherals is assigned only to OP-TEE, for all {{MicroprocessorDevice | device=Class}} except {{MicroprocessorDevice | device=15}}. | |||
For {{MicroprocessorDevice | device=15}}, the PWR Wake-up is handled in [[Interrupt_overview#pwr_irq irqchip|pwr_irq irqchip]] driver. | |||
== Overview == | == Overview == | ||
Line 15: | Line 19: | ||
* Button: one external device plugged to a wake-up pin. Could also be a PMIC. | * Button: one external device plugged to a wake-up pin. Could also be a PMIC. | ||
* PWR: PWR internal peripheral | * PWR: PWR internal peripheral | ||
* | * OP-TEE PWR IRQ driver: driver in charge of PWR peripheral that provides access to the wake-up pin via an interrupts interface. | ||
* | * OP-TEE PWR IRQ user driver: PWR IRQ consumer used to enable one wake-up pin and forward events as notifications to the non-secure world. | ||
* | * OP-TEE notification: stack in charge of communication with the non secure world. | ||
* Linux Linaro optee driver: stack in charge of communication with secure world. Transform | * Linux Linaro optee driver: stack in charge of communication with secure world. Transform OP-TEE notifications to interrupts. | ||
* GPIO keys: Linux driver using a wake-up pin handled by | * GPIO keys: Linux driver using a wake-up pin handled by OP-TEE. Could be any driver able to handle Linux interrupts. | ||
== Wake-up pin configuration == | == Wake-up pin configuration == | ||
=== | === OP-TEE configuration === | ||
Wake-up pins are configured in | Wake-up pins are configured in OP-TEE via device-tree. A pwr-irq-user can be instantiated to handle the desired wake-up pin and send a OP-TEE notification to Linux in case of event. | ||
=== Linux configuration === | === Linux configuration === | ||
Linux does not handle wake-up pin, but it can handle an | Linux does not handle wake-up pin, but it can handle an OP-TEE notification as an interrupt. | ||
This is configured via device-tree. | This is configured via device-tree. | ||
== Example with wake-up pin 2 == | == Example with wake-up pin 2 == | ||
In the example below, the wake-up pin number 2 is configured by | In the example below, the wake-up pin number 2 is configured by OP-TEE, forwarded as notification number 4 to Linux, and used by "gpio-keys" driver in Linux to generate a key-press. | ||
OP-TEE device tree: | |||
wakeup_button: wakeup-button { | wakeup_button: wakeup-button { | ||
compatible = "st,stm32mp1,pwr-irq-user"; | compatible = "st,stm32mp1,pwr-irq-user"; | ||
Line 55: | Line 59: | ||
}; | }; | ||
}; | }; | ||
==Source code location== | |||
The source files are located inside the OP-TEE. | |||
*'''OP-TEE PWR IRQ driver''': | |||
** {{CodeSource | OP-TEE_OS | core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr_irq.c}} for {{MicroprocessorDevice | device=13}} | |||
** {{CodeSource | OP-TEE_OS | core/arch/arm/plat-stm32mp2/drivers/stm32mp25_pwr_irq.c}} for {{MicroprocessorDevice | device=25}} | |||
== References == | == References == | ||
Line 61: | Line 73: | ||
<noinclude> | <noinclude> | ||
{{PublicationRequestId |25192| 2022-11-07 | }} | {{PublicationRequestId |25192| 2022-11-07 | }} | ||
[[Category:OP-TEE | [[Category:OP-TEE]] | ||
</noinclude> | </noinclude> |
Latest revision as of 09:30, 20 August 2024
1. Purpose
This article describes the configuration of the PWR wake-up pins for a usage in Linux, based on OP-TEE driver.
The PWR Wake-up pins are used to wake-up from Standby from an external device.
This article does not describe how to configure a wake-up pin to use it internally in OP-TEE.
This article is applicable only if the PWR peripherals is assigned only to OP-TEE, for all STM32 Arm® Cortex® MPUs except STM32MP15x lines
.
For STM32MP15x lines , the PWR Wake-up is handled in pwr_irq irqchip driver.
2. Overview
- Button: one external device plugged to a wake-up pin. Could also be a PMIC.
- PWR: PWR internal peripheral
- OP-TEE PWR IRQ driver: driver in charge of PWR peripheral that provides access to the wake-up pin via an interrupts interface.
- OP-TEE PWR IRQ user driver: PWR IRQ consumer used to enable one wake-up pin and forward events as notifications to the non-secure world.
- OP-TEE notification: stack in charge of communication with the non secure world.
- Linux Linaro optee driver: stack in charge of communication with secure world. Transform OP-TEE notifications to interrupts.
- GPIO keys: Linux driver using a wake-up pin handled by OP-TEE. Could be any driver able to handle Linux interrupts.
3. Wake-up pin configuration
3.1. OP-TEE configuration
Wake-up pins are configured in OP-TEE via device-tree. A pwr-irq-user can be instantiated to handle the desired wake-up pin and send a OP-TEE notification to Linux in case of event.
3.2. Linux configuration
Linux does not handle wake-up pin, but it can handle an OP-TEE notification as an interrupt. This is configured via device-tree.
4. Example with wake-up pin 2
In the example below, the wake-up pin number 2 is configured by OP-TEE, forwarded as notification number 4 to Linux, and used by "gpio-keys" driver in Linux to generate a key-press.
OP-TEE device tree:
wakeup_button: wakeup-button {
compatible = "st,stm32mp1,pwr-irq-user";
st,wakeup-pin-number = <2>;
st,notif-it-id = <4>;
status = "okay";
};
Linux device tree:
wake_up {
compatible = "gpio-keys";
status = "okay";
button {
label = "wake-up";
linux,code = <KEY_WAKEUP>;
interrupts-extended = <&optee 4>;
status = "okay";
};
};
5. Source code location
The source files are located inside the OP-TEE.
- OP-TEE PWR IRQ driver:
- core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr_irq.c for STM32MP13x lines
- core/arch/arm/plat-stm32mp2/drivers/stm32mp25_pwr_irq.c for STM32MP25x lines
- core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr_irq.c for STM32MP13x lines
6. References