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