linux/drivers/tty/serial/men_z135_uart.c

// SPDX-License-Identifier: GPL-2.0
/*
 * MEN 16z135 High Speed UART
 *
 * Copyright (C) 2014 MEN Mikroelektronik GmbH (www.men.de)
 * Author: Johannes Thumshirn <[email protected]>
 */
#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/serial_core.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/tty_flip.h>
#include <linux/bitops.h>
#include <linux/mcb.h>

#define MEN_Z135_MAX_PORTS
#define MEN_Z135_BASECLK
#define MEN_Z135_FIFO_SIZE
#define MEN_Z135_FIFO_WATERMARK

#define MEN_Z135_STAT_REG
#define MEN_Z135_RX_RAM
#define MEN_Z135_TX_RAM
#define MEN_Z135_RX_CTRL
#define MEN_Z135_TX_CTRL
#define MEN_Z135_CONF_REG
#define MEN_Z135_UART_FREQ
#define MEN_Z135_BAUD_REG
#define MEN_Z135_TIMEOUT

#define IRQ_ID(x)

#define MEN_Z135_IER_RXCIEN
#define MEN_Z135_IER_TXCIEN
#define MEN_Z135_IER_RLSIEN
#define MEN_Z135_IER_MSIEN
#define MEN_Z135_ALL_IRQS

#define MEN_Z135_MCR_DTR
#define MEN_Z135_MCR_RTS
#define MEN_Z135_MCR_OUT1
#define MEN_Z135_MCR_OUT2
#define MEN_Z135_MCR_LOOP
#define MEN_Z135_MCR_RCFC

#define MEN_Z135_MSR_DCTS
#define MEN_Z135_MSR_DDSR
#define MEN_Z135_MSR_DRI
#define MEN_Z135_MSR_DDCD
#define MEN_Z135_MSR_CTS
#define MEN_Z135_MSR_DSR
#define MEN_Z135_MSR_RI
#define MEN_Z135_MSR_DCD

#define MEN_Z135_LCR_SHIFT

#define MEN_Z135_WL5
#define MEN_Z135_WL6
#define MEN_Z135_WL7
#define MEN_Z135_WL8

#define MEN_Z135_STB_SHIFT
#define MEN_Z135_NSTB1
#define MEN_Z135_NSTB2

#define MEN_Z135_PEN_SHIFT
#define MEN_Z135_PAR_DIS
#define MEN_Z135_PAR_ENA

#define MEN_Z135_PTY_SHIFT
#define MEN_Z135_PTY_ODD
#define MEN_Z135_PTY_EVN

#define MEN_Z135_LSR_DR
#define MEN_Z135_LSR_OE
#define MEN_Z135_LSR_PE
#define MEN_Z135_LSR_FE
#define MEN_Z135_LSR_BI
#define MEN_Z135_LSR_THEP
#define MEN_Z135_LSR_TEXP
#define MEN_Z135_LSR_RXFIFOERR

#define MEN_Z135_IRQ_ID_RLS
#define MEN_Z135_IRQ_ID_RDA
#define MEN_Z135_IRQ_ID_CTI
#define MEN_Z135_IRQ_ID_TSA
#define MEN_Z135_IRQ_ID_MST

#define LCR(x)

#define BYTES_TO_ALIGN(x)

static int line;

static int txlvl =;
module_param(txlvl, int, S_IRUGO);
MODULE_PARM_DESC();

static int rxlvl =;
module_param(rxlvl, int, S_IRUGO);
MODULE_PARM_DESC();

static int align;
module_param(align, int, S_IRUGO);
MODULE_PARM_DESC();

static uint rx_timeout;
module_param(rx_timeout, uint, S_IRUGO);
MODULE_PARM_DESC();

struct men_z135_port {};
#define to_men_z135(port)

/**
 * men_z135_reg_set() - Set value in register
 * @uart: The UART port
 * @addr: Register address
 * @val: value to set
 */
static inline void men_z135_reg_set(struct men_z135_port *uart,
				u32 addr, u32 val)
{}

/**
 * men_z135_reg_clr() - Unset value in register
 * @uart: The UART port
 * @addr: Register address
 * @val: value to clear
 */
static void men_z135_reg_clr(struct men_z135_port *uart,
				u32 addr, u32 val)
{}

/**
 * men_z135_handle_modem_status() - Handle change of modem status
 * @uart: The UART port
 *
 * Handle change of modem status register. This is done by reading the "delta"
 * versions of DCD (Data Carrier Detect) and CTS (Clear To Send).
 */
static void men_z135_handle_modem_status(struct men_z135_port *uart)
{}

static void men_z135_handle_lsr(struct men_z135_port *uart)
{}

/**
 * get_rx_fifo_content() - Get the number of bytes in RX FIFO
 * @uart: The UART port
 *
 * Read RXC register from hardware and return current FIFO fill size.
 */
static u16 get_rx_fifo_content(struct men_z135_port *uart)
{}

