linux/drivers/usb/serial/whiteheat.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * USB ConnectTech WhiteHEAT driver
 *
 *	Copyright (C) 2002
 *	    Connect Tech Inc.
 *
 *	Copyright (C) 1999 - 2001
 *	    Greg Kroah-Hartman ([email protected])
 *
 * See Documentation/usb/usb-serial.rst for more information on using this
 * driver
 */

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
#include <asm/termbits.h>
#include <linux/usb.h>
#include <linux/serial_reg.h>
#include <linux/serial.h>
#include <linux/usb/serial.h>
#include <linux/usb/ezusb.h>
#include "whiteheat.h"			/* WhiteHEAT specific commands */

/*
 * Version Information
 */
#define DRIVER_AUTHOR
#define DRIVER_DESC

#define CONNECT_TECH_VENDOR_ID
#define CONNECT_TECH_FAKE_WHITE_HEAT_ID
#define CONNECT_TECH_WHITE_HEAT_ID

/*
   ID tables for whiteheat are unusual, because we want to different
   things for different versions of the device.  Eventually, this
   will be doable from a single table.  But, for now, we define two
   separate ID tables, and then a third table that combines them
   just for the purpose of exporting the autoloading information.
*/
static const struct usb_device_id id_table_std[] =;

static const struct usb_device_id id_table_prerenumeration[] =;

static const struct usb_device_id id_table_combined[] =;

MODULE_DEVICE_TABLE(usb, id_table_combined);


/* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */
static int  whiteheat_firmware_download(struct usb_serial *serial,
					const struct usb_device_id *id);
static int  whiteheat_firmware_attach(struct usb_serial *serial);

/* function prototypes for the Connect Tech WhiteHEAT serial converter */
static int  whiteheat_attach(struct usb_serial *serial);
static void whiteheat_release(struct usb_serial *serial);
static int  whiteheat_port_probe(struct usb_serial_port *port);
static void whiteheat_port_remove(struct usb_serial_port *port);
static int  whiteheat_open(struct tty_struct *tty,
			struct usb_serial_port *port);
static void whiteheat_close(struct usb_serial_port *port);
static void whiteheat_get_serial(struct tty_struct *tty,
			struct serial_struct *ss);
static void whiteheat_set_termios(struct tty_struct *tty,
				  struct usb_serial_port *port,
				  const struct ktermios *old_termios);
static int  whiteheat_tiocmget(struct tty_struct *tty);
static int  whiteheat_tiocmset(struct tty_struct *tty,
			unsigned int set, unsigned int clear);
static int whiteheat_break_ctl(struct tty_struct *tty, int break_state);

static struct usb_serial_driver whiteheat_fake_device =;

static struct usb_serial_driver whiteheat_device =;

static struct usb_serial_driver * const serial_drivers[] =;

struct whiteheat_command_private {};

struct whiteheat_private {};


/* local function prototypes */
static int start_command_port(struct usb_serial *serial);
static void stop_command_port(struct usb_serial *serial);
static void command_port_write_callback(struct urb *urb);
static void command_port_read_callback(struct urb *urb);

static int firm_send_command(struct usb_serial_port *port, __u8 command,
						__u8 *data, __u8 datasize);
static int firm_open(struct usb_serial_port *port);
static int firm_close(struct usb_serial_port *port);
static void firm_setup_port(struct tty_struct *tty);
static int firm_set_rts(struct usb_serial_port *port, __u8 onoff);
static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff);
static int firm_set_break(struct usb_serial_port *port, __u8 onoff);
static int firm_purge(struct usb_serial_port *port, __u8 rxtx);
static int firm_get_dtr_rts(struct usb_serial_port *port);
static int firm_report_tx_done(struct usb_serial_port *port);


#define COMMAND_PORT
#define COMMAND_TIMEOUT
#define COMMAND_TIMEOUT_MS


/*****************************************************************************
 * Connect Tech's White Heat prerenumeration driver functions
 *****************************************************************************/

/* steps to download the firmware to the WhiteHEAT device:
 - hold the reset (by writing to the reset bit of the CPUCS register)
 - download the VEND_AX.HEX file to the chip using VENDOR_REQUEST-ANCHOR_LOAD
 - release the reset (by writing to the CPUCS register)
 - download the WH.HEX file for all addresses greater than 0x1b3f using
   VENDOR_REQUEST-ANCHOR_EXTERNAL_RAM_LOAD
 - hold the reset
 - download the WH.HEX file for all addresses less than 0x1b40 using
   VENDOR_REQUEST_ANCHOR_LOAD
 - release the reset
 - device renumerated itself and comes up as new device id with all
   firmware download completed.
*/
static int whiteheat_firmware_download(struct usb_serial *serial,
					const struct usb_device_id *id)
{}


static int whiteheat_firmware_attach(struct usb_serial *serial)
{}


/*****************************************************************************
 * Connect Tech's White Heat serial driver functions
 *****************************************************************************/

static int whiteheat_attach(struct usb_serial *serial)
{}

static void whiteheat_release(struct usb_serial *serial)
{}

static int whiteheat_port_probe(struct usb_serial_port *port)
{}

static void whiteheat_port_remove(struct usb_serial_port *port)
{}

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


static void whiteheat_close(struct usb_serial_port *port)
{}

static int whiteheat_tiocmget(struct tty_struct *tty)
{}

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


static void whiteheat_get_serial(struct tty_struct *tty, struct serial_struct *ss)
{}


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

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


/*****************************************************************************
 * Connect Tech's White Heat callback routines
 *****************************************************************************/
static void command_port_write_callback(struct urb *urb)
{}


static void command_port_read_callback(struct urb *urb)
{}


/*****************************************************************************
 * Connect Tech's White Heat firmware interface
 *****************************************************************************/
static int firm_send_command(struct usb_serial_port *port, __u8 command,
						__u8 *data, __u8 datasize)
{}


static int firm_open(struct usb_serial_port *port)
{}


static int firm_close(struct usb_serial_port *port)
{}


static void firm_setup_port(struct tty_struct *tty)
{}


static int firm_set_rts(struct usb_serial_port *port, __u8 onoff)
{}


static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff)
{}


static int firm_set_break(struct usb_serial_port *port, __u8 onoff)
{}


static int firm_purge(struct usb_serial_port *port, __u8 rxtx)
{}


static int firm_get_dtr_rts(struct usb_serial_port *port)
{}


static int firm_report_tx_done(struct usb_serial_port *port)
{}


/*****************************************************************************
 * Connect Tech's White Heat utility functions
 *****************************************************************************/
static int start_command_port(struct usb_serial *serial)
{}


static void stop_command_port(struct usb_serial *serial)
{}

module_usb_serial_driver();

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

MODULE_FIRMWARE();
MODULE_FIRMWARE();