xref: /optee_os/core/include/drivers/stm32_uart.h (revision 3d3b05918ec9052ba13de82fbcaba204766eb636)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2017-2018, STMicroelectronics
4  */
5 
6 #ifndef __STM32_UART_H__
7 #define __STM32_UART_H__
8 
9 #include <drivers/serial.h>
10 
11 struct stm32_uart_pdata {
12 	struct io_pa_va base;
13 	struct serial_chip chip;
14 	bool secure;
15 	unsigned int clock;
16 };
17 
18 /*
19  * stm32_uart_init - Initialize a UART serial chip and base address
20  * @pd: Output initialized UART platform data
21  * @base: UART interface physical base address
22  */
23 void stm32_uart_init(struct stm32_uart_pdata *pd, vaddr_t base);
24 
25 /*
26  * stm32_uart_init_from_dt_node - Initialize a UART instance from a DTB node
27  * @fdt: DTB base address
28  * @node: Target node offset in the DTB
29  * Returns an alloced (malloc) and inited UART platform data on success or NULL
30  *
31  * This function gets a STM32 UART configuration directives from a DTB node
32  * and initializes a UART driver instance.
33  * When the DTB specifies that the device is disabled, the function returns
34  * NULL. Other issues panic the sequence.
35  */
36 struct stm32_uart_pdata *stm32_uart_init_from_dt_node(void *fdt, int node);
37 
38 #endif /*__STM32_UART_H__*/
39