#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/bitfield.h>
#include <linux/console.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/pm_runtime.h>
#define ULITE_NAME …
#if CONFIG_SERIAL_UARTLITE_NR_UARTS > 4
#define ULITE_MAJOR …
#define ULITE_MINOR …
#else
#define ULITE_MAJOR …
#define ULITE_MINOR …
#endif
#define ULITE_NR_UARTS …
#define ULITE_RX …
#define ULITE_TX …
#define ULITE_STATUS …
#define ULITE_CONTROL …
#define ULITE_REGION …
#define ULITE_STATUS_RXVALID …
#define ULITE_STATUS_RXFULL …
#define ULITE_STATUS_TXEMPTY …
#define ULITE_STATUS_TXFULL …
#define ULITE_STATUS_IE …
#define ULITE_STATUS_OVERRUN …
#define ULITE_STATUS_FRAME …
#define ULITE_STATUS_PARITY …
#define ULITE_CONTROL_RST_TX …
#define ULITE_CONTROL_RST_RX …
#define ULITE_CONTROL_IE …
#define UART_AUTOSUSPEND_TIMEOUT …
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
static struct uart_port *console_port;
#endif
struct uartlite_data { … };
struct uartlite_reg_ops { … };
static u32 uartlite_inbe32(void __iomem *addr)
{ … }
static void uartlite_outbe32(u32 val, void __iomem *addr)
{ … }
static const struct uartlite_reg_ops uartlite_be = …;
static u32 uartlite_inle32(void __iomem *addr)
{ … }
static void uartlite_outle32(u32 val, void __iomem *addr)
{ … }
static const struct uartlite_reg_ops uartlite_le = …;
static inline u32 uart_in32(u32 offset, struct uart_port *port)
{ … }
static inline void uart_out32(u32 val, u32 offset, struct uart_port *port)
{ … }
static struct uart_port ulite_ports[ULITE_NR_UARTS];
static struct uart_driver ulite_uart_driver;
static int ulite_receive(struct uart_port *port, int stat)
{ … }
static int ulite_transmit(struct uart_port *port, int stat)
{ … }
static irqreturn_t ulite_isr(int irq, void *dev_id)
{ … }
static unsigned int ulite_tx_empty(struct uart_port *port)
{ … }
static unsigned int ulite_get_mctrl(struct uart_port *port)
{ … }
static void ulite_set_mctrl(struct uart_port *port, unsigned int mctrl)
{ … }
static void ulite_stop_tx(struct uart_port *port)
{ … }
static void ulite_start_tx(struct uart_port *port)
{ … }
static void ulite_stop_rx(struct uart_port *port)
{ … }
static void ulite_break_ctl(struct uart_port *port, int ctl)
{ … }
static int ulite_startup(struct uart_port *port)
{ … }
static void ulite_shutdown(struct uart_port *port)
{ … }
static void ulite_set_termios(struct uart_port *port,
struct ktermios *termios,
const struct ktermios *old)
{ … }
static const char *ulite_type(struct uart_port *port)
{ … }
static void ulite_release_port(struct uart_port *port)
{ … }
static int ulite_request_port(struct uart_port *port)
{ … }
static void ulite_config_port(struct uart_port *port, int flags)
{ … }
static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
{ … }
static void ulite_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate)
{ … }
#ifdef CONFIG_CONSOLE_POLL
static int ulite_get_poll_char(struct uart_port *port)
{ … }
static void ulite_put_poll_char(struct uart_port *port, unsigned char ch)
{ … }
#endif
static const struct uart_ops ulite_ops = …;
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
static void ulite_console_wait_tx(struct uart_port *port)
{ … }
static void ulite_console_putchar(struct uart_port *port, unsigned char ch)
{ … }
static void ulite_console_write(struct console *co, const char *s,
unsigned int count)
{ … }
static int ulite_console_setup(struct console *co, char *options)
{ … }
static struct console ulite_console = …;
static void early_uartlite_putc(struct uart_port *port, unsigned char c)
{ … }
static void early_uartlite_write(struct console *console,
const char *s, unsigned n)
{ … }
static int __init early_uartlite_setup(struct earlycon_device *device,
const char *options)
{ … }
EARLYCON_DECLARE(…);
OF_EARLYCON_DECLARE(…);
OF_EARLYCON_DECLARE(…);
#endif
static struct uart_driver ulite_uart_driver = …;
static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
struct uartlite_data *pdata)
{ … }
static void ulite_release(struct device *dev)
{ … }
static int __maybe_unused ulite_suspend(struct device *dev)
{ … }
static int __maybe_unused ulite_resume(struct device *dev)
{ … }
static int __maybe_unused ulite_runtime_suspend(struct device *dev)
{
struct uart_port *port = dev_get_drvdata(dev);
struct uartlite_data *pdata = port->private_data;
clk_disable(pdata->clk);
return 0;
};
static int __maybe_unused ulite_runtime_resume(struct device *dev)
{ … }
static const struct dev_pm_ops ulite_pm_ops = …;
#if defined(CONFIG_OF)
static const struct of_device_id ulite_of_match[] = …;
MODULE_DEVICE_TABLE(of, ulite_of_match);
#endif
static int ulite_probe(struct platform_device *pdev)
{ … }
static void ulite_remove(struct platform_device *pdev)
{ … }
MODULE_ALIAS(…) …;
static struct platform_driver ulite_platform_driver = …;
static int __init ulite_init(void)
{ … }
static void __exit ulite_exit(void)
{ … }
module_init(…) …;
module_exit(ulite_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;