xref: /linux/drivers/tty/serial/serial_base.h (revision 1b0975ee3bdd3eb19a47371c26fd7ef8f7f6b599)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Serial core related functions, serial port device drivers do not need this.
4  *
5  * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
6  * Author: Tony Lindgren <tony@atomide.com>
7  */
8 
9 #define to_serial_base_ctrl_device(d) container_of((d), struct serial_ctrl_device, dev)
10 #define to_serial_base_port_device(d) container_of((d), struct serial_port_device, dev)
11 
12 struct uart_driver;
13 struct uart_port;
14 struct device_driver;
15 struct device;
16 
17 struct serial_ctrl_device {
18 	struct device dev;
19 };
20 
21 struct serial_port_device {
22 	struct device dev;
23 	struct uart_port *port;
24 };
25 
26 int serial_base_ctrl_init(void);
27 void serial_base_ctrl_exit(void);
28 
29 int serial_base_port_init(void);
30 void serial_base_port_exit(void);
31 
32 int serial_base_driver_register(struct device_driver *driver);
33 void serial_base_driver_unregister(struct device_driver *driver);
34 
35 struct serial_ctrl_device *serial_base_ctrl_add(struct uart_port *port,
36 						struct device *parent);
37 struct serial_port_device *serial_base_port_add(struct uart_port *port,
38 						struct serial_ctrl_device *parent);
39 void serial_base_ctrl_device_remove(struct serial_ctrl_device *ctrl_dev);
40 void serial_base_port_device_remove(struct serial_port_device *port_dev);
41 
42 int serial_ctrl_register_port(struct uart_driver *drv, struct uart_port *port);
43 void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port);
44 
45 int serial_core_register_port(struct uart_driver *drv, struct uart_port *port);
46 void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port);
47