ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / 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 #define ION_DEVICE_ID_MT4X56USB                 0x1403  // OEM device
94
95 // BlackBox OEM devices
96 #define ION_DEVICE_ID_BB_EDGEPORT_4             0x001   // Edgeport/4 RS232
97 #define ION_DEVICE_ID_BB_EDGEPORT_4T            0x004   // Edgeport/4 RS232 for Telxon (aka "Fleetport")
98 #define ION_DEVICE_ID_BB_EDGEPORT_2             0x005   // Edgeport/2 RS232
99 #define ION_DEVICE_ID_BB_EDGEPORT_4I            0x006   // Edgeport/4 RS422
100 #define ION_DEVICE_ID_BB_EDGEPORT_2I            0x007   // Edgeport/2 RS422/RS485
101 #define ION_DEVICE_ID_BB_EDGEPORT_421           0x00C   // Edgeport/421 Hub+RS232+Parallel
102 #define ION_DEVICE_ID_BB_EDGEPORT_21            0x00D   // Edgeport/21  RS232+Parallel
103 #define ION_DEVICE_ID_BB_EDGEPORT_8_DUAL_CPU    0x00E   // Half of an Edgeport/8 (the kind with 2 EP/4s on 1 PCB)
104 #define ION_DEVICE_ID_BB_EDGEPORT_8             0x00F   // Edgeport/8 (single-CPU)
105 #define ION_DEVICE_ID_BB_EDGEPORT_2_DIN         0x010   // Edgeport/2 RS232 with Apple DIN connector
106 #define ION_DEVICE_ID_BB_EDGEPORT_4_DIN         0x011   // Edgeport/4 RS232 with Apple DIN connector
107 #define ION_DEVICE_ID_BB_EDGEPORT_16_DUAL_CPU   0x012   // Half of an Edgeport/16 (the kind with 2 EP/8s)
108 #define ION_DEVICE_ID_BB_EDGEPORT_8I            0x014   // Edgeport/8 RS422 (single-CPU)
109
110
111 /* Edgeport TI based devices */
112 #define ION_DEVICE_ID_TI_EDGEPORT_4             0x0201  /* Edgeport/4 RS232 */
113 #define ION_DEVICE_ID_TI_EDGEPORT_2             0x0205  /* Edgeport/2 RS232 */
114 #define ION_DEVICE_ID_TI_EDGEPORT_4I            0x0206  /* Edgeport/4i RS422 */
115 #define ION_DEVICE_ID_TI_EDGEPORT_2I            0x0207  /* Edgeport/2i RS422/RS485 */
116 #define ION_DEVICE_ID_TI_EDGEPORT_421           0x020C  /* Edgeport/421 4 hub 2 RS232 + Parallel (lucent on a different hub port) */
117 #define ION_DEVICE_ID_TI_EDGEPORT_21            0x020D  /* Edgeport/21 2 RS232 + Parallel (lucent on a different hub port) */
118 #define ION_DEVICE_ID_TI_EDGEPORT_1             0x0215  /* Edgeport/1 RS232 */
119 #define ION_DEVICE_ID_TI_EDGEPORT_42            0x0217  /* Edgeport/42 4 hub 2 RS232 */
120 #define ION_DEVICE_ID_TI_EDGEPORT_22            0x021A  /* Edgeport/22  Edgeport/22I is an Edgeport/4 with ports 1&2 RS422 and ports 3&4 RS232 */
121 #define ION_DEVICE_ID_TI_EDGEPORT_2C            0x021B  /* Edgeport/2c RS232 */
122
123 #define ION_DEVICE_ID_TI_EDGEPORT_421_BOOT      0x0240  /* Edgeport/421 in boot mode */
124 #define ION_DEVICE_ID_TI_EDGEPORT_421_DOWN      0x0241  /* Edgeport/421 in download mode first interface is 2 RS232 (Note that the second interface of this multi interface device should be a standard USB class 7 printer port) */
125 #define ION_DEVICE_ID_TI_EDGEPORT_21_BOOT       0x0242  /* Edgeport/21 in boot mode */
126 #define ION_DEVICE_ID_TI_EDGEPORT_21_DOWN       0x0243  /*Edgeport/42 in download mode: first interface is 2 RS232 (Note that the second interface of this multi interface device should be a standard USB class 7 printer port) */
127
128
129 #define MAKE_USB_PRODUCT_ID( OemId, DeviceId )                                  \
130                         ( (__u16) (((OemId) << 10) || (DeviceId)) )
131
132 #define DEVICE_ID_FROM_USB_PRODUCT_ID( ProductId )                              \
133                         ( (__u16) ((ProductId) & (EDGEPORT_DEVICE_ID_MASK)) )
134
135 #define OEM_ID_FROM_USB_PRODUCT_ID( ProductId )                                 \
136                         ( (__u16) (((ProductId) >> 10) & 0x3F) )
137
138 //
139 // Definitions of parameters for download code. Note that these are
140 // specific to a given version of download code and must change if the
141 // corresponding download code changes.
142 //
143
144 // TxCredits value below which driver won't bother sending (to prevent too many small writes).
145 // Send only if above 25%
146 #define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit)    (max(((InitialCredit) / 4), EDGE_FW_BULK_MAX_PACKET_SIZE))
147
148 #define EDGE_FW_BULK_MAX_PACKET_SIZE            64      // Max Packet Size for Bulk In Endpoint (EP1)
149 #define EDGE_FW_BULK_READ_BUFFER_SIZE           1024    // Size to use for Bulk reads
150
151 #define EDGE_FW_INT_MAX_PACKET_SIZE             32      // Max Packet Size for Interrupt In Endpoint
152                                                         // Note that many units were shipped with MPS=16, we
153                                                         // force an upgrade to this value).
154 #define EDGE_FW_INT_INTERVAL                    2       // 2ms polling on IntPipe
155
156
157 //
158 // Definitions of I/O Networks vendor-specific requests
159 // for default endpoint
160 //
161 //      bmRequestType = 00100000        Set vendor-specific, to device
162 //      bmRequestType = 10100000        Get vendor-specific, to device
163 //
164 // These are the definitions for the bRequest field for the
165 // above bmRequestTypes.
166 //
167 // For the read/write Edgeport memory commands, the parameters
168 // are as follows:
169 //              wValue = 16-bit address
170 //              wIndex = unused (though we could put segment 00: or FF: here)
171 //              wLength = # bytes to read/write (max 64)
172 //                                                      
173
174 #define USB_REQUEST_ION_RESET_DEVICE    0       // Warm reboot Edgeport, retaining USB address
175 #define USB_REQUEST_ION_GET_EPIC_DESC   1       // Get Edgeport Compatibility Descriptor
176 // unused                               2       // Unused, available
177 #define USB_REQUEST_ION_READ_RAM        3       // Read  EdgePort RAM at specified addr
178 #define USB_REQUEST_ION_WRITE_RAM       4       // Write EdgePort RAM at specified addr
179 #define USB_REQUEST_ION_READ_ROM        5       // Read  EdgePort ROM at specified addr
180 #define USB_REQUEST_ION_WRITE_ROM       6       // Write EdgePort ROM at specified addr
181 #define USB_REQUEST_ION_EXEC_DL_CODE    7       // Begin execution of RAM-based download
182                                                 // code by jumping to address in wIndex:wValue
183 //                                      8       // Unused, available
184 #define USB_REQUEST_ION_ENABLE_SUSPEND  9       // Enable/Disable suspend feature
185                                                 // (wValue != 0: Enable; wValue = 0: Disable)
186
187
188 //
189 // Define parameter values for our vendor-specific commands
190 //
191
192
193 // Values for iDownloadFile
194 #define EDGE_DOWNLOAD_FILE_NONE         0       // No download requested
195 #define EDGE_DOWNLOAD_FILE_INTERNAL     0xFF    // Download the file compiled into driver (930 version)
196 #define EDGE_DOWNLOAD_FILE_I930         0xFF    // Download the file compiled into driver (930 version)
197 #define EDGE_DOWNLOAD_FILE_80251        0xFE    // Download the file compiled into driver (80251 version)
198
199
200
201 /*
202  *      Special addresses for READ/WRITE_RAM/ROM
203  */
204
205 // Version 1 (original) format of DeviceParams
206 #define EDGE_MANUF_DESC_ADDR_V1         0x00FF7F00
207 #define EDGE_MANUF_DESC_LEN_V1          sizeof(EDGE_MANUF_DESCRIPTOR_V1)
208
209 // Version 2 format of DeviceParams. This format is longer (3C0h)
210 // and starts lower in memory, at the uppermost 1K in ROM.
211 #define EDGE_MANUF_DESC_ADDR            0x00FF7C00
212 #define EDGE_MANUF_DESC_LEN             sizeof(struct edge_manuf_descriptor)
213
214 // Boot params descriptor
215 #define EDGE_BOOT_DESC_ADDR             0x00FF7FC0
216 #define EDGE_BOOT_DESC_LEN              sizeof(struct edge_boot_descriptor)
217
218 // Define the max block size that may be read or written
219 // in a read/write RAM/ROM command.
220 #define MAX_SIZE_REQ_ION_READ_MEM       ( (__u16) 64 )
221 #define MAX_SIZE_REQ_ION_WRITE_MEM      ( (__u16) 64 )
222
223
224 //
225 // Notes for the following two ION vendor-specific param descriptors:
226 //
227 //      1.      These have a standard USB descriptor header so they look like a
228 //              normal descriptor.
229 //      2.      Any strings in the structures are in USB-defined string
230 //              descriptor format, so that they may be separately retrieved,
231 //              if necessary, with a minimum of work on the 930. This also
232 //              requires them to be in UNICODE format, which, for English at
233 //              least, simply means extending each __u8 into a __u16.
234 //      3.      For all fields, 00 means 'uninitialized'.
235 //      4.      All unused areas should be set to 00 for future expansion.
236 //
237
238 // This structure is ver 2 format. It contains ALL USB descriptors as
239 // well as the configuration parameters that were in the original V1
240 // structure. It is NOT modified when new boot code is downloaded; rather,
241 // these values are set or modified by manufacturing. It is located at
242 // xC00-xFBF (length 3C0h) in the ROM.
243 // This structure is a superset of the v1 structure and is arranged so
244 // that all of the v1 fields remain at the same address. We are just
245 // adding more room to the front of the structure to hold the descriptors.
246 //
247 // The actual contents of this structure are defined in a 930 assembly
248 // file, converted to a binary image, and then written by the serialization
249 // program. The C definition of this structure just defines a dummy
250 // area for general USB descriptors and the descriptor tables (the root
251 // descriptor starts at xC00). At the bottom of the structure are the
252 // fields inherited from the v1 structure.
253
254 #define MAX_SERIALNUMBER_LEN    12
255 #define MAX_ASSEMBLYNUMBER_LEN  14
256
257 struct edge_manuf_descriptor {
258
259         __u16   RootDescTable[0x10];                    // C00 Root of descriptor tables (just a placeholder)
260         __u8    DescriptorArea[0x2E0];                  // C20 Descriptors go here, up to 2E0h (just a placeholder)
261
262                                                         //     Start of v1-compatible section
263         __u8    Length;                                 // F00 Desc length for what follows, per USB (= C0h )
264         __u8    DescType;                               // F01 Desc type, per USB (=DEVICE type)
265         __u8    DescVer;                                // F02 Desc version/format (currently 2)
266         __u8    NumRootDescEntries;                     // F03 # entries in RootDescTable
267
268         __u8    RomSize;                                // F04 Size of ROM/E2PROM in K
269         __u8    RamSize;                                // F05 Size of external RAM in K
270         __u8    CpuRev;                                 // F06 CPU revision level (chg only if s/w visible)
271         __u8    BoardRev;                               // F07 PCB revision level (chg only if s/w visible)
272
273         __u8    NumPorts;                               // F08 Number of ports
274         __u8    DescDate[3];                            // F09 MM/DD/YY when descriptor template was compiler,
275                                                         //         so host can track changes to USB-only descriptors.
276
277         __u8    SerNumLength;                           // F0C USB string descriptor len
278         __u8    SerNumDescType;                         // F0D USB descriptor type (=STRING type)
279         __u16   SerialNumber[MAX_SERIALNUMBER_LEN];     // F0E "01-01-000100" Unicode Serial Number
280
281         __u8    AssemblyNumLength;                      // F26 USB string descriptor len
282         __u8    AssemblyNumDescType;                    // F27 USB descriptor type (=STRING type)
283         __u16   AssemblyNumber[MAX_ASSEMBLYNUMBER_LEN]; // F28 "350-1000-01-A " assembly number
284
285         __u8    OemAssyNumLength;                       // F44 USB string descriptor len
286         __u8    OemAssyNumDescType;                     // F45 USB descriptor type (=STRING type)
287         __u16   OemAssyNumber[MAX_ASSEMBLYNUMBER_LEN];  // F46 "xxxxxxxxxxxxxx" OEM assembly number
288
289         __u8    ManufDateLength;                        // F62 USB string descriptor len
290         __u8    ManufDateDescType;                      // F63 USB descriptor type (=STRING type)
291         __u16   ManufDate[6];                           // F64 "MMDDYY" manufacturing date
292
293         __u8    Reserved3[0x4D];                        // F70 -- unused, set to 0 --
294
295         __u8    UartType;                               // FBD Uart Type
296         __u8    IonPid;                                 // FBE Product ID, == LSB of USB DevDesc.PID
297                                                         //     (Note: Edgeport/4s before 11/98 will have
298                                                         //              00 here instead of 01)
299         __u8    IonConfig;                              // FBF Config byte for ION manufacturing use
300                                                         // FBF end of structure, total len = 3C0h
301
302 };
303
304
305 #define MANUF_DESC_VER_1        1       // Original definition of MANUF_DESC
306 #define MANUF_DESC_VER_2        2       // Ver 2, starts at xC00h len 3C0h
307
308
309 // Uart Types
310 // Note: Since this field was added only recently, all Edgeport/4 units
311 // shipped before 11/98 will have 00 in this field. Therefore,
312 // both 00 and 01 values mean '654.
313 #define MANUF_UART_EXAR_654_EARLY       0       // Exar 16C654 in Edgeport/4s before 11/98
314 #define MANUF_UART_EXAR_654             1       // Exar 16C654
315 #define MANUF_UART_EXAR_2852            2       // Exar 16C2852 
316
317 //
318 // Note: The CpuRev and BoardRev values do not conform to manufacturing
319 // revisions; they are to be incremented only when the CPU or hardware
320 // changes in a software-visible way, such that the 930 software or
321 // the host driver needs to handle the hardware differently.
322 //
323
324 // Values of bottom 5 bits of CpuRev & BoardRev for
325 // Implementation 0 (ie, 930-based)
326 #define MANUF_CPU_REV_AD4               1       // 930 AD4, with EP1 Rx bug (needs RXSPM)
327 #define MANUF_CPU_REV_AD5               2       // 930 AD5, with above bug (supposedly) fixed
328 #define MANUF_CPU_80251                 0x20    // Intel 80251
329
330
331 #define MANUF_BOARD_REV_A               1       // Original version, == Manuf Rev A
332 #define MANUF_BOARD_REV_B               2       // Manuf Rev B, wakeup interrupt works
333 #define MANUF_BOARD_REV_C               3       // Manuf Rev C, 2/4 ports, rs232/rs422
334 #define MANUF_BOARD_REV_GENERATION_2    0x20    // Second generaiton edgeport
335
336
337
338
339 // Values of bottom 5 bits of CpuRev & BoardRev for
340 // Implementation 1 (ie, 251+Netchip-based)
341 #define MANUF_CPU_REV_1                 1       // C251TB Rev 1 (Need actual Intel rev here)
342
343 #define MANUF_BOARD_REV_A               1       // First rev of 251+Netchip design
344
345
346
347 #define MANUF_SERNUM_LENGTH             sizeof(((struct edge_manuf_descriptor *)0)->SerialNumber)
348 #define MANUF_ASSYNUM_LENGTH            sizeof(((struct edge_manuf_descriptor *)0)->AssemblyNumber)
349 #define MANUF_OEMASSYNUM_LENGTH         sizeof(((struct edge_manuf_descriptor *)0)->OemAssyNumber)
350 #define MANUF_MANUFDATE_LENGTH          sizeof(((struct edge_manuf_descriptor *)0)->ManufDate)
351
352 #define MANUF_ION_CONFIG_MASTER         0x80    // 1=Master mode, 0=Normal
353 #define MANUF_ION_CONFIG_DIAG           0x40    // 1=Run h/w diags, 0=norm
354 #define MANUF_ION_CONFIG_DIAG_NO_LOOP   0x20    // As above but no ext loopback test
355
356
357 //
358 // This structure describes parameters for the boot code, and
359 // is programmed along with new boot code. These are values
360 // which are specific to a given build of the boot code. It
361 // is exactly 64 bytes long and is fixed at address FF:xFC0
362 // - FF:xFFF. Note that the 930-mandated UCONFIG bytes are
363 // included in this structure.
364 //
365 struct edge_boot_descriptor {
366         __u8            Length;                 // C0 Desc length, per USB (= 40h)
367         __u8            DescType;               // C1 Desc type, per USB (= DEVICE type)
368         __u8            DescVer;                // C2 Desc version/format
369         __u8            Reserved1;              // C3 -- unused, set to 0 --
370
371         __u16           BootCodeLength;         // C4 Boot code goes from FF:0000 to FF:(len-1)
372                                                 //        (LE format)
373
374         __u8            MajorVersion;           // C6 Firmware version: xx.
375         __u8            MinorVersion;           // C7                   yy.
376         __u16           BuildNumber;            // C8                   zzzz (LE format)
377         
378         __u16           EnumRootDescTable;      // CA Root of ROM-based descriptor table
379         __u8            NumDescTypes;           // CC Number of supported descriptor types
380
381         __u8            Reserved4;              // CD Fix Compiler Packing
382
383         __u16           Capabilities;           // CE-CF Capabilities flags (LE format)
384         __u8            Reserved2[0x28];        // D0 -- unused, set to 0 --
385         __u8            UConfig0;               // F8 930-defined CPU configuration byte 0
386         __u8            UConfig1;               // F9 930-defined CPU configuration byte 1
387         __u8            Reserved3[6];           // FA -- unused, set to 0 --
388                                                 // FF end of structure, total len = 80
389 };
390
391
392 #define BOOT_DESC_VER_1         1       // Original definition of BOOT_PARAMS
393 #define BOOT_DESC_VER_2         2       // 2nd definition, descriptors not included in boot
394
395
396         // Capabilities flags
397
398 #define BOOT_CAP_RESET_CMD      0x0001  // If set, boot correctly supports ION_RESET_DEVICE
399
400
401
402 /************************************************************************
403                  T I   U M P   D E F I N I T I O N S
404  ***********************************************************************/
405
406 //************************************************************************
407 //      TI I2C Format Definitions
408 //************************************************************************
409 #define I2C_DESC_TYPE_INFO_BASIC        1
410 #define I2C_DESC_TYPE_FIRMWARE_BASIC    2
411 #define I2C_DESC_TYPE_DEVICE            3
412 #define I2C_DESC_TYPE_CONFIG            4
413 #define I2C_DESC_TYPE_STRING            5
414 #define I2C_DESC_TYPE_FIRMWARE_BLANK    0xf2
415
416 #define I2C_DESC_TYPE_MAX               5
417 // 3410 may define types 6, 7 for other firmware downloads
418
419 // Special section defined by ION
420 #define I2C_DESC_TYPE_ION               0       // Not defined by TI
421
422
423 struct ti_i2c_desc
424 {
425         __u8    Type;                   // Type of descriptor
426         __u16   Size;                   // Size of data only not including header
427         __u8    CheckSum;               // Checksum (8 bit sum of data only)
428         __u8    Data[0];                // Data starts here
429 }__attribute__((packed));
430
431 struct ti_i2c_firmware_rec 
432 {
433         __u8    Ver_Major;              // Firmware Major version number
434         __u8    Ver_Minor;              // Firmware Minor version number
435         __u8    Data[0];                // Download starts here
436 }__attribute__((packed));
437
438
439 // Structure of header of download image in fw_down.h
440 struct ti_i2c_image_header
441 {
442         __u16   Length;
443         __u8    CheckSum;
444 }__attribute__((packed));
445
446 struct ti_basic_descriptor
447 {
448         __u8    Power;          // Self powered
449                                 // bit 7: 1 - power switching supported
450                                 //        0 - power switching not supported
451                                 //
452                                 // bit 0: 1 - self powered
453                                 //        0 - bus powered
454                                 //
455                                 //
456         __u16   HubVid;         // VID HUB
457         __u16   HubPid;         // PID HUB
458         __u16   DevPid;         // PID Edgeport
459         __u8    HubTime;        // Time for power on to power good
460         __u8    HubCurrent;     // HUB Current = 100ma
461 } __attribute__((packed));
462
463
464 #define TI_GET_CPU_REVISION(x)          (__u8)((((x)>>4)&0x0f))
465 #define TI_GET_BOARD_REVISION(x)        (__u8)(((x)&0x0f))
466
467 #define TI_I2C_SIZE_MASK                0x1f  // 5 bits
468 #define TI_GET_I2C_SIZE(x)              ((((x) & TI_I2C_SIZE_MASK)+1)*256)
469
470 #define TI_MAX_I2C_SIZE                 ( 16 * 1024 )
471
472 /* TI USB 5052 definitions */
473 struct edge_ti_manuf_descriptor
474 {
475         __u8 IonConfig;         //  Config byte for ION manufacturing use
476         __u8 IonConfig2;        //  Expansion
477         __u8 Version;           //  Verqsion
478         __u8 CpuRev_BoardRev;   //  CPU revision level (0xF0) and Board Rev Level (0x0F)
479         __u8 NumPorts;          //  Number of ports     for this UMP
480         __u8 NumVirtualPorts;   //  Number of Virtual ports
481         __u8 HubConfig1;        //  Used to configure the Hub
482         __u8 HubConfig2;        //  Used to configure the Hub
483         __u8 TotalPorts;        //  Total Number of Com Ports for the entire device (All UMPs)
484         __u8 Reserved;
485 }__attribute__((packed));
486
487
488 #endif          // if !defined()