linux/drivers/tty/serial/fsl_linflexuart.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Freescale LINFlexD UART serial port driver
 *
 * Copyright 2012-2016 Freescale Semiconductor, Inc.
 * Copyright 2017-2019 NXP
 */

#include <linux/console.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/slab.h>
#include <linux/tty_flip.h>
#include <linux/delay.h>

/* All registers are 32-bit width */

#define LINCR1
#define LINIER
#define LINSR
#define LINESR
#define UARTCR
#define UARTSR
#define LINTCSR
#define LINOCR
#define LINTOCR
#define LINFBRR
#define LINIBRR
#define LINCFR
#define LINCR2
#define BIDR
#define BDRL
#define BDRM
#define IFER
#define IFMI
#define IFMR
#define GCR
#define UARTPTO
#define UARTCTO

/*
 * Register field definitions
 */

#define LINFLEXD_LINCR1_INIT
#define LINFLEXD_LINCR1_MME
#define LINFLEXD_LINCR1_BF

#define LINFLEXD_LINSR_LINS_INITMODE
#define LINFLEXD_LINSR_LINS_MASK

#define LINFLEXD_LINIER_SZIE
#define LINFLEXD_LINIER_OCIE
#define LINFLEXD_LINIER_BEIE
#define LINFLEXD_LINIER_CEIE
#define LINFLEXD_LINIER_HEIE
#define LINFLEXD_LINIER_FEIE
#define LINFLEXD_LINIER_BOIE
#define LINFLEXD_LINIER_LSIE
#define LINFLEXD_LINIER_WUIE
#define LINFLEXD_LINIER_DBFIE
#define LINFLEXD_LINIER_DBEIETOIE
#define LINFLEXD_LINIER_DRIE
#define LINFLEXD_LINIER_DTIE
#define LINFLEXD_LINIER_HRIE

#define LINFLEXD_UARTCR_OSR_MASK
#define LINFLEXD_UARTCR_OSR(uartcr)

#define LINFLEXD_UARTCR_ROSE

#define LINFLEXD_UARTCR_RFBM
#define LINFLEXD_UARTCR_TFBM
#define LINFLEXD_UARTCR_WL1
#define LINFLEXD_UARTCR_PC1

#define LINFLEXD_UARTCR_RXEN
#define LINFLEXD_UARTCR_TXEN
#define LINFLEXD_UARTCR_PC0

#define LINFLEXD_UARTCR_PCE
#define LINFLEXD_UARTCR_WL0
#define LINFLEXD_UARTCR_UART

#define LINFLEXD_UARTSR_SZF
#define LINFLEXD_UARTSR_OCF
#define LINFLEXD_UARTSR_PE3
#define LINFLEXD_UARTSR_PE2
#define LINFLEXD_UARTSR_PE1
#define LINFLEXD_UARTSR_PE0
#define LINFLEXD_UARTSR_RMB
#define LINFLEXD_UARTSR_FEF
#define LINFLEXD_UARTSR_BOF
#define LINFLEXD_UARTSR_RPS
#define LINFLEXD_UARTSR_WUF
#define LINFLEXD_UARTSR_4

#define LINFLEXD_UARTSR_TO

#define LINFLEXD_UARTSR_DRFRFE
#define LINFLEXD_UARTSR_DTFTFF
#define LINFLEXD_UARTSR_NF
#define LINFLEXD_UARTSR_PE

#define LINFLEX_LDIV_MULTIPLIER

#define DRIVER_NAME
#define DEV_NAME
#define UART_NR

#define EARLYCON_BUFFER_INITIAL_CAP

#define PREINIT_DELAY

static const struct of_device_id linflex_dt_ids[] =;
MODULE_DEVICE_TABLE(of, linflex_dt_ids);

#ifdef CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE
static struct uart_port *earlycon_port;
static bool linflex_earlycon_same_instance;
static DEFINE_SPINLOCK(init_lock);
static bool during_init;

static struct {} earlycon_buf;
#endif

static void linflex_stop_tx(struct uart_port *port)
{}

static void linflex_stop_rx(struct uart_port *port)
{}

static void linflex_put_char(struct uart_port *sport, unsigned char c)
{}

static inline void linflex_transmit_buffer(struct uart_port *sport)
{}

static void linflex_start_tx(struct uart_port *port)
{}

static irqreturn_t linflex_txint(int irq, void *dev_id)
{}

static irqreturn_t linflex_rxint(int irq, void *dev_id)
{}

static irqreturn_t linflex_int(int irq, void *dev_id)
{}

/* return TIOCSER_TEMT when transmitter is not busy */
static unsigned int linflex_tx_empty(struct uart_port *port)
{}

static unsigned int linflex_get_mctrl(struct uart_port *port)
{}

static void linflex_set_mctrl(struct uart_port *port, unsigned int mctrl)
{}

static void linflex_break_ctl(struct uart_port *port, int break_state)
{}

static void linflex_setup_watermark(struct uart_port *sport)
{}

static int linflex_startup(struct uart_port *port)
{}

static void linflex_shutdown(struct uart_port *port)
{}

static void
linflex_set_termios(struct uart_port *port, struct ktermios *termios,
		    const struct ktermios *old)
{}

static const char *linflex_type(struct uart_port *port)
{}

static void linflex_release_port(struct uart_port *port)
{}

static int linflex_request_port(struct uart_port *port)
{}

/* configure/auto-configure the port */
static void linflex_config_port(struct uart_port *port, int flags)
{}

static const struct uart_ops linflex_pops =;

static struct uart_port *linflex_ports[UART_NR];

#ifdef CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE
static void linflex_console_putchar(struct uart_port *port, unsigned char ch)
{}

static void linflex_earlycon_putchar(struct uart_port *port, unsigned char ch)
{}

static void linflex_string_write(struct uart_port *sport, const char *s,
				 unsigned int count)
{}

static void
linflex_console_write(struct console *co, const char *s, unsigned int count)
{}

/*
 * if the port was already initialised (eg, by a boot loader),
 * try to determine the current setup.
 */
static void __init
linflex_console_get_options(struct uart_port *sport, int *parity, int *bits)
{}

static int __init linflex_console_setup(struct console *co, char *options)
{}

static struct uart_driver linflex_reg;
static struct console linflex_console =;

static void linflex_earlycon_write(struct console *con, const char *s,
				   unsigned int n)
{}

static int __init linflex_early_console_setup(struct earlycon_device *device,
					      const char *options)
{}

OF_EARLYCON_DECLARE();

#define LINFLEX_CONSOLE
#else
#define LINFLEX_CONSOLE
#endif

static struct uart_driver linflex_reg =;

static int linflex_probe(struct platform_device *pdev)
{}

static void linflex_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int linflex_suspend(struct device *dev)
{}

static int linflex_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(linflex_pm_ops, linflex_suspend, linflex_resume);

static struct platform_driver linflex_driver =;

static int __init linflex_serial_init(void)
{}

static void __exit linflex_serial_exit(void)
{}

module_init();
module_exit(linflex_serial_exit);

MODULE_DESCRIPTION();
MODULE_LICENSE();