linux/drivers/tty/serial/altera_uart.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * altera_uart.c -- Altera UART driver
 *
 * Based on mcf.c -- Freescale ColdFire UART driver
 *
 * (C) Copyright 2003-2007, Greg Ungerer <[email protected]>
 * (C) Copyright 2008, Thomas Chou <[email protected]>
 * (C) Copyright 2010, Tobias Klauser <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/console.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/io.h>
#include <linux/altera_uart.h>

#define DRV_NAME
#define SERIAL_ALTERA_MAJOR
#define SERIAL_ALTERA_MINOR

/*
 * Altera UART register definitions according to the Nios UART datasheet:
 * http://www.altera.com/literature/ds/ds_nios_uart.pdf
 */

#define ALTERA_UART_SIZE

#define ALTERA_UART_RXDATA_REG
#define ALTERA_UART_TXDATA_REG
#define ALTERA_UART_STATUS_REG
#define ALTERA_UART_CONTROL_REG
#define ALTERA_UART_DIVISOR_REG
#define ALTERA_UART_EOP_REG

#define ALTERA_UART_STATUS_PE_MSK
#define ALTERA_UART_STATUS_FE_MSK
#define ALTERA_UART_STATUS_BRK_MSK
#define ALTERA_UART_STATUS_ROE_MSK
#define ALTERA_UART_STATUS_TOE_MSK
#define ALTERA_UART_STATUS_TMT_MSK
#define ALTERA_UART_STATUS_TRDY_MSK
#define ALTERA_UART_STATUS_RRDY_MSK
#define ALTERA_UART_STATUS_E_MSK
#define ALTERA_UART_STATUS_DCTS_MSK
#define ALTERA_UART_STATUS_CTS_MSK
#define ALTERA_UART_STATUS_EOP_MSK

						/* Enable interrupt on... */
#define ALTERA_UART_CONTROL_PE_MSK
#define ALTERA_UART_CONTROL_FE_MSK
#define ALTERA_UART_CONTROL_BRK_MSK
#define ALTERA_UART_CONTROL_ROE_MSK
#define ALTERA_UART_CONTROL_TOE_MSK
#define ALTERA_UART_CONTROL_TMT_MSK
#define ALTERA_UART_CONTROL_TRDY_MSK
#define ALTERA_UART_CONTROL_RRDY_MSK
#define ALTERA_UART_CONTROL_E_MSK

#define ALTERA_UART_CONTROL_TRBK_MSK
#define ALTERA_UART_CONTROL_DCTS_MSK
#define ALTERA_UART_CONTROL_RTS_MSK
#define ALTERA_UART_CONTROL_EOP_MSK

/*
 * Local per-uart structure.
 */
struct altera_uart {};

static u32 altera_uart_readl(struct uart_port *port, int reg)
{}

static void altera_uart_writel(struct uart_port *port, u32 dat, int reg)
{}

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

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

static void altera_uart_update_ctrl_reg(struct altera_uart *pp)
{}

static void altera_uart_set_mctrl(struct uart_port *port, unsigned int sigs)
{}

static void altera_uart_start_tx(struct uart_port *port)
{}

static void altera_uart_stop_tx(struct uart_port *port)
{}

static void altera_uart_stop_rx(struct uart_port *port)
{}

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

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

static void altera_uart_rx_chars(struct uart_port *port)
{}

static void altera_uart_tx_chars(struct uart_port *port)
{}

static irqreturn_t altera_uart_interrupt(int irq, void *data)
{}

static void altera_uart_timer(struct timer_list *t)
{}

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

static int altera_uart_startup(struct uart_port *port)
{}

static void altera_uart_shutdown(struct uart_port *port)
{}

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

static int altera_uart_request_port(struct uart_port *port)
{}

static void altera_uart_release_port(struct uart_port *port)
{}

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

#ifdef CONFIG_CONSOLE_POLL
static int altera_uart_poll_get_char(struct uart_port *port)
{}

static void altera_uart_poll_put_char(struct uart_port *port, unsigned char c)
{}
#endif

/*
 *	Define the basic serial functions we support.
 */
static const struct uart_ops altera_uart_ops =;

static struct altera_uart altera_uart_ports[CONFIG_SERIAL_ALTERA_UART_MAXPORTS];

#if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE)

static void altera_uart_console_putc(struct uart_port *port, unsigned char c)
{}

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

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

static struct uart_driver altera_uart_driver;

static struct console altera_uart_console =;

static int __init altera_uart_console_init(void)
{}

console_initcall(altera_uart_console_init);

#define ALTERA_UART_CONSOLE

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

static int __init altera_uart_earlycon_setup(struct earlycon_device *dev,
					     const char *options)
{}

OF_EARLYCON_DECLARE();

#else

#define ALTERA_UART_CONSOLE

#endif /* CONFIG_SERIAL_ALTERA_UART_CONSOLE */

/*
 *	Define the altera_uart UART driver structure.
 */
static struct uart_driver altera_uart_driver =;

static int altera_uart_probe(struct platform_device *pdev)
{}

static void altera_uart_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_OF
static const struct of_device_id altera_uart_match[] =;
MODULE_DEVICE_TABLE(of, altera_uart_match);
#endif /* CONFIG_OF */

static struct platform_driver altera_uart_platform_driver =;

static int __init altera_uart_init(void)
{}

static void __exit altera_uart_exit(void)
{}

module_init();
module_exit(altera_uart_exit);

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_ALIAS();
MODULE_ALIAS_CHARDEV_MAJOR();