File: /usr/src/linux/drivers/usb/serial/io_usbvend.h

1     /************************************************************************
2      *
3      *	USBVEND.H		Vendor-specific USB definitions
4      *
5      *	NOTE: This must be kept in sync with the Edgeport firmware and
6      *	must be kept backward-compatible with older firmware.
7      *
8      ************************************************************************
9      *
10      *	Copyright (c) 1998 Inside Out Networks, Inc.
11      *	This program is free software; you can redistribute it and/or modify
12      *	it under the terms of the GNU General Public License as published by
13      *	the Free Software Foundation; either version 2 of the License, or
14      *	(at your option) any later version.
15      *
16      ************************************************************************/
17     
18     #if !defined(_USBVEND_H)
19     #define	_USBVEND_H
20     
21     #ifndef __KERNEL__
22     #include "ionprag.h"	/* Extra I/O Networks pragmas */
23     
24     #include <usbdi.h>
25     
26     #include "iondef.h"	/* Standard I/O Networks definitions */
27     #endif
28     
29     /************************************************************************
30      *
31      *		D e f i n e s   /   T y p e d e f s
32      *
33      ************************************************************************/
34     
35     //
36     // Definitions of USB product IDs
37     // 
38     
39     #define	USB_VENDOR_ID_ION	0x1608		// Our VID
40     
41     //
42     // Definitions of USB product IDs (PID)
43     // We break the USB-defined PID into an OEM Id field (upper 6 bits)
44     // and a Device Id (bottom 10 bits). The Device Id defines what
45     // device this actually is regardless of what the OEM wants to
46     // call it.
47     //
48     
49     // ION-device OEM IDs
50     #define	ION_OEM_ID_ION		0		// 00h Inside Out Networks
51     #define	ION_OEM_ID_NLYNX	1		// 01h NLynx Systems	  
52     #define	ION_OEM_ID_GENERIC	2		// 02h Generic OEM
53     #define	ION_OEM_ID_MAC		3		// 03h Mac Version
54     #define	ION_OEM_ID_MEGAWOLF	4		// 04h Lupusb OEM Mac version (MegaWolf)
55     #define	ION_OEM_ID_MULTITECH	5		// 05h Multitech Rapidports
56     
57     	
58     // ION-device Device IDs
59     // Product IDs - assigned to match middle digit of serial number
60     
61     
62     // The ION_DEVICE_ID_GENERATION_2 bit (0x20) will be ORed into the existing edgeport
63     // PIDs to identify 80251+Netchip hardware.  This will guarantee that if a second
64     // generation edgeport device is plugged into a PC with an older (pre 2.0) driver,
65     // it will not enumerate.
66     
67     #define ION_DEVICE_ID_GENERATION_2	0x020	// This bit is set in the PID if this edgeport hardware
68     															// is based on the 80251+Netchip.  
69     
70     #define EDGEPORT_DEVICE_ID_MASK			0x3df	// Not including GEN_2 bit
71     
72     #define	ION_DEVICE_ID_UNCONFIGURED_EDGE_DEVICE	0x000	// In manufacturing only
73     #define ION_DEVICE_ID_EDGEPORT_4		0x001	// Edgeport/4 RS232
74     //	ION_DEVICE_ID_HUBPORT_7			0x002	// Hubport/7 (Placeholder, not used by software)
75     #define ION_DEVICE_ID_RAPIDPORT_4		0x003	// Rapidport/4
76     #define ION_DEVICE_ID_EDGEPORT_4T		0x004	// Edgeport/4 RS232 for Telxon (aka "Fleetport")
77     #define ION_DEVICE_ID_EDGEPORT_2		0x005	// Edgeport/2 RS232
78     #define ION_DEVICE_ID_EDGEPORT_4I		0x006	// Edgeport/4 RS422
79     #define ION_DEVICE_ID_EDGEPORT_2I		0x007	// Edgeport/2 RS422/RS485
80     //	ION_DEVICE_ID_HUBPORT_4			0x008	// Hubport/4 (Placeholder, not used by software)
81     //	ION_DEVICE_ID_EDGEPORT_8_HANDBUILT	0x009	// Hand-built Edgeport/8 (Placeholder, used in middle digit of serial number only!)
82     //	ION_DEVICE_ID_MULTIMODEM_4X56		0x00A	// MultiTech version of RP/4 (Placeholder, used in middle digit of serial number only!)
83     #define	ION_DEVICE_ID_EDGEPORT_PARALLEL_PORT	0x00B	// Edgeport/(4)21 Parallel port (USS720)
84     #define	ION_DEVICE_ID_EDGEPORT_421		0x00C	// Edgeport/421 Hub+RS232+Parallel
85     #define	ION_DEVICE_ID_EDGEPORT_21		0x00D	// Edgeport/21  RS232+Parallel
86     #define ION_DEVICE_ID_EDGEPORT_8_DUAL_CPU	0x00E	// Half of an Edgeport/8 (the kind with 2 EP/4s on 1 PCB)
87     #define ION_DEVICE_ID_EDGEPORT_8		0x00F	// Edgeport/8 (single-CPU)
88     #define ION_DEVICE_ID_EDGEPORT_2_DIN		0x010	// Edgeport/2 RS232 with Apple DIN connector
89     #define ION_DEVICE_ID_EDGEPORT_4_DIN		0x011	// Edgeport/4 RS232 with Apple DIN connector
90     #define ION_DEVICE_ID_EDGEPORT_16_DUAL_CPU	0x012	// Half of an Edgeport/16 (the kind with 2 EP/8s)
91     #define ION_DEVICE_ID_EDGEPORT_COMPATIBLE	0x013	// Edgeport Compatible, for NCR, Axiohm etc. testing
92     #define ION_DEVICE_ID_EDGEPORT_8I		0x014	// Edgeport/8 RS422 (single-CPU)
93     
94     // These IDs are used by the Edgeport.exe program for uninstalling.
95     // 
96     #define EDGEPORT_DEVICE_IDS	{0x001, 0x003, 0x004, 0x005, 0x006, 0x007, 0x00B, \
97     				 0x00C, 0x00D, 0x00E, 0x00F, 0x010, 0x011, 0x012, \
98     				 0x013, 0x014 }
99     
100     
101     #define	MAKE_USB_PRODUCT_ID( OemId, DeviceId )					\
102     			( (__u16) (((OemId) << 10) || (DeviceId)) )
103     
104     #define	DEVICE_ID_FROM_USB_PRODUCT_ID( ProductId )				\
105     			( (__u16) ((ProductId) & (EDGEPORT_DEVICE_ID_MASK)) )
106     
107     #define	OEM_ID_FROM_USB_PRODUCT_ID( ProductId )					\
108     			( (__u16) (((ProductId) >> 10) & 0x3F) )
109     
110     //
111     // Definitions of parameters for download code. Note that these are
112     // specific to a given version of download code and must change if the
113     // corresponding download code changes.
114     //
115     
116     // TxCredits value below which driver won't bother sending (to prevent too many small writes).
117     // Send only if above 25%
118     #define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit)	(max(((InitialCredit) / 4), EDGE_FW_BULK_MAX_PACKET_SIZE))
119     
120     #define	EDGE_FW_BULK_MAX_PACKET_SIZE		64	// Max Packet Size for Bulk In Endpoint (EP1)
121     #define EDGE_FW_BULK_READ_BUFFER_SIZE		1024	// Size to use for Bulk reads
122     
123     #define	EDGE_FW_INT_MAX_PACKET_SIZE		32	// Max Packet Size for Interrupt In Endpoint
124     							// Note that many units were shipped with MPS=16, we
125     							// force an upgrade to this value).
126     #define EDGE_FW_INT_INTERVAL			2	// 2ms polling on IntPipe
127     
128     
129     //
130     // Definitions of I/O Networks vendor-specific requests
131     // for default endpoint
132     //
133     //	bmRequestType = 00100000	Set vendor-specific, to device
134     //	bmRequestType = 10100000	Get vendor-specific, to device
135     //
136     // These are the definitions for the bRequest field for the
137     // above bmRequestTypes.
138     //
139     // For the read/write Edgeport memory commands, the parameters
140     // are as follows:
141     //		wValue = 16-bit address
142     //		wIndex = unused (though we could put segment 00: or FF: here)
143     //		wLength = # bytes to read/write (max 64)
144     //							
145     
146     #define USB_REQUEST_ION_RESET_DEVICE	0	// Warm reboot Edgeport, retaining USB address
147     #define USB_REQUEST_ION_GET_EPIC_DESC	1	// Get Edgeport Compatibility Descriptor
148     // unused				2	// Unused, available
149     #define USB_REQUEST_ION_READ_RAM	3	// Read  EdgePort RAM at specified addr
150     #define USB_REQUEST_ION_WRITE_RAM	4	// Write EdgePort RAM at specified addr
151     #define USB_REQUEST_ION_READ_ROM	5	// Read  EdgePort ROM at specified addr
152     #define USB_REQUEST_ION_WRITE_ROM	6	// Write EdgePort ROM at specified addr
153     #define USB_REQUEST_ION_EXEC_DL_CODE	7	// Begin execution of RAM-based download
154     						// code by jumping to address in wIndex:wValue
155     //					8	// Unused, available
156     #define USB_REQUEST_ION_ENABLE_SUSPEND	9	// Enable/Disable suspend feature
157     						// (wValue != 0: Enable; wValue = 0: Disable)
158     
159     
160     //
161     // Define parameter values for our vendor-specific commands
162     //
163     
164     
165     // Values for iDownloadFile
166     #define	EDGE_DOWNLOAD_FILE_NONE		0	// No download requested
167     #define	EDGE_DOWNLOAD_FILE_INTERNAL	0xFF	// Download the file compiled into driver (930 version)
168     #define	EDGE_DOWNLOAD_FILE_I930		0xFF	// Download the file compiled into driver (930 version)
169     #define	EDGE_DOWNLOAD_FILE_80251	0xFE	// Download the file compiled into driver (80251 version)
170     
171     
172     
173     /*
174      *	Special addresses for READ/WRITE_RAM/ROM
175      */
176     
177     // Version 1 (original) format of DeviceParams
178     #define	EDGE_MANUF_DESC_ADDR_V1		0x00FF7F00
179     #define	EDGE_MANUF_DESC_LEN_V1		sizeof(EDGE_MANUF_DESCRIPTOR_V1)
180     
181     // Version 2 format of DeviceParams. This format is longer (3C0h)
182     // and starts lower in memory, at the uppermost 1K in ROM.
183     #define	EDGE_MANUF_DESC_ADDR		0x00FF7C00
184     #define	EDGE_MANUF_DESC_LEN		sizeof(EDGE_MANUF_DESCRIPTOR)
185     
186     // Boot params descriptor
187     #define	EDGE_BOOT_DESC_ADDR		0x00FF7FC0
188     #define	EDGE_BOOT_DESC_LEN		sizeof(EDGE_BOOT_DESCRIPTOR)
189     
190     // Define the max block size that may be read or written
191     // in a read/write RAM/ROM command.
192     #define	MAX_SIZE_REQ_ION_READ_MEM	( (__u16) 64 )
193     #define	MAX_SIZE_REQ_ION_WRITE_MEM	( (__u16) 64 )
194     
195     
196     //
197     // Notes for the following two ION vendor-specific param descriptors:
198     //
199     //	1.	These have a standard USB descriptor header so they look like a
200     //		normal descriptor.
201     //	2.	Any strings in the structures are in USB-defined string
202     //		descriptor format, so that they may be separately retrieved,
203     //		if necessary, with a minimum of work on the 930. This also
204     //		requires them to be in UNICODE format, which, for English at
205     //		least, simply means extending each UCHAR into a USHORT.
206     //	3.	For all fields, 00 means 'uninitialized'.
207     //	4.	All unused areas should be set to 00 for future expansion.
208     //
209     
210     // This structure is ver 2 format. It contains ALL USB descriptors as
211     // well as the configuration parameters that were in the original V1
212     // structure. It is NOT modified when new boot code is downloaded; rather,
213     // these values are set or modified by manufacturing. It is located at
214     // xC00-xFBF (length 3C0h) in the ROM.
215     // This structure is a superset of the v1 structure and is arranged so
216     // that all of the v1 fields remain at the same address. We are just
217     // adding more room to the front of the structure to hold the descriptors.
218     //
219     // The actual contents of this structure are defined in a 930 assembly
220     // file, converted to a binary image, and then written by the serialization
221     // program. The C definition of this structure just defines a dummy
222     // area for general USB descriptors and the descriptor tables (the root
223     // descriptor starts at xC00). At the bottom of the structure are the
224     // fields inherited from the v1 structure.
225     
226     #define MAX_SERIALNUMBER_LEN	12
227     #define MAX_ASSEMBLYNUMBER_LEN	14
228     
229     typedef struct _EDGE_MANUF_DESCRIPTOR {
230     
231     	__u16	RootDescTable[0x10];			// C00 Root of descriptor tables (just a placeholder)
232     	__u8	DescriptorArea[0x2E0];			// C20 Descriptors go here, up to 2E0h (just a placeholder)
233     
234     							//     Start of v1-compatible section
235     	__u8	Length;					// F00 Desc length for what follows, per USB (= C0h )
236     	__u8	DescType;				// F01 Desc type, per USB (=DEVICE type)
237     	__u8	DescVer;				// F02 Desc version/format (currently 2)
238     	__u8	NumRootDescEntries;			// F03 # entries in RootDescTable
239     
240     	__u8	RomSize;				// F04 Size of ROM/E2PROM in K
241     	__u8	RamSize;				// F05 Size of external RAM in K
242     	__u8	CpuRev;					// F06 CPU revision level (chg only if s/w visible)
243     	__u8	BoardRev;				// F07 PCB revision level (chg only if s/w visible)
244     
245     	__u8	NumPorts;				// F08 Number of ports
246     	__u8	DescDate[3];				// F09 MM/DD/YY when descriptor template was compiler,
247     							//	   so host can track changes to USB-only descriptors.
248     
249     	__u8	SerNumLength;				// F0C USB string descriptor len
250     	__u8	SerNumDescType;				// F0D USB descriptor type (=STRING type)
251     	__u16	SerialNumber[MAX_SERIALNUMBER_LEN];	// F0E "01-01-000100" Unicode Serial Number
252     
253     	__u8	AssemblyNumLength;			// F26 USB string descriptor len
254     	__u8	AssemblyNumDescType;			// F27 USB descriptor type (=STRING type)
255     	__u16	AssemblyNumber[MAX_ASSEMBLYNUMBER_LEN];	// F28 "350-1000-01-A " assembly number
256     
257     	__u8	OemAssyNumLength;			// F44 USB string descriptor len
258     	__u8	OemAssyNumDescType;			// F45 USB descriptor type (=STRING type)
259     	__u16	OemAssyNumber[MAX_ASSEMBLYNUMBER_LEN];	// F46 "xxxxxxxxxxxxxx" OEM assembly number
260     
261     	__u8	ManufDateLength;			// F62 USB string descriptor len
262     	__u8	ManufDateDescType;			// F63 USB descriptor type (=STRING type)
263     	__u16	ManufDate[6];				// F64 "MMDDYY" manufacturing date
264     
265     	__u8	Reserved3[0x4D];			// F70 -- unused, set to 0 --
266     
267     	__u8	UartType;				// FBD Uart Type
268     	__u8	IonPid;					// FBE Product ID, == LSB of USB DevDesc.PID
269     							//     (Note: Edgeport/4s before 11/98 will have
270     							//		00 here instead of 01)
271     	__u8	IonConfig;				// FBF Config byte for ION manufacturing use
272     							// FBF end of structure, total len = 3C0h
273     
274     } EDGE_MANUF_DESCRIPTOR, *PEDGE_MANUF_DESCRIPTOR;
275     
276     
277     #define MANUF_DESC_VER_1	1	// Original definition of MANUF_DESC
278     #define MANUF_DESC_VER_2	2	// Ver 2, starts at xC00h len 3C0h
279     
280     
281     // Uart Types
282     // Note: Since this field was added only recently, all Edgeport/4 units
283     // shipped before 11/98 will have 00 in this field. Therefore,
284     // both 00 and 01 values mean '654.
285     #define MANUF_UART_EXAR_654_EARLY	0	// Exar 16C654 in Edgeport/4s before 11/98
286     #define MANUF_UART_EXAR_654		1	// Exar 16C654
287     #define MANUF_UART_EXAR_2852		2	// Exar 16C2852 
288     
289     //
290     // Note: The CpuRev and BoardRev values do not conform to manufacturing
291     // revisions; they are to be incremented only when the CPU or hardware
292     // changes in a software-visible way, such that the 930 software or
293     // the host driver needs to handle the hardware differently.
294     //
295     
296     // Values of bottom 5 bits of CpuRev & BoardRev for
297     // Implementation 0 (ie, 930-based)
298     #define	MANUF_CPU_REV_AD4		1	// 930 AD4, with EP1 Rx bug (needs RXSPM)
299     #define	MANUF_CPU_REV_AD5		2	// 930 AD5, with above bug (supposedly) fixed
300     #define	MANUF_CPU_80251			0x20	// Intel 80251
301     
302     
303     #define MANUF_BOARD_REV_A		1	// Original version, == Manuf Rev A
304     #define MANUF_BOARD_REV_B		2	// Manuf Rev B, wakeup interrupt works
305     #define MANUF_BOARD_REV_C		3	// Manuf Rev C, 2/4 ports, rs232/rs422
306     #define MANUF_BOARD_REV_GENERATION_2	0x20	// Second generaiton edgeport
307     
308     
309     
310     
311     // Values of bottom 5 bits of CpuRev & BoardRev for
312     // Implementation 1 (ie, 251+Netchip-based)
313     #define	MANUF_CPU_REV_1			1	// C251TB Rev 1 (Need actual Intel rev here)
314     
315     #define MANUF_BOARD_REV_A		1	// First rev of 251+Netchip design
316     
317     
318     
319     #define	MANUF_SERNUM_LENGTH		sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->SerialNumber)
320     #define	MANUF_ASSYNUM_LENGTH		sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->AssemblyNumber)
321     #define	MANUF_OEMASSYNUM_LENGTH		sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->OemAssyNumber)
322     #define	MANUF_MANUFDATE_LENGTH		sizeof(((PEDGE_MANUF_DESCRIPTOR)0)->ManufDate)
323     
324     #define	MANUF_ION_CONFIG_MASTER		0x80	// 1=Master mode, 0=Normal
325     #define	MANUF_ION_CONFIG_DIAG		0x40	// 1=Run h/w diags, 0=norm
326     #define	MANUF_ION_CONFIG_DIAG_NO_LOOP	0x20	// As above but no ext loopback test
327     
328     
329     //
330     // This structure describes parameters for the boot code, and
331     // is programmed along with new boot code. These are values
332     // which are specific to a given build of the boot code. It
333     // is exactly 64 bytes long and is fixed at address FF:xFC0
334     // - FF:xFFF. Note that the 930-mandated UCONFIG bytes are
335     // included in this structure.
336     //
337     typedef struct _EDGE_BOOT_DESCRIPTOR {
338     	__u8		Length;			// C0 Desc length, per USB (= 40h)
339     	__u8		DescType;		// C1 Desc type, per USB (= DEVICE type)
340     	__u8		DescVer;		// C2 Desc version/format
341     	__u8		Reserved1;		// C3 -- unused, set to 0 --
342     
343     	__u16		BootCodeLength;		// C4 Boot code goes from FF:0000 to FF:(len-1)
344     						//	  (LE format)
345     
346     	__u8		MajorVersion;		// C6 Firmware version: xx.
347     	__u8		MinorVersion;		// C7			yy.
348     	__u16		BuildNumber;		// C8			zzzz (LE format)
349     	
350     	__u16		EnumRootDescTable;	// CA Root of ROM-based descriptor table
351     	__u8		NumDescTypes;		// CC Number of supported descriptor types
352     
353     	__u8		Reserved4;		// CD Fix Compiler Packing
354     
355     	__u16		Capabilities;		// CE-CF Capabilities flags (LE format)
356     	__u8		Reserved2[0x28];	// D0 -- unused, set to 0 --
357     	__u8		UConfig0;		// F8 930-defined CPU configuration byte 0
358     	__u8		UConfig1;		// F9 930-defined CPU configuration byte 1
359     	__u8		Reserved3[6];		// FA -- unused, set to 0 --
360     						// FF end of structure, total len = 80
361     
362     } EDGE_BOOT_DESCRIPTOR, *PEDGE_BOOT_DESCRIPTOR;
363     
364     
365     #define BOOT_DESC_VER_1		1	// Original definition of BOOT_PARAMS
366     #define BOOT_DESC_VER_2		2	// 2nd definition, descriptors not included in boot
367     
368     
369     	// Capabilities flags
370     
371     #define	BOOT_CAP_RESET_CMD	0x0001	// If set, boot correctly supports ION_RESET_DEVICE
372     
373     #endif	// if !defined()
374     
375