drivers/serial/uart_pl011.c : add the interface about clock and reset control for reducing power consumption.

This commit is contained in:
TakuyaMiyasita 2024-06-03 15:35:11 +09:00 committed by Xiang Xiao
parent 99dee09146
commit c93383407b
3 changed files with 32 additions and 0 deletions

View file

@ -81,4 +81,8 @@ config UART3_CLK_FREQ
endif # UART3_PL011
config UART_PL011_PLATFORMIF
bool "PL011 platform interface"
default n
endif # UART_PL011

View file

@ -903,8 +903,19 @@ static int pl011_attach(FAR struct uart_dev_s *dev)
static void pl011_shutdown(FAR struct uart_dev_s *dev)
{
#ifdef CONFIG_UART_PL011_PLATFORMIF
struct pl011_uart_port_s *sport = (struct pl011_uart_port_s *)dev->priv;
const struct pl011_config *config = &sport->config;
/* If needed, implement platform specific process such as disabling pl011
* to reduce power consumption.
*/
pl011_platform_shutdown((uint32_t)config->uart);
#else
UNUSED(dev);
sinfo("%s: call unexpected\n", __func__);
#endif
}
static int pl011_setup(FAR struct uart_dev_s *dev)
@ -916,6 +927,14 @@ static int pl011_setup(FAR struct uart_dev_s *dev)
uint32_t lcrh;
irqstate_t i_flags;
#ifdef CONFIG_UART_PL011_PLATFORMIF
/* If needed, implement platform specific process such as enabling pl011
* to reduce power consumption.
*/
pl011_platform_setup((uint32_t)config->uart);
#endif
i_flags = up_irq_save();
/* If working in SBSA mode, we assume that UART is already configured,

View file

@ -41,5 +41,14 @@ void pl011_earlyserialinit(void);
void pl011_serialinit(void);
#ifdef CONFIG_UART_PL011_PLATFORMIF
/* If needed, implement platform specific process such as enabling pl011
* to reduce power consumption.
*/
int pl011_platform_setup(uint32_t base);
int pl011_platform_shutdown(uint32_t base);
#endif /* CONFIG_UART_PL011_PLATFORMIF */
#endif /* CONFIG_UART_PL011 */
#endif /* __INCLUDE_NUTTX_SERIAL_UART_PL011_H */