linux/drivers/tty/serial/meson_uart.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Based on meson_uart.c, by AMLOGIC, INC.
 *
 * Copyright (C) 2014 Carlo Caione <[email protected]>
 */

#include <linux/clk.h>
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>

/* Register offsets */
#define AML_UART_WFIFO
#define AML_UART_RFIFO
#define AML_UART_CONTROL
#define AML_UART_STATUS
#define AML_UART_MISC
#define AML_UART_REG5

/* AML_UART_CONTROL bits */
#define AML_UART_TX_EN
#define AML_UART_RX_EN
#define AML_UART_TWO_WIRE_EN
#define AML_UART_STOP_BIT_LEN_MASK
#define AML_UART_STOP_BIT_1SB
#define AML_UART_STOP_BIT_2SB
#define AML_UART_PARITY_TYPE
#define AML_UART_PARITY_EN
#define AML_UART_TX_RST
#define AML_UART_RX_RST
#define AML_UART_CLEAR_ERR
#define AML_UART_RX_INT_EN
#define AML_UART_TX_INT_EN
#define AML_UART_DATA_LEN_MASK
#define AML_UART_DATA_LEN_8BIT
#define AML_UART_DATA_LEN_7BIT
#define AML_UART_DATA_LEN_6BIT
#define AML_UART_DATA_LEN_5BIT

/* AML_UART_STATUS bits */
#define AML_UART_PARITY_ERR
#define AML_UART_FRAME_ERR
#define AML_UART_TX_FIFO_WERR
#define AML_UART_RX_EMPTY
#define AML_UART_TX_FULL
#define AML_UART_TX_EMPTY
#define AML_UART_XMIT_BUSY
#define AML_UART_ERR

/* AML_UART_MISC bits */
#define AML_UART_XMIT_IRQ(c)
#define AML_UART_RECV_IRQ(c)

/* AML_UART_REG5 bits */
#define AML_UART_BAUD_MASK
#define AML_UART_BAUD_USE
#define AML_UART_BAUD_XTAL
#define AML_UART_BAUD_XTAL_DIV2

#define AML_UART_PORT_NUM
#define AML_UART_PORT_OFFSET

#define AML_UART_POLL_USEC
#define AML_UART_TIMEOUT_USEC

static struct uart_driver meson_uart_driver_ttyAML;
static struct uart_driver meson_uart_driver_ttyS;

static struct uart_port *meson_ports[AML_UART_PORT_NUM];

struct meson_uart_data {};

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

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

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

static void meson_uart_stop_tx(struct uart_port *port)
{}

static void meson_uart_stop_rx(struct uart_port *port)
{}

static void meson_uart_shutdown(struct uart_port *port)
{}

static void meson_uart_start_tx(struct uart_port *port)
{}

static void meson_receive_chars(struct uart_port *port)
{}

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

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

/*
 * This function is called only from probe() using a temporary io mapping
 * in order to perform a reset before setting up the device. Since the
 * temporarily mapped region was successfully requested, there can be no
 * console on this port at this time. Hence it is not necessary for this
 * function to acquire the port->lock. (Since there is no console on this
 * port at this time, the port->lock is not initialized yet.)
 */
static void meson_uart_reset(struct uart_port *port)
{}

static int meson_uart_startup(struct uart_port *port)
{}

static void meson_uart_change_speed(struct uart_port *port, unsigned long baud)
{}

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

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

static void meson_uart_release_port(struct uart_port *port)
{}

static int meson_uart_request_port(struct uart_port *port)
{}

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

#ifdef CONFIG_CONSOLE_POLL
/*
 * Console polling routines for writing and reading from the uart while
 * in an interrupt or debug context (i.e. kgdb).
 */

static int meson_uart_poll_get_char(struct uart_port *port)
{}

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

#endif /* CONFIG_CONSOLE_POLL */

static const struct uart_ops meson_uart_ops =;

#ifdef CONFIG_SERIAL_MESON_CONSOLE
static void meson_uart_enable_tx_engine(struct uart_port *port)
{}

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

static void meson_serial_port_write(struct uart_port *port, const char *s,
				    u_int count)
{}

static void meson_serial_console_write(struct console *co, const char *s,
				       u_int count)
{}

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

#define MESON_SERIAL_CONSOLE(_devname)

MESON_SERIAL_CONSOLE();
MESON_SERIAL_CONSOLE();

static void meson_serial_early_console_write(struct console *co,
					     const char *s,
					     u_int count)
{}

static int __init
meson_serial_early_console_setup(struct earlycon_device *device, const char *opt)
{}

OF_EARLYCON_DECLARE();
OF_EARLYCON_DECLARE();

#define MESON_SERIAL_CONSOLE_PTR(_devname)
#else
#define MESON_SERIAL_CONSOLE_PTR
#endif

#define MESON_UART_DRIVER(_devname)

MESON_UART_DRIVER();
MESON_UART_DRIVER();

static int meson_uart_probe_clocks(struct platform_device *pdev,
				   struct uart_port *port)
{}

static struct uart_driver *meson_uart_current(const struct meson_uart_data *pd)
{}

static int meson_uart_probe(struct platform_device *pdev)
{}

static void meson_uart_remove(struct platform_device *pdev)
{}

static struct meson_uart_data meson_g12a_uart_data =;

static struct meson_uart_data meson_a1_uart_data =;

static struct meson_uart_data meson_s4_uart_data =;

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

static  struct platform_driver meson_uart_platform_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();