linux/drivers/tty/serial/st-asc.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * st-asc.c: ST Asynchronous serial controller (ASC) driver
 *
 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited
 */

#include <linux/module.h>
#include <linux/serial.h>
#include <linux/console.h>
#include <linux/sysrq.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/serial_core.h>
#include <linux/clk.h>
#include <linux/gpio/consumer.h>

#define DRIVER_NAME
#define ASC_SERIAL_NAME
#define ASC_FIFO_SIZE
#define ASC_MAX_PORTS

/* Pinctrl states */
#define DEFAULT
#define NO_HW_FLOWCTRL

struct asc_port {};

static struct asc_port asc_ports[ASC_MAX_PORTS];
static struct uart_driver asc_uart_driver;

/*---- UART Register definitions ------------------------------*/

/* Register offsets */

#define ASC_BAUDRATE
#define ASC_TXBUF
#define ASC_RXBUF
#define ASC_CTL
#define ASC_INTEN
#define ASC_STA
#define ASC_GUARDTIME
#define ASC_TIMEOUT
#define ASC_TXRESET
#define ASC_RXRESET
#define ASC_RETRIES

/* ASC_RXBUF */
#define ASC_RXBUF_PE
#define ASC_RXBUF_FE
/*
 * Some of status comes from higher bits of the character and some come from
 * the status register. Combining both of them in to single status using dummy
 * bits.
 */
#define ASC_RXBUF_DUMMY_RX
#define ASC_RXBUF_DUMMY_BE
#define ASC_RXBUF_DUMMY_OE

/* ASC_CTL */

#define ASC_CTL_MODE_MSK
#define ASC_CTL_MODE_8BIT
#define ASC_CTL_MODE_7BIT_PAR
#define ASC_CTL_MODE_9BIT
#define ASC_CTL_MODE_8BIT_WKUP
#define ASC_CTL_MODE_8BIT_PAR
#define ASC_CTL_STOP_MSK
#define ASC_CTL_STOP_HALFBIT
#define ASC_CTL_STOP_1BIT
#define ASC_CTL_STOP_1_HALFBIT
#define ASC_CTL_STOP_2BIT
#define ASC_CTL_PARITYODD
#define ASC_CTL_LOOPBACK
#define ASC_CTL_RUN
#define ASC_CTL_RXENABLE
#define ASC_CTL_SCENABLE
#define ASC_CTL_FIFOENABLE
#define ASC_CTL_CTSENABLE
#define ASC_CTL_BAUDMODE

/* ASC_GUARDTIME */

#define ASC_GUARDTIME_MSK

/* ASC_INTEN */

#define ASC_INTEN_RBE
#define ASC_INTEN_TE
#define ASC_INTEN_THE
#define ASC_INTEN_PE
#define ASC_INTEN_FE
#define ASC_INTEN_OE
#define ASC_INTEN_TNE
#define ASC_INTEN_TOI
#define ASC_INTEN_RHF

/* ASC_RETRIES */

#define ASC_RETRIES_MSK

/* ASC_RXBUF */

#define ASC_RXBUF_MSK

/* ASC_STA */

#define ASC_STA_RBF
#define ASC_STA_TE
#define ASC_STA_THE
#define ASC_STA_PE
#define ASC_STA_FE
#define ASC_STA_OE
#define ASC_STA_TNE
#define ASC_STA_TOI
#define ASC_STA_RHF
#define ASC_STA_TF
#define ASC_STA_NKD

/* ASC_TIMEOUT */

#define ASC_TIMEOUT_MSK

/* ASC_TXBUF */

#define ASC_TXBUF_MSK

/*---- Inline function definitions ---------------------------*/

static inline struct asc_port *to_asc_port(struct uart_port *port)
{}

static inline u32 asc_in(struct uart_port *port, u32 offset)
{}

static inline void asc_out(struct uart_port *port, u32 offset, u32 value)
{}

/*
 * Some simple utility functions to enable and disable interrupts.
 * Note that these need to be called with interrupts disabled.
 */
static inline void asc_disable_tx_interrupts(struct uart_port *port)
{}

static inline void asc_enable_tx_interrupts(struct uart_port *port)
{}

static inline void asc_disable_rx_interrupts(struct uart_port *port)
{}

static inline void asc_enable_rx_interrupts(struct uart_port *port)
{}

static inline u32 asc_txfifo_is_empty(struct uart_port *port)
{}

static inline u32 asc_txfifo_is_half_empty(struct uart_port *port)
{}

static inline const char *asc_port_name(struct uart_port *port)
{}

/*----------------------------------------------------------------------*/

/*
 * This section contains code to support the use of the ASC as a
 * generic serial port.
 */

static inline unsigned asc_hw_txroom(struct uart_port *port)
{}

/*
 * Start transmitting chars.
 * This is called from both interrupt and task level.
 * Either way interrupts are disabled.
 */
static void asc_transmit_chars(struct uart_port *port)
{}

static void asc_receive_chars(struct uart_port *port)
{}

static irqreturn_t asc_interrupt(int irq, void *ptr)
{}

/*----------------------------------------------------------------------*/

/*
 * UART Functions
 */

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

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

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

/* There are probably characters waiting to be transmitted. */
static void asc_start_tx(struct uart_port *port)
{}

/* Transmit stop */
static void asc_stop_tx(struct uart_port *port)
{}

/* Receive stop */
static void asc_stop_rx(struct uart_port *port)
{}

/* Handle breaks - ignored by us */
static void asc_break_ctl(struct uart_port *port, int break_state)
{}

/*
 * Enable port for reception.
 */
static int asc_startup(struct uart_port *port)
{}

static void asc_shutdown(struct uart_port *port)
{}

static void asc_pm(struct uart_port *port, unsigned int state,
		unsigned int oldstate)
{}

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

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

static void asc_release_port(struct uart_port *port)
{}

static int asc_request_port(struct uart_port *port)
{}

/*
 * Called when the port is opened, and UPF_BOOT_AUTOCONF flag is set
 * Set type field if successful
 */
static void asc_config_port(struct uart_port *port, int flags)
{}

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

#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 asc_get_poll_char(struct uart_port *port)
{}

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

#endif /* CONFIG_CONSOLE_POLL */

/*---------------------------------------------------------------------*/

static const struct uart_ops asc_uart_ops =;

static int asc_init_port(struct asc_port *ascport,
			  struct platform_device *pdev)
{}

static struct asc_port *asc_of_get_asc_port(struct platform_device *pdev)
{}

#ifdef CONFIG_OF
static const struct of_device_id asc_match[] =;

MODULE_DEVICE_TABLE(of, asc_match);
#endif

static int asc_serial_probe(struct platform_device *pdev)
{}

static void asc_serial_remove(struct platform_device *pdev)
{}

static int asc_serial_suspend(struct device *dev)
{}

static int asc_serial_resume(struct device *dev)
{}

/*----------------------------------------------------------------------*/

#ifdef CONFIG_SERIAL_ST_ASC_CONSOLE
static void asc_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...
 */

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

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

static struct console asc_console =;

#define ASC_SERIAL_CONSOLE

#else
#define ASC_SERIAL_CONSOLE
#endif /* CONFIG_SERIAL_ST_ASC_CONSOLE */

static struct uart_driver asc_uart_driver =;

static DEFINE_SIMPLE_DEV_PM_OPS(asc_serial_pm_ops, asc_serial_suspend,
						   asc_serial_resume);

static struct platform_driver asc_serial_driver =;

static int __init asc_init(void)
{}

static void __exit asc_exit(void)
{}

module_init();
module_exit(asc_exit);

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