linux/drivers/usb/serial/xr_serial.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * MaxLinear/Exar USB to Serial driver
 *
 * Copyright (c) 2020 Manivannan Sadhasivam <[email protected]>
 * Copyright (c) 2021 Johan Hovold <[email protected]>
 *
 * Based on the initial driver written by Patong Yang:
 *
 *   https://lore.kernel.org/r/20180404070634.nhspvmxcjwfgjkcv@advantechmxl-desktop
 *
 *   Copyright (c) 2018 Patong Yang <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <linux/usb/serial.h>

struct xr_txrx_clk_mask {};

#define XR_INT_OSC_HZ
#define XR21V141X_MIN_SPEED
#define XR21V141X_MAX_SPEED

/* XR21V141X register blocks */
#define XR21V141X_UART_REG_BLOCK
#define XR21V141X_UM_REG_BLOCK
#define XR21V141X_UART_CUSTOM_BLOCK

/* XR21V141X UART registers */
#define XR21V141X_CLOCK_DIVISOR_0
#define XR21V141X_CLOCK_DIVISOR_1
#define XR21V141X_CLOCK_DIVISOR_2
#define XR21V141X_TX_CLOCK_MASK_0
#define XR21V141X_TX_CLOCK_MASK_1
#define XR21V141X_RX_CLOCK_MASK_0
#define XR21V141X_RX_CLOCK_MASK_1
#define XR21V141X_REG_FORMAT

/* XR21V141X UART Manager registers */
#define XR21V141X_UM_FIFO_ENABLE_REG
#define XR21V141X_UM_ENABLE_TX_FIFO
#define XR21V141X_UM_ENABLE_RX_FIFO

#define XR21V141X_UM_RX_FIFO_RESET
#define XR21V141X_UM_TX_FIFO_RESET

#define XR_UART_ENABLE_TX
#define XR_UART_ENABLE_RX

#define XR_GPIO_RI
#define XR_GPIO_CD
#define XR_GPIO_DSR
#define XR_GPIO_DTR
#define XR_GPIO_CTS
#define XR_GPIO_RTS
#define XR_GPIO_CLK
#define XR_GPIO_XEN
#define XR_GPIO_TXT
#define XR_GPIO_RXT

#define XR_UART_DATA_MASK
#define XR_UART_DATA_7
#define XR_UART_DATA_8

#define XR_UART_PARITY_MASK
#define XR_UART_PARITY_SHIFT
#define XR_UART_PARITY_NONE
#define XR_UART_PARITY_ODD
#define XR_UART_PARITY_EVEN
#define XR_UART_PARITY_MARK
#define XR_UART_PARITY_SPACE

#define XR_UART_STOP_MASK
#define XR_UART_STOP_SHIFT
#define XR_UART_STOP_1
#define XR_UART_STOP_2

#define XR_UART_FLOW_MODE_NONE
#define XR_UART_FLOW_MODE_HW
#define XR_UART_FLOW_MODE_SW

#define XR_GPIO_MODE_SEL_MASK
#define XR_GPIO_MODE_SEL_RTS_CTS
#define XR_GPIO_MODE_SEL_DTR_DSR
#define XR_GPIO_MODE_SEL_RS485
#define XR_GPIO_MODE_SEL_RS485_ADDR
#define XR_GPIO_MODE_RS485_TX_H
#define XR_GPIO_MODE_TX_TOGGLE
#define XR_GPIO_MODE_RX_TOGGLE

#define XR_FIFO_RESET

#define XR_CUSTOM_DRIVER_ACTIVE

static int xr21v141x_uart_enable(struct usb_serial_port *port);
static int xr21v141x_uart_disable(struct usb_serial_port *port);
static int xr21v141x_fifo_reset(struct usb_serial_port *port);
static void xr21v141x_set_line_settings(struct tty_struct *tty,
					struct usb_serial_port *port,
					const struct ktermios *old_termios);

