linux/drivers/tty/serial/ma35d1_serial.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *  MA35D1 serial driver
 *  Copyright (C) 2023 Nuvoton Technology Corp.
 */

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/iopoll.h>
#include <linux/serial_core.h>
#include <linux/slab.h>
#include <linux/tty_flip.h>
#include <linux/units.h>

#define MA35_UART_NR

#define MA35_RBR_REG
#define MA35_THR_REG
#define MA35_IER_REG
#define MA35_FCR_REG
#define MA35_LCR_REG
#define MA35_MCR_REG
#define MA35_MSR_REG
#define MA35_FSR_REG
#define MA35_ISR_REG
#define MA35_TOR_REG
#define MA35_BAUD_REG
#define MA35_ALTCTL_REG
#define MA35_FUN_SEL_REG
#define MA35_WKCTL_REG
#define MA35_WKSTS_REG

/* MA35_IER_REG - Interrupt Enable Register */
#define MA35_IER_RDA_IEN
#define MA35_IER_THRE_IEN
#define MA35_IER_RLS_IEN
#define MA35_IER_RTO_IEN
#define MA35_IER_BUFERR_IEN
#define MA35_IER_TIME_OUT_EN
#define MA35_IER_AUTO_RTS
#define MA35_IER_AUTO_CTS

/* MA35_FCR_REG - FIFO Control Register */
#define MA35_FCR_RFR
#define MA35_FCR_TFR
#define MA35_FCR_RFITL_MASK
#define MA35_FCR_RFITL_1BYTE
#define MA35_FCR_RFITL_4BYTES
#define MA35_FCR_RFITL_8BYTES
#define MA35_FCR_RFITL_14BYTES
#define MA35_FCR_RFITL_30BYTES
#define MA35_FCR_RTSTL_MASK
#define MA35_FCR_RTSTL_1BYTE
#define MA35_FCR_RTSTL_4BYTES
#define MA35_FCR_RTSTL_8BYTES
#define MA35_FCR_RTSTL_14BYTES
#define MA35_FCR_RTSTLL_30BYTES

/* MA35_LCR_REG - Line Control Register */
#define MA35_LCR_NSB
#define MA35_LCR_PBE
#define MA35_LCR_EPE
#define MA35_LCR_SPE
#define MA35_LCR_BREAK
#define MA35_LCR_WLS_MASK
#define MA35_LCR_WLS_5BITS
#define MA35_LCR_WLS_6BITS
#define MA35_LCR_WLS_7BITS
#define MA35_LCR_WLS_8BITS

/* MA35_MCR_REG - Modem Control Register */
#define MA35_MCR_RTS_CTRL
#define MA35_MCR_RTSACTLV
#define MA35_MCR_RTSSTS

/* MA35_MSR_REG - Modem Status Register */
#define MA35_MSR_CTSDETF
#define MA35_MSR_CTSSTS
#define MA35_MSR_CTSACTLV

/* MA35_FSR_REG - FIFO Status Register */
#define MA35_FSR_RX_OVER_IF
#define MA35_FSR_PEF
#define MA35_FSR_FEF
#define MA35_FSR_BIF
#define MA35_FSR_RX_EMPTY
#define MA35_FSR_RX_FULL
#define MA35_FSR_TX_EMPTY
#define MA35_FSR_TX_FULL
#define MA35_FSR_TX_OVER_IF
#define MA35_FSR_TE_FLAG
#define MA35_FSR_RXPTR_MSK
#define MA35_FSR_TXPTR_MSK

/* MA35_ISR_REG - Interrupt Status Register */
#define MA35_ISR_RDA_IF
#define MA35_ISR_THRE_IF
#define MA35_ISR_RLSIF
#define MA35_ISR_MODEMIF
#define MA35_ISR_RXTO_IF
#define MA35_ISR_BUFEIF
#define MA35_ISR_WK_IF
#define MA35_ISR_RDAINT
#define MA35_ISR_THRE_INT
#define MA35_ISR_ALL

/* MA35_BAUD_REG - Baud Rate Divider Register */
#define MA35_BAUD_MODE_MASK
#define MA35_BAUD_MODE0
#define MA35_BAUD_MODE1
#define MA35_BAUD_MODE2
#define MA35_BAUD_MASK

