18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Definitions for Belkin USB Serial Adapter Driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2000
68c2ecf20Sopenharmony_ci *      William Greathouse (wgreathouse@smva.com)
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci *  This program is largely derived from work by the linux-usb group
98c2ecf20Sopenharmony_ci *  and associated source files.  Please see the usb/serial files for
108c2ecf20Sopenharmony_ci *  individual credits and copyrights.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * See Documentation/usb/usb-serial.rst for more information on using this
138c2ecf20Sopenharmony_ci * driver
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * 12-Mar-2001 gkh
168c2ecf20Sopenharmony_ci *	Added GoHubs GO-COM232 device id.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * 06-Nov-2000 gkh
198c2ecf20Sopenharmony_ci *	Added old Belkin and Peracom device ids, which this driver supports
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci * 12-Oct-2000 William Greathouse
228c2ecf20Sopenharmony_ci *    First cut at supporting Belkin USB Serial Adapter F5U103
238c2ecf20Sopenharmony_ci *    I did not have a copy of the original work to support this
248c2ecf20Sopenharmony_ci *    adapter, so pardon any stupid mistakes.  All of the information
258c2ecf20Sopenharmony_ci *    I am using to write this driver was acquired by using a modified
268c2ecf20Sopenharmony_ci *    UsbSnoop on Windows2000.
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#ifndef __LINUX_USB_SERIAL_BSA_H
318c2ecf20Sopenharmony_ci#define __LINUX_USB_SERIAL_BSA_H
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define BELKIN_DOCKSTATION_VID	0x050d	/* Vendor Id */
348c2ecf20Sopenharmony_ci#define BELKIN_DOCKSTATION_PID	0x1203	/* Product Id */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define BELKIN_SA_VID	0x050d	/* Vendor Id */
378c2ecf20Sopenharmony_ci#define BELKIN_SA_PID	0x0103	/* Product Id */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define BELKIN_OLD_VID	0x056c	/* Belkin's "old" vendor id */
408c2ecf20Sopenharmony_ci#define BELKIN_OLD_PID	0x8007	/* Belkin's "old" single port serial converter's id */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define PERACOM_VID	0x0565	/* Peracom's vendor id */
438c2ecf20Sopenharmony_ci#define PERACOM_PID	0x0001	/* Peracom's single port serial converter's id */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define GOHUBS_VID	0x0921	/* GoHubs vendor id */
468c2ecf20Sopenharmony_ci#define GOHUBS_PID	0x1000	/* GoHubs single port serial converter's id (identical to the Peracom device) */
478c2ecf20Sopenharmony_ci#define HANDYLINK_PID	0x1200	/* HandyLink USB's id (identical to the Peracom device) */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Vendor Request Interface */
508c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_BAUDRATE_REQUEST	0  /* Set baud rate */
518c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_STOP_BITS_REQUEST	1  /* Set stop bits (1,2) */
528c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_DATA_BITS_REQUEST	2  /* Set data bits (5,6,7,8) */
538c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_PARITY_REQUEST	3  /* Set parity (None, Even, Odd) */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_DTR_REQUEST	10 /* Set DTR state */
568c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_RTS_REQUEST	11 /* Set RTS state */
578c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_BREAK_REQUEST	12 /* Set BREAK state */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_FLOW_CTRL_REQUEST	16 /* Set flow control mode */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#ifdef WHEN_I_LEARN_THIS
638c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_MAGIC_REQUEST	17 /* I don't know, possibly flush */
648c2ecf20Sopenharmony_ci					   /* (always in Wininit sequence before flow control) */
658c2ecf20Sopenharmony_ci#define BELKIN_SA_RESET			xx /* Reset the port */
668c2ecf20Sopenharmony_ci#define BELKIN_SA_GET_MODEM_STATUS	xx /* Force return of modem status register */
678c2ecf20Sopenharmony_ci#endif
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define BELKIN_SA_SET_REQUEST_TYPE	0x40
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define BELKIN_SA_BAUD(b)		(230400/b)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define BELKIN_SA_STOP_BITS(b)		(b-1)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define BELKIN_SA_DATA_BITS(b)		(b-5)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define BELKIN_SA_PARITY_NONE		0
788c2ecf20Sopenharmony_ci#define BELKIN_SA_PARITY_EVEN		1
798c2ecf20Sopenharmony_ci#define BELKIN_SA_PARITY_ODD		2
808c2ecf20Sopenharmony_ci#define BELKIN_SA_PARITY_MARK		3
818c2ecf20Sopenharmony_ci#define BELKIN_SA_PARITY_SPACE		4
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_NONE		0x0000	/* No flow control */
848c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_OCTS		0x0001	/* use CTS input to throttle output */
858c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_ODSR		0x0002	/* use DSR input to throttle output */
868c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_IDSR		0x0004	/* use DSR input to enable receive */
878c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_IDTR		0x0008	/* use DTR output for input flow control */
888c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_IRTS		0x0010	/* use RTS output for input flow control */
898c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_ORTS		0x0020	/* use RTS to indicate data available to send */
908c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_ERRSUB		0x0040	/* ???? guess ???? substitute inline errors */
918c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_OXON		0x0080	/* use XON/XOFF for output flow control */
928c2ecf20Sopenharmony_ci#define BELKIN_SA_FLOW_IXON		0x0100	/* use XON/XOFF for input flow control */
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/*
958c2ecf20Sopenharmony_ci * It seems that the interrupt pipe is closely modelled after the
968c2ecf20Sopenharmony_ci * 16550 register layout.  This is probably because the adapter can
978c2ecf20Sopenharmony_ci * be used in a "DOS" environment to simulate a standard hardware port.
988c2ecf20Sopenharmony_ci */
998c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_INDEX		2	/*     Line Status Register */
1008c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_RDR		0x01	/* receive data ready */
1018c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_OE		0x02	/* overrun error */
1028c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_PE		0x04	/* parity error */
1038c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_FE		0x08	/* framing error */
1048c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_BI		0x10	/* break indicator */
1058c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_THE		0x20	/* tx holding register empty */
1068c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_TE		0x40	/* transmit register empty */
1078c2ecf20Sopenharmony_ci#define BELKIN_SA_LSR_ERR		0x80	/* OE | PE | FE | BI */
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_INDEX		3	/*     Modem Status Register */
1108c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_DCTS		0x01	/* Delta CTS */
1118c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_DDSR		0x02	/* Delta DSR */
1128c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_DRI		0x04	/* Delta RI */
1138c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_DCD		0x08	/* Delta CD */
1148c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_CTS		0x10	/* Current CTS */
1158c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_DSR		0x20	/* Current DSR */
1168c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_RI		0x40	/* Current RI */
1178c2ecf20Sopenharmony_ci#define BELKIN_SA_MSR_CD		0x80	/* Current CD */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#endif /* __LINUX_USB_SERIAL_BSA_H */
1208c2ecf20Sopenharmony_ci
121