struct xr_type {};

enum xr_type_id {};

static const struct xr_type xr_types[] =;

struct xr_data {};

static int xr_set_reg(struct usb_serial_port *port, u8 channel, u16 reg, u16 val)
{}

static int xr_get_reg(struct usb_serial_port *port, u8 channel, u16 reg, u16 *val)
{}

static int xr_set_reg_uart(struct usb_serial_port *port, u16 reg, u16 val)
{}

static int xr_get_reg_uart(struct usb_serial_port *port, u16 reg, u16 *val)
{}

static int xr_set_reg_um(struct usb_serial_port *port, u8 reg_base, u8 val)
{}

static int __xr_uart_enable(struct usb_serial_port *port)
{}

static int __xr_uart_disable(struct usb_serial_port *port)
{}

/*
 * According to datasheet, below is the recommended sequence for enabling UART
 * module in XR21V141X:
 *
 * Enable Tx FIFO
 * Enable Tx and Rx
 * Enable Rx FIFO
 */
static int xr21v141x_uart_enable(struct usb_serial_port *port)
{}

static int xr21v141x_uart_disable(struct usb_serial_port *port)
{}

static int xr_uart_enable(struct usb_serial_port *port)
{}

static int xr_uart_disable(struct usb_serial_port *port)
{}

static int xr21v141x_fifo_reset(struct usb_serial_port *port)
{}

static int xr_fifo_reset(struct usb_serial_port *port)
{}

static int xr_tiocmget(struct tty_struct *tty)
{}

static int xr_tiocmset_port(struct usb_serial_port *port,
			    unsigned int set, unsigned int clear)
{}

static int xr_tiocmset(struct tty_struct *tty,
		       unsigned int set, unsigned int clear)
{}

static void xr_dtr_rts(struct usb_serial_port *port, int on)
{}

static int xr_break_ctl(struct tty_struct *tty, int break_state)
{}

/* Tx and Rx clock mask values obtained from section 3.3.4 of datasheet */
static const struct xr_txrx_clk_mask xr21v141x_txrx_clk_masks[] =;

static int xr21v141x_set_baudrate(struct tty_struct *tty, struct usb_serial_port *port)
{}

static void xr_set_flow_mode(struct tty_struct *tty,
		             struct usb_serial_port *port,
		             const struct ktermios *old_termios)
{}

static void xr21v141x_set_line_settings(struct tty_struct *tty,
				        struct usb_serial_port *port,
				        const struct ktermios *old_termios)
{}

static void xr_cdc_set_line_coding(struct tty_struct *tty,
				   struct usb_serial_port *port,
				   const struct ktermios *old_termios)
{}

static void xr_sanitize_serial_rs485(struct serial_rs485 *rs485)
{}

static int xr_get_rs485_config(struct tty_struct *tty,
			       struct serial_rs485 __user *argp)
{}

static int xr_set_rs485_config(struct tty_struct *tty,
			       struct serial_rs485 __user *argp)
{}

static int xr_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
{}

static void xr_set_termios(struct tty_struct *tty,
			   struct usb_serial_port *port,
			   const struct ktermios *old_termios)
{}

static int xr_open(struct tty_struct *tty, struct usb_serial_port *port)
{}

static void xr_close(struct usb_serial_port *port)
{}

static int xr_probe(struct usb_serial *serial, const struct usb_device_id *id)
{}

static int xr_gpio_init(struct usb_serial_port *port, const struct xr_type *type)
{}

static int xr_port_probe(struct usb_serial_port *port)
{}

static void xr_port_remove(struct usb_serial_port *port)
{}

#define XR_DEVICE(vid, pid, type)

static const struct usb_device_id id_table[] =;
MODULE_DEVICE_TABLE(usb, id_table);

static struct usb_serial_driver xr_device =;

static struct usb_serial_driver * const serial_drivers[] =;

module_usb_serial_driver();

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