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