/* MA35_ALTCTL_REG - Alternate Control/Status Register */
#define MA35_ALTCTL_RS485AUD

/* MA35_FUN_SEL_REG - Function Select Register */
#define MA35_FUN_SEL_MASK
#define MA35_FUN_SEL_UART
#define MA35_FUN_SEL_RS485

/* The constrain for MA35D1 UART baud rate divider */
#define MA35_BAUD_DIV_MAX
#define MA35_BAUD_DIV_MIN

/* UART FIFO depth */
#define MA35_UART_FIFO_DEPTH
/* UART console clock */
#define MA35_UART_CONSOLE_CLK
/* UART register ioremap size */
#define MA35_UART_REG_SIZE
/* Rx Timeout */
#define MA35_UART_RX_TOUT

#define MA35_IER_CONFIG

#define MA35_ISR_IF_CHECK

#define MA35_FSR_TX_BOTH_EMPTY

static struct uart_driver ma35d1serial_reg;

struct uart_ma35d1_port {};

static struct uart_ma35d1_port ma35d1serial_ports[MA35_UART_NR];

static struct uart_ma35d1_port *to_ma35d1_uart_port(struct uart_port *uart)
{}

static u32 serial_in(struct uart_ma35d1_port *p, u32 offset)
{}

static void serial_out(struct uart_ma35d1_port *p, u32 offset, u32 value)
{}

static void __stop_tx(struct uart_ma35d1_port *p)
{}

static void ma35d1serial_stop_tx(struct uart_port *port)
{}

static void transmit_chars(struct uart_ma35d1_port *up)
{}

static void ma35d1serial_start_tx(struct uart_port *port)
{}

static void ma35d1serial_stop_rx(struct uart_port *port)
{}

static void receive_chars(struct uart_ma35d1_port *up)
{}

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

static u32 ma35d1serial_tx_empty(struct uart_port *port)
{}

static u32 ma35d1serial_get_mctrl(struct uart_port *port)
{}

static void ma35d1serial_set_mctrl(struct uart_port *port, u32 mctrl)
{}

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

static int ma35d1serial_startup(struct uart_port *port)
{}

static void ma35d1serial_shutdown(struct uart_port *port)
{}

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

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

static void ma35d1serial_config_port(struct uart_port *port, int flags)
{}

static int ma35d1serial_verify_port(struct uart_port *port, struct serial_struct *ser)
{}

static const struct uart_ops ma35d1serial_ops =;

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

#ifdef CONFIG_SERIAL_NUVOTON_MA35D1_CONSOLE

static struct device_node *ma35d1serial_uart_nodes[MA35_UART_NR];

static void wait_for_xmitr(struct uart_ma35d1_port *up)
{}

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

/*
 *  Print a string to the serial port trying not to disturb
 *  any possible real use of the port...
 *
 *  The console_lock must be held when we get here.
 */
static void ma35d1serial_console_write(struct console *co, const char *s, u32 count)
{}

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

static struct console ma35d1serial_console =;

static void ma35d1serial_console_init_port(void)
{}

static int __init ma35d1serial_console_init(void)
{}
console_initcall(ma35d1serial_console_init);

#define MA35D1SERIAL_CONSOLE
#else
#define MA35D1SERIAL_CONSOLE
#endif

static struct uart_driver ma35d1serial_reg =;

/*
 * Register a set of serial devices attached to a platform device.
 * The list is terminated with a zero flags entry, which means we expect
 * all entries to have at least UPF_BOOT_AUTOCONF set.
 */
static int ma35d1serial_probe(struct platform_device *pdev)
{}

/*
 * Remove serial ports registered against a platform device.
 */
static void ma35d1serial_remove(struct platform_device *dev)
{}

static int ma35d1serial_suspend(struct platform_device *dev, pm_message_t state)
{}

static int ma35d1serial_resume(struct platform_device *dev)
{}

static struct platform_driver ma35d1serial_driver =;

static int __init ma35d1serial_init(void)
{}

static void __exit ma35d1serial_exit(void)
{}

module_init();
module_exit(ma35d1serial_exit);

MODULE_LICENSE();
MODULE_DESCRIPTION();