#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/gpio/consumer.h>
#include <linux/err.h>
#include <linux/irq.h>
#include "serial_mctrl_gpio.h"
#define MXS_AUART_PORTS …
#define MXS_AUART_FIFO_SIZE …
#define SET_REG …
#define CLR_REG …
#define TOG_REG …
#define AUART_CTRL0 …
#define AUART_CTRL1 …
#define AUART_CTRL2 …
#define AUART_LINECTRL …
#define AUART_LINECTRL2 …
#define AUART_INTR …
#define AUART_DATA …
#define AUART_STAT …
#define AUART_DEBUG …
#define AUART_VERSION …
#define AUART_AUTOBAUD …
#define AUART_CTRL0_SFTRST …
#define AUART_CTRL0_CLKGATE …
#define AUART_CTRL0_RXTO_ENABLE …
#define AUART_CTRL0_RXTIMEOUT(v) …
#define AUART_CTRL0_XFER_COUNT(v) …
#define AUART_CTRL1_XFER_COUNT(v) …
#define AUART_CTRL2_DMAONERR …
#define AUART_CTRL2_TXDMAE …
#define AUART_CTRL2_RXDMAE …
#define AUART_CTRL2_CTSEN …
#define AUART_CTRL2_RTSEN …
#define AUART_CTRL2_RTS …
#define AUART_CTRL2_RXE …
#define AUART_CTRL2_TXE …
#define AUART_CTRL2_UARTEN …
#define AUART_LINECTRL_BAUD_DIV_MAX …
#define AUART_LINECTRL_BAUD_DIV_MIN …
#define AUART_LINECTRL_BAUD_DIVINT_SHIFT …
#define AUART_LINECTRL_BAUD_DIVINT_MASK …
#define AUART_LINECTRL_BAUD_DIVINT(v) …
#define AUART_LINECTRL_BAUD_DIVFRAC_SHIFT …
#define AUART_LINECTRL_BAUD_DIVFRAC_MASK …
#define AUART_LINECTRL_BAUD_DIVFRAC(v) …
#define AUART_LINECTRL_SPS …
#define AUART_LINECTRL_WLEN_MASK …
#define AUART_LINECTRL_WLEN(v) …
#define AUART_LINECTRL_FEN …
#define AUART_LINECTRL_STP2 …
#define AUART_LINECTRL_EPS …
#define AUART_LINECTRL_PEN …
#define AUART_LINECTRL_BRK …
#define AUART_INTR_RTIEN …
#define AUART_INTR_TXIEN …
#define AUART_INTR_RXIEN …
#define AUART_INTR_CTSMIEN …
#define AUART_INTR_RTIS …
#define AUART_INTR_TXIS …
#define AUART_INTR_RXIS …
#define AUART_INTR_CTSMIS …
#define AUART_STAT_BUSY …
#define AUART_STAT_CTS …
#define AUART_STAT_TXFE …
#define AUART_STAT_TXFF …
#define AUART_STAT_RXFE …
#define AUART_STAT_OERR …
#define AUART_STAT_BERR …
#define AUART_STAT_PERR …
#define AUART_STAT_FERR …
#define AUART_STAT_RXCOUNT_MASK …
#define ASM9260_HW_CTRL0 …
#define ASM9260_BM_CTRL0_RXDMA_RUN …
#define ASM9260_BM_CTRL0_RXTO_SOURCE_STATUS …
#define ASM9260_BM_CTRL0_RXTO_ENABLE …
#define ASM9260_BM_CTRL0_RXTO_MASK …
#define ASM9260_BM_CTRL0_DEFAULT_RXTIMEOUT …
#define ASM9260_HW_CTRL1 …
#define ASM9260_BM_CTRL1_TXDMA_RUN …
#define ASM9260_HW_CTRL2 …
#define ASM9260_BM_CTRL2_RXIFLSEL …
#define ASM9260_BM_CTRL2_DEFAULT_RXIFLSEL …
#define ASM9260_BM_CTRL2_TXIFLSEL …
#define ASM9260_BM_CTRL2_DEFAULT_TXIFLSEL …
#define ASM9260_BM_CTRL2_DTR …
#define ASM9260_BM_CTRL2_LBE …
#define ASM9260_BM_CTRL2_PORT_ENABLE …
#define ASM9260_HW_LINECTRL …
#define ASM9260_BM_LCTRL_SPS …
#define ASM9260_BM_LCTRL_WLEN …
#define ASM9260_BM_LCTRL_CHRL_5 …
#define ASM9260_BM_LCTRL_CHRL_6 …
#define ASM9260_BM_LCTRL_CHRL_7 …
#define ASM9260_BM_LCTRL_CHRL_8 …
#define ASM9260_HW_INTR …
#define ASM9260_BM_INTR_TFEIEN …
#define ASM9260_BM_INTR_OEIEN …
#define ASM9260_BM_INTR_BEIEN …
#define ASM9260_BM_INTR_PEIEN …
#define ASM9260_BM_INTR_FEIEN …
#define ASM9260_BM_INTR_DSRMIEN …
#define ASM9260_BM_INTR_DCDMIEN …
#define ASM9260_BM_INTR_RIMIEN …
#define ASM9260_BM_INTR_ABTO …
#define ASM9260_BM_INTR_ABEO …
#define ASM9260_BM_INTR_TFEIS …
#define ASM9260_BM_INTR_OEIS …
#define ASM9260_BM_INTR_BEIS …
#define ASM9260_BM_INTR_PEIS …
#define ASM9260_BM_INTR_FEIS …
#define ASM9260_BM_INTR_DSRMIS …
#define ASM9260_BM_INTR_DCDMIS …
#define ASM9260_BM_INTR_RIMIS …
#define ASM9260_HW_DATA …
#define ASM9260_HW_STAT …
#define ASM9260_BM_STAT_PRESENT …
#define ASM9260_BM_STAT_HISPEED …
#define ASM9260_BM_STAT_RXFULL …
#define ASM9260_HW_DEBUG …
#define ASM9260_BM_DEBUG_TXDMARUN …
#define ASM9260_BM_DEBUG_RXDMARUN …
#define ASM9260_BM_DEBUG_TXCMDEND …
#define ASM9260_BM_DEBUG_RXCMDEND …
#define ASM9260_BM_DEBUG_TXDMARQ …
#define ASM9260_BM_DEBUG_RXDMARQ …
#define ASM9260_HW_ILPR …
#define ASM9260_HW_RS485CTRL …
#define ASM9260_BM_RS485CTRL_ONIV …
#define ASM9260_BM_RS485CTRL_DIR_CTRL …
#define ASM9260_BM_RS485CTRL_PINSEL …
#define ASM9260_BM_RS485CTRL_AADEN …
#define ASM9260_BM_RS485CTRL_RXDIS …
#define ASM9260_BM_RS485CTRL_RS485EN …
#define ASM9260_HW_RS485ADRMATCH …
#define ASM9260_BM_RS485ADRMATCH_MASK …
#define ASM9260_HW_RS485DLY …
#define ASM9260_BM_RS485DLY_MASK …
#define ASM9260_HW_AUTOBAUD …
#define ASM9260_BM_AUTOBAUD_TO_INT_CLR …
#define ASM9260_BM_AUTOBAUD_EO_INT_CLR …
#define ASM9260_BM_AUTOBAUD_AUTORESTART …
#define ASM9260_BM_AUTOBAUD_MODE …
#define ASM9260_BM_AUTOBAUD_START …
#define ASM9260_HW_CTRL3 …
#define ASM9260_BM_CTRL3_OUTCLK_DIV_MASK …
#define ASM9260_BM_CTRL3_MASTERMODE …
#define ASM9260_BM_CTRL3_SYNCMODE …
#define ASM9260_BM_CTRL3_MSBF …
#define ASM9260_BM_CTRL3_BAUD8 …
#define ASM9260_BM_CTRL3_9BIT …
#define ASM9260_HW_ISO7816_CTRL …
#define ASM9260_BM_ISO7816CTRL_HS …
#define ASM9260_BM_ISO7816CTRL_DS_NACK …
#define ASM9260_BM_ISO7816CTRL_MAX_ITER_MASK …
#define ASM9260_BM_ISO7816CTRL_INACK …
#define ASM9260_BM_ISO7816CTRL_NEG_DATA …
#define ASM9260_BM_ISO7816CTRL_ENABLE …
#define ASM9260_HW_ISO7816_ERRCNT …
#define ASM9260_BM_ISO7816_NB_ERRORS_MASK …
#define ASM9260_HW_ISO7816_STATUS …
#define ASM9260_BM_ISO7816_STAT_ITERATION …
static struct uart_driver auart_driver;
enum mxs_auart_type { … };
struct vendor_data { … };
enum { … };
static const u16 mxs_asm9260_offsets[REG_ARRAY_SIZE] = …;
static const u16 mxs_stmp37xx_offsets[REG_ARRAY_SIZE] = …;
static const struct vendor_data vendor_alphascale_asm9260 = …;
static const struct vendor_data vendor_freescale_stmp37xx = …;
struct mxs_auart_port { … };
static const struct of_device_id mxs_auart_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);
static inline int is_imx28_auart(struct mxs_auart_port *s)
{ … }
static inline int is_asm9260_auart(struct mxs_auart_port *s)
{ … }
static inline bool auart_dma_enabled(struct mxs_auart_port *s)
{ … }
static unsigned int mxs_reg_to_offset(const struct mxs_auart_port *uap,
unsigned int reg)
{ … }
static unsigned int mxs_read(const struct mxs_auart_port *uap,
unsigned int reg)
{ … }
static void mxs_write(unsigned int val, struct mxs_auart_port *uap,
unsigned int reg)
{ … }
static void mxs_set(unsigned int val, struct mxs_auart_port *uap,
unsigned int reg)
{ … }
static void mxs_clr(unsigned int val, struct mxs_auart_port *uap,
unsigned int reg)
{ … }
static void mxs_auart_stop_tx(struct uart_port *u);
#define to_auart_port(u) …
static void mxs_auart_tx_chars(struct mxs_auart_port *s);
static void dma_tx_callback(void *param)
{ … }
static int mxs_auart_dma_tx(struct mxs_auart_port *s, int size)
{ … }
static void mxs_auart_tx_chars(struct mxs_auart_port *s)
{ … }
static void mxs_auart_rx_char(struct mxs_auart_port *s)
{ … }
static void mxs_auart_rx_chars(struct mxs_auart_port *s)
{ … }
static int mxs_auart_request_port(struct uart_port *u)
{ … }
static int mxs_auart_verify_port(struct uart_port *u,
struct serial_struct *ser)
{ … }
static void mxs_auart_config_port(struct uart_port *u, int flags)
{ … }
static const char *mxs_auart_type(struct uart_port *u)
{ … }
static void mxs_auart_release_port(struct uart_port *u)
{ … }
static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
{ … }
#define MCTRL_ANY_DELTA …
static u32 mxs_auart_modem_status(struct mxs_auart_port *s, u32 mctrl)
{ … }
static u32 mxs_auart_get_mctrl(struct uart_port *u)
{ … }
static void mxs_auart_enable_ms(struct uart_port *port)
{ … }
static void mxs_auart_disable_ms(struct uart_port *port)
{ … }
static int mxs_auart_dma_prep_rx(struct mxs_auart_port *s);
static void dma_rx_callback(void *arg)
{ … }
static int mxs_auart_dma_prep_rx(struct mxs_auart_port *s)
{ … }
static void mxs_auart_dma_exit_channel(struct mxs_auart_port *s)
{ … }
static void mxs_auart_dma_exit(struct mxs_auart_port *s)
{ … }
static int mxs_auart_dma_init(struct mxs_auart_port *s)
{ … }
#define RTS_AT_AUART() …
#define CTS_AT_AUART() …
static void mxs_auart_settermios(struct uart_port *u,
struct ktermios *termios,
const struct ktermios *old)
{ … }
static void mxs_auart_set_ldisc(struct uart_port *port,
struct ktermios *termios)
{ … }
static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
{ … }
static void mxs_auart_reset_deassert(struct mxs_auart_port *s)
{ … }
static void mxs_auart_reset_assert(struct mxs_auart_port *s)
{ … }
static int mxs_auart_startup(struct uart_port *u)
{ … }
static void mxs_auart_shutdown(struct uart_port *u)
{ … }
static unsigned int mxs_auart_tx_empty(struct uart_port *u)
{ … }
static void mxs_auart_start_tx(struct uart_port *u)
{ … }
static void mxs_auart_stop_tx(struct uart_port *u)
{ … }
static void mxs_auart_stop_rx(struct uart_port *u)
{ … }
static void mxs_auart_break_ctl(struct uart_port *u, int ctl)
{ … }
static const struct uart_ops mxs_auart_ops = …;
static struct mxs_auart_port *auart_port[MXS_AUART_PORTS];
#ifdef CONFIG_SERIAL_MXS_AUART_CONSOLE
static void mxs_auart_console_putchar(struct uart_port *port, unsigned char ch)
{ … }
static void
auart_console_write(struct console *co, const char *str, unsigned int count)
{ … }
static void __init
auart_console_get_options(struct mxs_auart_port *s, int *baud,
int *parity, int *bits)
{ … }
static int __init
auart_console_setup(struct console *co, char *options)
{ … }
static struct console auart_console = …;
#endif
static struct uart_driver auart_driver = …;
static void mxs_init_regs(struct mxs_auart_port *s)
{ … }
static int mxs_get_clks(struct mxs_auart_port *s,
struct platform_device *pdev)
{ … }
static int mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
{ … }
static void mxs_auart_free_gpio_irq(struct mxs_auart_port *s)
{ … }
static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s)
{ … }
static int mxs_auart_probe(struct platform_device *pdev)
{ … }
static void mxs_auart_remove(struct platform_device *pdev)
{ … }
static struct platform_driver mxs_auart_driver = …;
static int __init mxs_auart_init(void)
{ … }
static void __exit mxs_auart_exit(void)
{ … }
module_init(…) …;
module_exit(mxs_auart_exit);
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_ALIAS(…) …;