xref: /openbmc/linux/drivers/usb/serial/belkin_sa.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*788a4ee6SNishad Kamdar /* SPDX-License-Identifier: GPL-2.0+ */
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  * Definitions for Belkin USB Serial Adapter Driver
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  *  Copyright (C) 2000
61da177e4SLinus Torvalds  *      William Greathouse (wgreathouse@smva.com)
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  *  This program is largely derived from work by the linux-usb group
91da177e4SLinus Torvalds  *  and associated source files.  Please see the usb/serial files for
101da177e4SLinus Torvalds  *  individual credits and copyrights.
111da177e4SLinus Torvalds  *
12ecefae6dSMauro Carvalho Chehab  * See Documentation/usb/usb-serial.rst for more information on using this
13b69c1499SAlan Cox  * driver
141da177e4SLinus Torvalds  *
151da177e4SLinus Torvalds  * 12-Mar-2001 gkh
161da177e4SLinus Torvalds  *	Added GoHubs GO-COM232 device id.
171da177e4SLinus Torvalds  *
181da177e4SLinus Torvalds  * 06-Nov-2000 gkh
191da177e4SLinus Torvalds  *	Added old Belkin and Peracom device ids, which this driver supports
201da177e4SLinus Torvalds  *
211da177e4SLinus Torvalds  * 12-Oct-2000 William Greathouse
221da177e4SLinus Torvalds  *    First cut at supporting Belkin USB Serial Adapter F5U103
231da177e4SLinus Torvalds  *    I did not have a copy of the original work to support this
241da177e4SLinus Torvalds  *    adapter, so pardon any stupid mistakes.  All of the information
251da177e4SLinus Torvalds  *    I am using to write this driver was acquired by using a modified
261da177e4SLinus Torvalds  *    UsbSnoop on Windows2000.
271da177e4SLinus Torvalds  *
281da177e4SLinus Torvalds  */
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds #ifndef __LINUX_USB_SERIAL_BSA_H
311da177e4SLinus Torvalds #define __LINUX_USB_SERIAL_BSA_H
321da177e4SLinus Torvalds 
331da177e4SLinus Torvalds #define BELKIN_DOCKSTATION_VID	0x050d	/* Vendor Id */
341da177e4SLinus Torvalds #define BELKIN_DOCKSTATION_PID	0x1203	/* Product Id */
351da177e4SLinus Torvalds 
361da177e4SLinus Torvalds #define BELKIN_SA_VID	0x050d	/* Vendor Id */
371da177e4SLinus Torvalds #define BELKIN_SA_PID	0x0103	/* Product Id */
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds #define BELKIN_OLD_VID	0x056c	/* Belkin's "old" vendor id */
401da177e4SLinus Torvalds #define BELKIN_OLD_PID	0x8007	/* Belkin's "old" single port serial converter's id */
411da177e4SLinus Torvalds 
421da177e4SLinus Torvalds #define PERACOM_VID	0x0565	/* Peracom's vendor id */
431da177e4SLinus Torvalds #define PERACOM_PID	0x0001	/* Peracom's single port serial converter's id */
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds #define GOHUBS_VID	0x0921	/* GoHubs vendor id */
461da177e4SLinus Torvalds #define GOHUBS_PID	0x1000	/* GoHubs single port serial converter's id (identical to the Peracom device) */
471da177e4SLinus Torvalds #define HANDYLINK_PID	0x1200	/* HandyLink USB's id (identical to the Peracom device) */
481da177e4SLinus Torvalds 
491da177e4SLinus Torvalds /* Vendor Request Interface */
501da177e4SLinus Torvalds #define BELKIN_SA_SET_BAUDRATE_REQUEST	0  /* Set baud rate */
511da177e4SLinus Torvalds #define BELKIN_SA_SET_STOP_BITS_REQUEST	1  /* Set stop bits (1,2) */
521da177e4SLinus Torvalds #define BELKIN_SA_SET_DATA_BITS_REQUEST	2  /* Set data bits (5,6,7,8) */
531da177e4SLinus Torvalds #define BELKIN_SA_SET_PARITY_REQUEST	3  /* Set parity (None, Even, Odd) */
541da177e4SLinus Torvalds 
551da177e4SLinus Torvalds #define BELKIN_SA_SET_DTR_REQUEST	10 /* Set DTR state */
561da177e4SLinus Torvalds #define BELKIN_SA_SET_RTS_REQUEST	11 /* Set RTS state */
571da177e4SLinus Torvalds #define BELKIN_SA_SET_BREAK_REQUEST	12 /* Set BREAK state */
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds #define BELKIN_SA_SET_FLOW_CTRL_REQUEST	16 /* Set flow control mode */
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds 
621da177e4SLinus Torvalds #ifdef WHEN_I_LEARN_THIS
631da177e4SLinus Torvalds #define BELKIN_SA_SET_MAGIC_REQUEST	17 /* I don't know, possibly flush */
641da177e4SLinus Torvalds 					   /* (always in Wininit sequence before flow control) */
651da177e4SLinus Torvalds #define BELKIN_SA_RESET			xx /* Reset the port */
661da177e4SLinus Torvalds #define BELKIN_SA_GET_MODEM_STATUS	xx /* Force return of modem status register */
671da177e4SLinus Torvalds #endif
681da177e4SLinus Torvalds 
691da177e4SLinus Torvalds #define BELKIN_SA_SET_REQUEST_TYPE	0x40
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds #define BELKIN_SA_BAUD(b)		(230400/b)
721da177e4SLinus Torvalds 
731da177e4SLinus Torvalds #define BELKIN_SA_STOP_BITS(b)		(b-1)
741da177e4SLinus Torvalds 
751da177e4SLinus Torvalds #define BELKIN_SA_DATA_BITS(b)		(b-5)
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds #define BELKIN_SA_PARITY_NONE		0
781da177e4SLinus Torvalds #define BELKIN_SA_PARITY_EVEN		1
791da177e4SLinus Torvalds #define BELKIN_SA_PARITY_ODD		2
801da177e4SLinus Torvalds #define BELKIN_SA_PARITY_MARK		3
811da177e4SLinus Torvalds #define BELKIN_SA_PARITY_SPACE		4
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds #define BELKIN_SA_FLOW_NONE		0x0000	/* No flow control */
841da177e4SLinus Torvalds #define BELKIN_SA_FLOW_OCTS		0x0001	/* use CTS input to throttle output */
851da177e4SLinus Torvalds #define BELKIN_SA_FLOW_ODSR		0x0002	/* use DSR input to throttle output */
861da177e4SLinus Torvalds #define BELKIN_SA_FLOW_IDSR		0x0004	/* use DSR input to enable receive */
871da177e4SLinus Torvalds #define BELKIN_SA_FLOW_IDTR		0x0008	/* use DTR output for input flow control */
881da177e4SLinus Torvalds #define BELKIN_SA_FLOW_IRTS		0x0010	/* use RTS output for input flow control */
891da177e4SLinus Torvalds #define BELKIN_SA_FLOW_ORTS		0x0020	/* use RTS to indicate data available to send */
901da177e4SLinus Torvalds #define BELKIN_SA_FLOW_ERRSUB		0x0040	/* ???? guess ???? substitute inline errors */
911da177e4SLinus Torvalds #define BELKIN_SA_FLOW_OXON		0x0080	/* use XON/XOFF for output flow control */
921da177e4SLinus Torvalds #define BELKIN_SA_FLOW_IXON		0x0100	/* use XON/XOFF for input flow control */
931da177e4SLinus Torvalds 
941da177e4SLinus Torvalds /*
951da177e4SLinus Torvalds  * It seems that the interrupt pipe is closely modelled after the
961da177e4SLinus Torvalds  * 16550 register layout.  This is probably because the adapter can
971da177e4SLinus Torvalds  * be used in a "DOS" environment to simulate a standard hardware port.
981da177e4SLinus Torvalds  */
991da177e4SLinus Torvalds #define BELKIN_SA_LSR_INDEX		2	/*     Line Status Register */
1001da177e4SLinus Torvalds #define BELKIN_SA_LSR_RDR		0x01	/* receive data ready */
1011da177e4SLinus Torvalds #define BELKIN_SA_LSR_OE		0x02	/* overrun error */
1021da177e4SLinus Torvalds #define BELKIN_SA_LSR_PE		0x04	/* parity error */
1031da177e4SLinus Torvalds #define BELKIN_SA_LSR_FE		0x08	/* framing error */
1041da177e4SLinus Torvalds #define BELKIN_SA_LSR_BI		0x10	/* break indicator */
105b69c1499SAlan Cox #define BELKIN_SA_LSR_THE		0x20	/* tx holding register empty */
1061da177e4SLinus Torvalds #define BELKIN_SA_LSR_TE		0x40	/* transmit register empty */
1071da177e4SLinus Torvalds #define BELKIN_SA_LSR_ERR		0x80	/* OE | PE | FE | BI */
1081da177e4SLinus Torvalds 
1091da177e4SLinus Torvalds #define BELKIN_SA_MSR_INDEX		3	/*     Modem Status Register */
1101da177e4SLinus Torvalds #define BELKIN_SA_MSR_DCTS		0x01	/* Delta CTS */
1111da177e4SLinus Torvalds #define BELKIN_SA_MSR_DDSR		0x02	/* Delta DSR */
1121da177e4SLinus Torvalds #define BELKIN_SA_MSR_DRI		0x04	/* Delta RI */
1131da177e4SLinus Torvalds #define BELKIN_SA_MSR_DCD		0x08	/* Delta CD */
1141da177e4SLinus Torvalds #define BELKIN_SA_MSR_CTS		0x10	/* Current CTS */
1151da177e4SLinus Torvalds #define BELKIN_SA_MSR_DSR		0x20	/* Current DSR */
1161da177e4SLinus Torvalds #define BELKIN_SA_MSR_RI		0x40	/* Current RI */
1171da177e4SLinus Torvalds #define BELKIN_SA_MSR_CD		0x80	/* Current CD */
1181da177e4SLinus Torvalds 
1191da177e4SLinus Torvalds #endif /* __LINUX_USB_SERIAL_BSA_H */
1201da177e4SLinus Torvalds 
121