/**
 * men_z135_handle_rx() - RX tasklet routine
 * @uart: Pointer to struct men_z135_port
 *
 * Copy from RX FIFO and acknowledge number of bytes copied.
 */
static void men_z135_handle_rx(struct men_z135_port *uart)
{}

/**
 * men_z135_handle_tx() - TX tasklet routine
 * @uart: Pointer to struct men_z135_port
 *
 */
static void men_z135_handle_tx(struct men_z135_port *uart)
{}

/**
 * men_z135_intr() - Handle legacy IRQs
 * @irq: The IRQ number
 * @data: Pointer to UART port
 *
 * Check IIR register to find the cause of the interrupt and handle it.
 * It is possible that multiple interrupts reason bits are set and reading
 * the IIR is a destructive read, so we always need to check for all possible
 * interrupts and handle them.
 */
static irqreturn_t men_z135_intr(int irq, void *data)
{}

/**
 * men_z135_request_irq() - Request IRQ for 16z135 core
 * @uart: z135 private uart port structure
 *
 * Request an IRQ for 16z135 to use. First try using MSI, if it fails
 * fall back to using legacy interrupts.
 */
static int men_z135_request_irq(struct men_z135_port *uart)
{}

/**
 * men_z135_tx_empty() - Handle tx_empty call
 * @port: The UART port
 *
 * This function tests whether the TX FIFO and shifter for the port
 * described by @port is empty.
 */
static unsigned int men_z135_tx_empty(struct uart_port *port)
{}

/**
 * men_z135_set_mctrl() - Set modem control lines
 * @port: The UART port
 * @mctrl: The modem control lines
 *
 * This function sets the modem control lines for a port described by @port
 * to the state described by @mctrl
 */
static void men_z135_set_mctrl(struct uart_port *port, unsigned int mctrl)
{}

/**
 * men_z135_get_mctrl() - Get modem control lines
 * @port: The UART port
 *
 * Retruns the current state of modem control inputs.
 */
static unsigned int men_z135_get_mctrl(struct uart_port *port)
{}

/**
 * men_z135_stop_tx() - Stop transmitting characters
 * @port: The UART port
 *
 * Stop transmitting characters. This might be due to CTS line becomming
 * inactive or the tty layer indicating we want to stop transmission due to
 * an XOFF character.
 */
static void men_z135_stop_tx(struct uart_port *port)
{}

/*
 * men_z135_disable_ms() - Disable Modem Status
 * port: The UART port
 *
 * Enable Modem Status IRQ.
 */
static void men_z135_disable_ms(struct uart_port *port)
{}

/**
 * men_z135_start_tx() - Start transmitting characters
 * @port: The UART port
 *
 * Start transmitting character. This actually doesn't transmit anything, but
 * fires off the TX tasklet.
 */
static void men_z135_start_tx(struct uart_port *port)
{}

/**
 * men_z135_stop_rx() - Stop receiving characters
 * @port: The UART port
 *
 * Stop receiving characters; the port is in the process of being closed.
 */
static void men_z135_stop_rx(struct uart_port *port)
{}

/**
 * men_z135_enable_ms() - Enable Modem Status
 * @port: the port
 *
 * Enable Modem Status IRQ.
 */
static void men_z135_enable_ms(struct uart_port *port)
{}

static int men_z135_startup(struct uart_port *port)
{}

static void men_z135_shutdown(struct uart_port *port)
{}

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

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

static void men_z135_release_port(struct uart_port *port)
{}

static int men_z135_request_port(struct uart_port *port)
{}

static void men_z135_config_port(struct uart_port *port, int type)
{}

static int men_z135_verify_port(struct uart_port *port,
				struct serial_struct *serinfo)
{}

static const struct uart_ops men_z135_ops =;

static struct uart_driver men_z135_driver =;

/**
 * men_z135_probe() - Probe a z135 instance
 * @mdev: The MCB device
 * @id: The MCB device ID
 *
 * men_z135_probe does the basic setup of hardware resources and registers the
 * new uart port to the tty layer.
 */
static int men_z135_probe(struct mcb_device *mdev,
			const struct mcb_device_id *id)
{}

/**
 * men_z135_remove() - Remove a z135 instance from the system
 *
 * @mdev: The MCB device
 */
static void men_z135_remove(struct mcb_device *mdev)
{}

static const struct mcb_device_id men_z135_ids[] =;
MODULE_DEVICE_TABLE(mcb, men_z135_ids);

static struct mcb_driver mcb_driver =;

/**
 * men_z135_init() - Driver Registration Routine
 *
 * men_z135_init is the first routine called when the driver is loaded. All it
 * does is register with the legacy MEN Chameleon subsystem.
 */
static int __init men_z135_init(void)
{}
module_init();

/**
 * men_z135_exit() - Driver Exit Routine
 *
 * men_z135_exit is called just before the driver is removed from memory.
 */
static void __exit men_z135_exit(void)
{}
module_exit(men_z135_exit);

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_ALIAS();
MODULE_IMPORT_NS();