#include <linux/module.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/serial.h>
#include <linux/serial_reg.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/serial_core.h>
#include <linux/irq.h>
#include <linux/pm_runtime.h>
#include <linux/pm_wakeirq.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/gpio/consumer.h>
#include <linux/platform_data/serial-omap.h>
#define OMAP_MAX_HSUART_PORTS …
#define UART_BUILD_REVISION(x, y) …
#define OMAP_UART_REV_42 …
#define OMAP_UART_REV_46 …
#define OMAP_UART_REV_52 …
#define OMAP_UART_REV_63 …
#define OMAP_UART_TX_WAKEUP_EN …
#define OMAP_UART_WER_HAS_TX_WAKEUP …
#define UART_ERRATA_i202_MDR1_ACCESS …
#define UART_ERRATA_i291_DMA_FORCEIDLE …
#define DEFAULT_CLK_SPEED …
#define OMAP_UART_SCR_RX_TRIG_GRANU1_MASK …
#define OMAP_UART_SCR_TX_TRIG_GRANU1_MASK …
#define OMAP_UART_SCR_TX_EMPTY …
#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK …
#define OMAP_UART_FCR_TX_FIFO_TRIG_MASK …
#define OMAP_UART_MVR_SCHEME_SHIFT …
#define OMAP_UART_LEGACY_MVR_MAJ_MASK …
#define OMAP_UART_LEGACY_MVR_MAJ_SHIFT …
#define OMAP_UART_LEGACY_MVR_MIN_MASK …
#define OMAP_UART_MVR_MAJ_MASK …
#define OMAP_UART_MVR_MAJ_SHIFT …
#define OMAP_UART_MVR_MIN_MASK …
#define OMAP_UART_DMA_CH_FREE …
#define MSR_SAVE_FLAGS …
#define OMAP_MODE13X_SPEED …
#define OMAP_UART_WER_MOD_WKUP …
#define OMAP_UART_SW_TX …
#define OMAP_UART_SW_RX …
#define OMAP_UART_SW_CLR …
#define OMAP_UART_TCR_TRIG …
struct uart_omap_dma { … };
struct uart_omap_port { … };
#define to_uart_omap_port(p) …
static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
static void serial_omap_mdr1_errataset(struct uart_omap_port *up, u8 mdr1);
static inline unsigned int serial_in(struct uart_omap_port *up, int offset)
{ … }
static inline void serial_out(struct uart_omap_port *up, int offset, int value)
{ … }
static inline void serial_omap_clear_fifos(struct uart_omap_port *up)
{ … }
#ifdef CONFIG_PM
static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
{ … }
static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable)
{ … }
#endif
static inline int calculate_baud_abs_diff(struct uart_port *port,
unsigned int baud, unsigned int mode)
{ … }
static bool
serial_omap_baud_is_mode16(struct uart_port *port, unsigned int baud)
{ … }
static unsigned int
serial_omap_get_divisor(struct uart_port *port, unsigned int baud)
{ … }
static void serial_omap_enable_ms(struct uart_port *port)
{ … }
static void serial_omap_stop_tx(struct uart_port *port)
{ … }
static void serial_omap_stop_rx(struct uart_port *port)
{ … }
static void serial_omap_put_char(struct uart_omap_port *up, unsigned char ch)
{ … }
static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
{ … }
static inline void serial_omap_enable_ier_thri(struct uart_omap_port *up)
{ … }
static void serial_omap_start_tx(struct uart_port *port)
{ … }
static void serial_omap_throttle(struct uart_port *port)
{ … }
static void serial_omap_unthrottle(struct uart_port *port)
{ … }
static unsigned int check_modem_status(struct uart_omap_port *up)
{ … }
static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
{ … }
static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
{ … }
static irqreturn_t serial_omap_irq(int irq, void *dev_id)
{ … }
static unsigned int serial_omap_tx_empty(struct uart_port *port)
{ … }
static unsigned int serial_omap_get_mctrl(struct uart_port *port)
{ … }
static void serial_omap_set_mctrl(struct uart_port *port, unsigned int mctrl)
{ … }
static void serial_omap_break_ctl(struct uart_port *port, int break_state)
{ … }
static int serial_omap_startup(struct uart_port *port)
{ … }
static void serial_omap_shutdown(struct uart_port *port)
{ … }
static void serial_omap_uart_qos_work(struct work_struct *work)
{ … }
static void
serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
const struct ktermios *old)
{ … }
static void
serial_omap_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate)
{ … }
static void serial_omap_release_port(struct uart_port *port)
{ … }
static int serial_omap_request_port(struct uart_port *port)
{ … }
static void serial_omap_config_port(struct uart_port *port, int flags)
{ … }
static int
serial_omap_verify_port(struct uart_port *port, struct serial_struct *ser)
{ … }
static const char *
serial_omap_type(struct uart_port *port)
{ … }
static void __maybe_unused wait_for_xmitr(struct uart_omap_port *up)
{ … }
#ifdef CONFIG_CONSOLE_POLL
static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch)
{ … }
static int serial_omap_poll_get_char(struct uart_port *port)
{ … }
#endif
#ifdef CONFIG_SERIAL_OMAP_CONSOLE
#ifdef CONFIG_SERIAL_EARLYCON
static unsigned int omap_serial_early_in(struct uart_port *port, int offset)
{ … }
static void omap_serial_early_out(struct uart_port *port, int offset,
int value)
{ … }
static void omap_serial_early_putc(struct uart_port *port, unsigned char c)
{ … }
static void early_omap_serial_write(struct console *console, const char *s,
unsigned int count)
{ … }
static int __init early_omap_serial_setup(struct earlycon_device *device,
const char *options)
{ … }
OF_EARLYCON_DECLARE(…);
OF_EARLYCON_DECLARE(…);
OF_EARLYCON_DECLARE(…);
#endif
static struct uart_omap_port *serial_omap_console_ports[OMAP_MAX_HSUART_PORTS];
static struct uart_driver serial_omap_reg;
static void serial_omap_console_putchar(struct uart_port *port, unsigned char ch)
{ … }
static void
serial_omap_console_write(struct console *co, const char *s,
unsigned int count)
{ … }
static int __init
serial_omap_console_setup(struct console *co, char *options)
{ … }
static struct console serial_omap_console = …;
static void serial_omap_add_console_port(struct uart_omap_port *up)
{ … }
#define OMAP_CONSOLE …
#else
#define OMAP_CONSOLE …
static inline void serial_omap_add_console_port(struct uart_omap_port *up)
{}
#endif
static int
serial_omap_config_rs485(struct uart_port *port, struct ktermios *termios,
struct serial_rs485 *rs485)
{ … }
static const struct uart_ops serial_omap_pops = …;
static struct uart_driver serial_omap_reg = …;
#ifdef CONFIG_PM_SLEEP
static int serial_omap_prepare(struct device *dev)
{ … }
static void serial_omap_complete(struct device *dev)
{ … }
static int serial_omap_suspend(struct device *dev)
{ … }
static int serial_omap_resume(struct device *dev)
{ … }
#else
#define serial_omap_prepare …
#define serial_omap_complete …
#endif
static void omap_serial_fill_features_erratas(struct uart_omap_port *up)
{ … }
static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
{ … }
static const struct serial_rs485 serial_omap_rs485_supported = …;
static int serial_omap_probe_rs485(struct uart_omap_port *up,
struct device *dev)
{ … }
static int serial_omap_probe(struct platform_device *pdev)
{ … }
static void serial_omap_remove(struct platform_device *dev)
{ … }
static void serial_omap_mdr1_errataset(struct uart_omap_port *up, u8 mdr1)
{ … }
#ifdef CONFIG_PM
static void serial_omap_restore_context(struct uart_omap_port *up)
{ … }
static int serial_omap_runtime_suspend(struct device *dev)
{ … }
static int serial_omap_runtime_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops serial_omap_dev_pm_ops = …;
#if defined(CONFIG_OF)
static const struct of_device_id omap_serial_of_match[] = …;
MODULE_DEVICE_TABLE(of, omap_serial_of_match);
#endif
static struct platform_driver serial_omap_driver = …;
static int __init serial_omap_init(void)
{ … }
static void __exit serial_omap_exit(void)
{ … }
module_init(…) …;
module_exit(serial_omap_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;