linux/drivers/tty/serial/msm_serial.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for msm7k serial device and console
 *
 * Copyright (C) 2007 Google, Inc.
 * Author: Robert Love <[email protected]>
 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
 */

#include <linux/kernel.h>
#include <linux/atomic.h>
#include <linux/dma/qcom_adm.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial_core.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/wait.h>

#define MSM_UART_MR1

#define MSM_UART_MR1_AUTO_RFR_LEVEL0
#define MSM_UART_MR1_AUTO_RFR_LEVEL1
#define MSM_UART_DM_MR1_AUTO_RFR_LEVEL1
#define MSM_UART_MR1_RX_RDY_CTL
#define MSM_UART_MR1_CTS_CTL

#define MSM_UART_MR2
#define MSM_UART_MR2_ERROR_MODE
#define MSM_UART_MR2_BITS_PER_CHAR
#define MSM_UART_MR2_BITS_PER_CHAR_5
#define MSM_UART_MR2_BITS_PER_CHAR_6
#define MSM_UART_MR2_BITS_PER_CHAR_7
#define MSM_UART_MR2_BITS_PER_CHAR_8
#define MSM_UART_MR2_STOP_BIT_LEN_ONE
#define MSM_UART_MR2_STOP_BIT_LEN_TWO
#define MSM_UART_MR2_PARITY_MODE_NONE
#define MSM_UART_MR2_PARITY_MODE_ODD
#define MSM_UART_MR2_PARITY_MODE_EVEN
#define MSM_UART_MR2_PARITY_MODE_SPACE
#define MSM_UART_MR2_PARITY_MODE

#define MSM_UART_CSR

#define MSM_UART_TF
#define UARTDM_TF

#define MSM_UART_CR
#define MSM_UART_CR_CMD_NULL
#define MSM_UART_CR_CMD_RESET_RX
#define MSM_UART_CR_CMD_RESET_TX
#define MSM_UART_CR_CMD_RESET_ERR
#define MSM_UART_CR_CMD_RESET_BREAK_INT
#define MSM_UART_CR_CMD_START_BREAK
#define MSM_UART_CR_CMD_STOP_BREAK
#define MSM_UART_CR_CMD_RESET_CTS
#define MSM_UART_CR_CMD_RESET_STALE_INT
#define MSM_UART_CR_CMD_PACKET_MODE
#define MSM_UART_CR_CMD_MODE_RESET
#define MSM_UART_CR_CMD_SET_RFR
#define MSM_UART_CR_CMD_RESET_RFR
#define MSM_UART_CR_CMD_PROTECTION_EN
#define MSM_UART_CR_CMD_STALE_EVENT_DISABLE
#define MSM_UART_CR_CMD_STALE_EVENT_ENABLE
#define MSM_UART_CR_CMD_FORCE_STALE
#define MSM_UART_CR_CMD_RESET_TX_READY
#define MSM_UART_CR_TX_DISABLE
#define MSM_UART_CR_TX_ENABLE
#define MSM_UART_CR_RX_DISABLE
#define MSM_UART_CR_RX_ENABLE
#define MSM_UART_CR_CMD_RESET_RXBREAK_START

#define MSM_UART_IMR
#define MSM_UART_IMR_TXLEV
#define MSM_UART_IMR_RXSTALE
#define MSM_UART_IMR_RXLEV
#define MSM_UART_IMR_DELTA_CTS
#define MSM_UART_IMR_CURRENT_CTS
#define MSM_UART_IMR_RXBREAK_START

#define MSM_UART_IPR_RXSTALE_LAST
#define MSM_UART_IPR_STALE_LSB
#define MSM_UART_IPR_STALE_TIMEOUT_MSB
#define MSM_UART_DM_IPR_STALE_TIMEOUT_MSB

#define MSM_UART_IPR
#define MSM_UART_TFWR
#define MSM_UART_RFWR
#define MSM_UART_HCR

#define MSM_UART_MREG
#define MSM_UART_NREG
#define MSM_UART_DREG
#define MSM_UART_MNDREG
#define MSM_UART_IRDA
#define MSM_UART_MISR_MODE
#define MSM_UART_MISR_RESET
#define MSM_UART_MISR_EXPORT
#define MSM_UART_MISR_VAL
#define MSM_UART_TEST_CTRL

#define MSM_UART_SR
#define MSM_UART_SR_HUNT_CHAR
#define MSM_UART_SR_RX_BREAK
#define MSM_UART_SR_PAR_FRAME_ERR
#define MSM_UART_SR_OVERRUN
#define MSM_UART_SR_TX_EMPTY
#define MSM_UART_SR_TX_READY
#define MSM_UART_SR_RX_FULL
#define MSM_UART_SR_RX_READY

#define MSM_UART_RF
#define UARTDM_RF
#define MSM_UART_MISR
#define MSM_UART_ISR
#define MSM_UART_ISR_TX_READY

#define UARTDM_RXFS
#define UARTDM_RXFS_BUF_SHIFT
#define UARTDM_RXFS_BUF_MASK

#define UARTDM_DMEN
#define UARTDM_DMEN_RX_SC_ENABLE
#define UARTDM_DMEN_TX_SC_ENABLE

