xref: /optee_os/core/include/drivers/stm32_uart.h (revision 5a913ee74d3c71af2a2860ce8a4e7aeab2916f9b)
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 #include <drivers/stm32_gpio.h>
11 
12 struct stm32_uart_pdata {
13 	struct io_pa_va base;
14 	struct serial_chip chip;
15 	bool secure;
16 	unsigned int clock;
17 	struct stm32_pinctrl *pinctrl;
18 	size_t pinctrl_count;
19 };
20 
21 /*
22  * stm32_uart_init - Initialize a UART serial chip and base address
23  * @pd: Output initialized UART platform data
24  * @base: UART interface physical base address
25  */
26 void stm32_uart_init(struct stm32_uart_pdata *pd, vaddr_t base);
27 
28 /*
29  * stm32_uart_init_from_dt_node - Initialize a UART instance from a DTB node
30  * @fdt: DTB base address
31  * @node: Target node offset in the DTB
32  * Returns an alloced (malloc) and inited UART platform data on success or NULL
33  *
34  * This function gets a STM32 UART configuration directives from a DTB node
35  * and initializes a UART driver instance.
36  * When the DTB specifies that the device is disabled, the function returns
37  * NULL. Other issues panic the sequence.
38  */
39 struct stm32_uart_pdata *stm32_uart_init_from_dt_node(void *fdt, int node);
40 
41 #endif /*__STM32_UART_H__*/
42