serial: ns16550: Increase scope of ops functions
Increase scope of ops functions and do some clean up for usage in device
-specific UART drivers.
Remove the static functionality of ops functions and migrate certain macros
to header file for usage in device-specific drivers.
Signed-off-by: Gokul Praveen <g-praveen@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/include/ns16550.h b/include/ns16550.h
index 7f48130..5d9ff10 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -25,6 +25,7 @@
#define __ns16550_h
#include <linux/types.h>
+#include <serial.h>
#if CONFIG_IS_ENABLED(DM_SERIAL) || defined(CONFIG_NS16550_DYNAMIC) || \
defined(CONFIG_DEBUG_UART)
@@ -116,6 +117,15 @@
#endif
};
+#if CONFIG_IS_ENABLED(DM_SERIAL)
+#define serial_out(value, addr) \
+ ns16550_writeb(com_port, \
+ (unsigned char *)(addr) - (unsigned char *)com_port, value)
+#define serial_in(addr) \
+ ns16550_readb(com_port, \
+ (unsigned char *)(addr) - (unsigned char *)com_port)
+#endif
+
#define thr rbr
#define iir fcr
#define dll rbr
@@ -225,6 +235,14 @@
char ns16550_getc(struct ns16550 *com_port);
int ns16550_tstc(struct ns16550 *com_port);
void ns16550_reinit(struct ns16550 *com_port, int baud_divisor);
+int ns16550_serial_putc(struct udevice *dev, const char ch);
+int ns16550_serial_pending(struct udevice *dev, bool input);
+int ns16550_serial_getc(struct udevice *dev);
+int ns16550_serial_setbrg(struct udevice *dev, int baudrate);
+int ns16550_serial_setconfig(struct udevice *dev, uint serial_config);
+int ns16550_serial_getinfo(struct udevice *dev, struct serial_device_info *info);
+void ns16550_writeb(struct ns16550 *port, int offset, int value);
+void ns16550_setbrg(struct ns16550 *com_port, int baud_divisor);
/**
* ns16550_calc_divisor() - calculate the divisor given clock and baud rate