#define UARTDM_DMEN_TX_BAM_ENABLE
#define UARTDM_DMEN_TX_DM_ENABLE

#define UARTDM_DMEN_RX_BAM_ENABLE
#define UARTDM_DMEN_RX_DM_ENABLE

#define UARTDM_DMRX
#define UARTDM_NCF_TX
#define UARTDM_RX_TOTAL_SNAP

#define UARTDM_BURST_SIZE
#define UARTDM_TX_AIGN(x)
#define UARTDM_TX_MAX
#define UARTDM_RX_SIZE

enum {};

struct msm_dma {};

struct msm_port {};

static inline struct msm_port *to_msm_port(struct uart_port *up)
{}

static
void msm_write(struct uart_port *port, unsigned int val, unsigned int off)
{}

static
unsigned int msm_read(struct uart_port *port, unsigned int off)
{}

/*
 * Setup the MND registers to use the TCXO clock.
 */
static void msm_serial_set_mnd_regs_tcxo(struct uart_port *port)
{}

/*
 * Setup the MND registers to use the TCXO clock divided by 4.
 */
static void msm_serial_set_mnd_regs_tcxoby4(struct uart_port *port)
{}

static void msm_serial_set_mnd_regs(struct uart_port *port)
{}

static void msm_handle_tx(struct uart_port *port);
static void msm_start_rx_dma(struct msm_port *msm_port);

static void msm_stop_dma(struct uart_port *port, struct msm_dma *dma)
{}

static void msm_release_dma(struct msm_port *msm_port)
{}

static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base)
{}

static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base)
{}

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

static void msm_stop_tx(struct uart_port *port)
{}

static void msm_start_tx(struct uart_port *port)
{}

static void msm_reset_dm_count(struct uart_port *port, int count)
{}

static void msm_complete_tx_dma(void *args)
{}

static int msm_handle_tx_dma(struct msm_port *msm_port, unsigned int count)
{}

static void msm_complete_rx_dma(void *args)
{}

static void msm_start_rx_dma(struct msm_port *msm_port)
{}

static void msm_stop_rx(struct uart_port *port)
{}

static void msm_enable_ms(struct uart_port *port)
{}

static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr)
	__must_hold(&port->lock)
{}

static void msm_handle_rx(struct uart_port *port)
	__must_hold(&port->lock)
{}

static void msm_handle_tx_pio(struct uart_port *port, unsigned int tx_count)
{}

static void msm_handle_tx(struct uart_port *port)
{}

static void msm_handle_delta_cts(struct uart_port *port)
{}

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

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

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

static void msm_reset(struct uart_port *port)
{}

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

static void msm_break_ctl(struct uart_port *port, int break_ctl)
{}

struct msm_baud_map {};

static const struct msm_baud_map *
msm_find_best_baud(struct uart_port *port, unsigned int baud,
		   unsigned long *rate)
{}

static int msm_set_baud_rate(struct uart_port *port, unsigned int baud,
			     unsigned long *saved_flags)
	__must_hold(&port->lock)
{}

static void msm_init_clock(struct uart_port *port)
{}

static int msm_startup(struct uart_port *port)
{}

static void msm_shutdown(struct uart_port *port)
{}

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

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

static void msm_release_port(struct uart_port *port)
{}

static int msm_request_port(struct uart_port *port)
{}

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

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

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

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

static int msm_poll_get_char_dm(struct uart_port *port)
{}

static int msm_poll_get_char(struct uart_port *port)
{}

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

static const struct uart_ops msm_uart_pops =;

static struct msm_port msm_uart_ports[] =;

#define MSM_UART_NR

static inline struct uart_port *msm_get_port_from_line(unsigned int line)
{}

#ifdef CONFIG_SERIAL_MSM_CONSOLE
static void __msm_console_write(struct uart_port *port, const char *s,
				unsigned int count, bool is_uartdm)
{}

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

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

static void
msm_serial_early_write(struct console *con, const char *s, unsigned n)
{}

static int __init
msm_serial_early_console_setup(struct earlycon_device *device, const char *opt)
{}
OF_EARLYCON_DECLARE();

static void
msm_serial_early_write_dm(struct console *con, const char *s, unsigned n)
{}

static int __init
msm_serial_early_console_setup_dm(struct earlycon_device *device,
				  const char *opt)
{}
OF_EARLYCON_DECLARE();

static struct uart_driver msm_uart_driver;

static struct console msm_console =;

#define MSM_CONSOLE

#else
#define MSM_CONSOLE
#endif

static struct uart_driver msm_uart_driver =;

static atomic_t msm_uart_next_id =;

static const struct of_device_id msm_uartdm_table[] =;

static int msm_serial_probe(struct platform_device *pdev)
{}

static void msm_serial_remove(struct platform_device *pdev)
{}

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

static int __maybe_unused msm_serial_suspend(struct device *dev)
{}

static int __maybe_unused msm_serial_resume(struct device *dev)
{}

static const struct dev_pm_ops msm_serial_dev_pm_ops =;

static struct platform_driver msm_platform_driver =;

static int __init msm_serial_init(void)
{}

static void __exit msm_serial_exit(void)
{}

module_init();
module_exit(msm_serial_exit);

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