linux/drivers/usb/serial/io_usbvend.h

/* SPDX-License-Identifier: GPL-2.0+ */
/************************************************************************
 *
 *	USBVEND.H		Vendor-specific USB definitions
 *
 *	NOTE: This must be kept in sync with the Edgeport firmware and
 *	must be kept backward-compatible with older firmware.
 *
 ************************************************************************
 *
 *	Copyright (C) 1998 Inside Out Networks, Inc.
 *
 ************************************************************************/

#if !defined(_USBVEND_H)
#define _USBVEND_H

/************************************************************************
 *
 *		D e f i n e s   /   T y p e d e f s
 *
 ************************************************************************/

//
// Definitions of USB product IDs
//

#define USB_VENDOR_ID_ION
#define USB_VENDOR_ID_TI
#define USB_VENDOR_ID_AXIOHM

//
// Definitions of USB product IDs (PID)
// We break the USB-defined PID into an OEM Id field (upper 6 bits)
// and a Device Id (bottom 10 bits). The Device Id defines what
// device this actually is regardless of what the OEM wants to
// call it.
//

// ION-device OEM IDs
#define ION_OEM_ID_ION
#define ION_OEM_ID_NLYNX
#define ION_OEM_ID_GENERIC
#define ION_OEM_ID_MAC
#define ION_OEM_ID_MEGAWOLF
#define ION_OEM_ID_MULTITECH
#define ION_OEM_ID_AGILENT


// ION-device Device IDs
// Product IDs - assigned to match middle digit of serial number (No longer true)

#define ION_DEVICE_ID_80251_NETCHIP
						// is based on the 80251+Netchip.

#define ION_DEVICE_ID_GENERATION_1
#define ION_DEVICE_ID_GENERATION_2
#define ION_DEVICE_ID_GENERATION_3
#define ION_DEVICE_ID_GENERATION_4
#define ION_GENERATION_MASK

#define ION_DEVICE_ID_HUB_MASK
						// for example 8C would be a 421 4 port hub
						// and 8D would be a 2 port embedded hub

#define EDGEPORT_DEVICE_ID_MASK

#define ION_DEVICE_ID_UNCONFIGURED_EDGE_DEVICE
#define ION_DEVICE_ID_EDGEPORT_4
#define ION_DEVICE_ID_EDGEPORT_8R
#define ION_DEVICE_ID_RAPIDPORT_4
#define ION_DEVICE_ID_EDGEPORT_4T
#define ION_DEVICE_ID_EDGEPORT_2
#define ION_DEVICE_ID_EDGEPORT_4I
#define ION_DEVICE_ID_EDGEPORT_2I
#define ION_DEVICE_ID_EDGEPORT_8RR
//	ION_DEVICE_ID_EDGEPORT_8_HANDBUILT	0x009	// Hand-built Edgeport/8 (Placeholder, used in middle digit of serial number only!)
//	ION_DEVICE_ID_MULTIMODEM_4X56		0x00A	// MultiTech version of RP/4 (Placeholder, used in middle digit of serial number only!)
#define ION_DEVICE_ID_EDGEPORT_PARALLEL_PORT
#define ION_DEVICE_ID_EDGEPORT_421
#define ION_DEVICE_ID_EDGEPORT_21
#define ION_DEVICE_ID_EDGEPORT_8_DUAL_CPU
#define ION_DEVICE_ID_EDGEPORT_8
#define ION_DEVICE_ID_EDGEPORT_2_DIN
#define ION_DEVICE_ID_EDGEPORT_4_DIN
#define ION_DEVICE_ID_EDGEPORT_16_DUAL_CPU
#define ION_DEVICE_ID_EDGEPORT_COMPATIBLE
#define ION_DEVICE_ID_EDGEPORT_8I
#define ION_DEVICE_ID_EDGEPORT_1
#define ION_DEVICE_ID_EPOS44
#define ION_DEVICE_ID_EDGEPORT_42
#define ION_DEVICE_ID_EDGEPORT_412_8
#define ION_DEVICE_ID_EDGEPORT_412_4
#define ION_DEVICE_ID_EDGEPORT_22I

// Compact Form factor TI based devices  2c, 21c, 22c, 221c
#define ION_DEVICE_ID_EDGEPORT_2C
#define ION_DEVICE_ID_EDGEPORT_221C
							// 2 external hub ports - Large I2C
#define ION_DEVICE_ID_EDGEPORT_22C
							// 2 external hub ports - Large I2C
#define ION_DEVICE_ID_EDGEPORT_21C
							// Small I2C


/*
 *  DANGER DANGER The 0x20 bit was used to indicate a 8251/netchip GEN 2 device.
 *  Since the MAC, Linux, and Optimal drivers still used the old code
 *  I suggest that you skip the 0x20 bit when creating new PIDs
 */


// Generation 3 devices -- 3410 based edgport/1 (256 byte I2C)
#define ION_DEVICE_ID_TI3410_EDGEPORT_1
#define ION_DEVICE_ID_TI3410_EDGEPORT_1I

// Ti based software switchable RS232/RS422/RS485 devices
#define ION_DEVICE_ID_EDGEPORT_4S
#define ION_DEVICE_ID_EDGEPORT_8S

// Usb to Ethernet dongle
#define ION_DEVICE_ID_EDGEPORT_E

// Edgeport TI based devices
#define ION_DEVICE_ID_TI_EDGEPORT_4
#define ION_DEVICE_ID_TI_EDGEPORT_2
#define ION_DEVICE_ID_TI_EDGEPORT_4I
#define ION_DEVICE_ID_TI_EDGEPORT_2I
#define ION_DEVICE_ID_TI_EDGEPORT_421
#define ION_DEVICE_ID_TI_EDGEPORT_21
#define ION_DEVICE_ID_TI_EDGEPORT_416
#define ION_DEVICE_ID_TI_EDGEPORT_1
#define ION_DEVICE_ID_TI_EDGEPORT_42
#define ION_DEVICE_ID_TI_EDGEPORT_22I
#define ION_DEVICE_ID_TI_EDGEPORT_2C
#define ION_DEVICE_ID_TI_EDGEPORT_221C
							// 2 external hub ports - Large I2C
#define ION_DEVICE_ID_TI_EDGEPORT_22C
							// 2 external hub ports - Large I2C
#define ION_DEVICE_ID_TI_EDGEPORT_21C

// Generation 3 devices -- 3410 based edgport/1 (256 byte I2C)
#define ION_DEVICE_ID_TI_TI3410_EDGEPORT_1
#define ION_DEVICE_ID_TI_TI3410_EDGEPORT_1I

// Ti based software switchable RS232/RS422/RS485 devices
#define ION_DEVICE_ID_TI_EDGEPORT_4S
#define ION_DEVICE_ID_TI_EDGEPORT_8S
#define ION_DEVICE_ID_TI_EDGEPORT_8
#define ION_DEVICE_ID_TI_EDGEPORT_416B


/************************************************************************
 *
 *                        Generation 4 devices
 *
 ************************************************************************/

// Watchport based on 3410 both 1-wire and binary products (16K I2C)
#define ION_DEVICE_ID_WP_UNSERIALIZED
#define ION_DEVICE_ID_WP_PROXIMITY
#define ION_DEVICE_ID_WP_MOTION
#define ION_DEVICE_ID_WP_MOISTURE
#define ION_DEVICE_ID_WP_TEMPERATURE
#define ION_DEVICE_ID_WP_HUMIDITY

#define ION_DEVICE_ID_WP_POWER
#define ION_DEVICE_ID_WP_LIGHT
#define ION_DEVICE_ID_WP_RADIATION
#define ION_DEVICE_ID_WP_ACCELERATION
#define ION_DEVICE_ID_WP_DISTANCE
#define ION_DEVICE_ID_WP_PROX_DIST
							// Default to /P function

#define ION_DEVICE_ID_PLUS_PWR_HP4CD
#define ION_DEVICE_ID_PLUS_PWR_HP4C
#define ION_DEVICE_ID_PLUS_PWR_PCI


//
// Definitions for AXIOHM USB product IDs
//
#define USB_VENDOR_ID_AXIOHM

#define AXIOHM_DEVICE_ID_MASK
#define AXIOHM_DEVICE_ID_EPIC_A758
#define AXIOHM_DEVICE_ID_EPIC_A794
#define AXIOHM_DEVICE_ID_EPIC_A225


//
// Definitions for NCR USB product IDs
//
#define USB_VENDOR_ID_NCR

#define NCR_DEVICE_ID_MASK
#define NCR_DEVICE_ID_EPIC_0202
#define NCR_DEVICE_ID_EPIC_0203
#define NCR_DEVICE_ID_EPIC_0310
#define NCR_DEVICE_ID_EPIC_0311
#define NCR_DEVICE_ID_EPIC_0312


//
// Definitions for SYMBOL USB product IDs
//
#define USB_VENDOR_ID_SYMBOL
#define SYMBOL_DEVICE_ID_MASK
#define SYMBOL_DEVICE_ID_KEYFOB


//
// Definitions for other product IDs
#define ION_DEVICE_ID_MT4X56USB
#define ION_DEVICE_ID_E5805A


#define GENERATION_ID_FROM_USB_PRODUCT_ID(ProductId)

#define MAKE_USB_PRODUCT_ID(OemId, DeviceId)

#define DEVICE_ID_FROM_USB_PRODUCT_ID(ProductId)

#define OEM_ID_FROM_USB_PRODUCT_ID(ProductId)

//
// Definitions of parameters for download code. Note that these are
// specific to a given version of download code and must change if the
// corresponding download code changes.
//

// TxCredits value below which driver won't bother sending (to prevent too many small writes).
// Send only if above 25%
#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit, MaxPacketSize)

#define EDGE_FW_BULK_MAX_PACKET_SIZE
#define EDGE_FW_BULK_READ_BUFFER_SIZE

#define EDGE_FW_INT_MAX_PACKET_SIZE
							// Note that many units were shipped with MPS=16, we
							// force an upgrade to this value).
#define EDGE_FW_INT_INTERVAL


//
// Definitions of I/O Networks vendor-specific requests
// for default endpoint
//
//	bmRequestType = 01000000	Set vendor-specific, to device
//	bmRequestType = 11000000	Get vendor-specific, to device
//
// These are the definitions for the bRequest field for the
// above bmRequestTypes.
//
// For the read/write Edgeport memory commands, the parameters
// are as follows:
//		wValue = 16-bit address
//		wIndex = unused (though we could put segment 00: or FF: here)
//		wLength = # bytes to read/write (max 64)
//

#define USB_REQUEST_ION_RESET_DEVICE
#define USB_REQUEST_ION_GET_EPIC_DESC
// unused				2	// Unused, available
#define USB_REQUEST_ION_READ_RAM
#define USB_REQUEST_ION_WRITE_RAM
#define USB_REQUEST_ION_READ_ROM
#define USB_REQUEST_ION_WRITE_ROM
#define USB_REQUEST_ION_EXEC_DL_CODE
						// code by jumping to address in wIndex:wValue
//					8	// Unused, available
#define USB_REQUEST_ION_ENABLE_SUSPEND
						// (wValue != 0: Enable; wValue = 0: Disable)

#define USB_REQUEST_ION_SEND_IOSP
#define USB_REQUEST_ION_RECV_IOSP


#define USB_REQUEST_ION_DIS_INT_TIMER
						// interrupt token timer
						// wValue = 1, enable (default)
						// wValue = 0, disable

//
// Define parameter values for our vendor-specific commands
//

//
// Edgeport Compatibility Descriptor
//
// This descriptor is only returned by Edgeport-compatible devices
// supporting the EPiC spec. True ION devices do not return this
// descriptor, but instead return STALL on receipt of the
// GET_EPIC_DESC command. The driver interprets a STALL to mean that
// this is a "real" Edgeport.
//

struct edge_compatibility_bits {};

#define EDGE_COMPATIBILITY_MASK0
#define EDGE_COMPATIBILITY_MASK1
#define EDGE_COMPATIBILITY_MASK2

struct edge_compatibility_descriptor {};

// Values for iDownloadFile
#define EDGE_DOWNLOAD_FILE_NONE
#define EDGE_DOWNLOAD_FILE_INTERNAL
#define EDGE_DOWNLOAD_FILE_I930
#define EDGE_DOWNLOAD_FILE_80251



/*
 *	Special addresses for READ/WRITE_RAM/ROM
 */

// Version 1 (original) format of DeviceParams
#define EDGE_MANUF_DESC_ADDR_V1
#define EDGE_MANUF_DESC_LEN_V1

// Version 2 format of DeviceParams. This format is longer (3C0h)
// and starts lower in memory, at the uppermost 1K in ROM.
#define EDGE_MANUF_DESC_ADDR
#define EDGE_MANUF_DESC_LEN

// Boot params descriptor
#define EDGE_BOOT_DESC_ADDR
#define EDGE_BOOT_DESC_LEN

// Define the max block size that may be read or written
// in a read/write RAM/ROM command.
#define MAX_SIZE_REQ_ION_READ_MEM
#define MAX_SIZE_REQ_ION_WRITE_MEM


//
// Notes for the following two ION vendor-specific param descriptors:
//
//	1.	These have a standard USB descriptor header so they look like a
//		normal descriptor.
//	2.	Any strings in the structures are in USB-defined string
//		descriptor format, so that they may be separately retrieved,
//		if necessary, with a minimum of work on the 930. This also
//		requires them to be in UNICODE format, which, for English at
//		least, simply means extending each __u8 into a __u16.
//	3.	For all fields, 00 means 'uninitialized'.
//	4.	All unused areas should be set to 00 for future expansion.
//

// This structure is ver 2 format. It contains ALL USB descriptors as
// well as the configuration parameters that were in the original V1
// structure. It is NOT modified when new boot code is downloaded; rather,
// these values are set or modified by manufacturing. It is located at
// xC00-xFBF (length 3C0h) in the ROM.
// This structure is a superset of the v1 structure and is arranged so
// that all of the v1 fields remain at the same address. We are just
// adding more room to the front of the structure to hold the descriptors.
//
// The actual contents of this structure are defined in a 930 assembly
// file, converted to a binary image, and then written by the serialization
// program. The C definition of this structure just defines a dummy
// area for general USB descriptors and the descriptor tables (the root
// descriptor starts at xC00). At the bottom of the structure are the
// fields inherited from the v1 structure.

#define MAX_SERIALNUMBER_LEN
#define MAX_ASSEMBLYNUMBER_LEN

struct edge_manuf_descriptor {};


#define MANUF_DESC_VER_1
#define MANUF_DESC_VER_2


// Uart Types
// Note: Since this field was added only recently, all Edgeport/4 units
// shipped before 11/98 will have 00 in this field. Therefore,
// both 00 and 01 values mean '654.
#define MANUF_UART_EXAR_654_EARLY
#define MANUF_UART_EXAR_654
#define MANUF_UART_EXAR_2852

//
// Note: The CpuRev and BoardRev values do not conform to manufacturing
// revisions; they are to be incremented only when the CPU or hardware
// changes in a software-visible way, such that the 930 software or
// the host driver needs to handle the hardware differently.
//

// Values of bottom 5 bits of CpuRev & BoardRev for
// Implementation 0 (ie, 930-based)
#define MANUF_CPU_REV_AD4
#define MANUF_CPU_REV_AD5
#define MANUF_CPU_80251


#define MANUF_BOARD_REV_A
#define MANUF_BOARD_REV_B
#define MANUF_BOARD_REV_C
#define MANUF_BOARD_REV_GENERATION_2


// Values of bottom 5 bits of CpuRev & BoardRev for
// Implementation 1 (ie, 251+Netchip-based)
#define MANUF_CPU_REV_1

#define MANUF_BOARD_REV_A

#define MANUF_SERNUM_LENGTH
#define MANUF_ASSYNUM_LENGTH
#define MANUF_OEMASSYNUM_LENGTH
#define MANUF_MANUFDATE_LENGTH

#define MANUF_ION_CONFIG_DIAG_NO_LOOP
#define MANUF_ION_CONFIG_DIAG
						// TIUMP Device    : 1=IONSERIAL needs to run Final Test
#define MANUF_ION_CONFIG_MASTER
						// TIUMP Device    :  1=First device on a multi TIUMP Device

//
// This structure describes parameters for the boot code, and
// is programmed along with new boot code. These are values
// which are specific to a given build of the boot code. It
// is exactly 64 bytes long and is fixed at address FF:xFC0
// - FF:xFFF. Note that the 930-mandated UCONFIG bytes are
// included in this structure.
//
struct edge_boot_descriptor {};


#define BOOT_DESC_VER_1
#define BOOT_DESC_VER_2


	// Capabilities flags

#define BOOT_CAP_RESET_CMD


/************************************************************************
                 T I   U M P   D E F I N I T I O N S
 ***********************************************************************/

// Chip definitions in I2C
#define UMP5152
#define UMP3410


//************************************************************************
//	TI I2C Format Definitions
//************************************************************************
#define I2C_DESC_TYPE_INFO_BASIC
#define I2C_DESC_TYPE_FIRMWARE_BASIC
#define I2C_DESC_TYPE_DEVICE
#define I2C_DESC_TYPE_CONFIG
#define I2C_DESC_TYPE_STRING
#define I2C_DESC_TYPE_FIRMWARE_AUTO
#define I2C_DESC_TYPE_CONFIG_KLUDGE
#define I2C_DESC_TYPE_WATCHPORT_VERSION
#define I2C_DESC_TYPE_WATCHPORT_CALIBRATION_DATA

#define I2C_DESC_TYPE_FIRMWARE_BLANK

// Special section defined by ION
#define I2C_DESC_TYPE_ION


struct ti_i2c_desc {} __attribute__((packed));

// for 5152 devices only (type 2 record)
// for 3410 the version is stored in the WATCHPORT_FIRMWARE_VERSION descriptor
struct ti_i2c_firmware_rec {} __attribute__((packed));


struct watchport_firmware_version {} __attribute__((packed));


// Structure of header of download image in fw_down.h
struct ti_i2c_image_header {} __attribute__((packed));

struct ti_basic_descriptor {} __attribute__((packed));


// CPU / Board Rev Definitions
#define TI_CPU_REV_5052
#define TI_CPU_REV_3410

#define TI_BOARD_REV_TI_EP
#define TI_BOARD_REV_COMPACT
#define TI_BOARD_REV_WATCHPORT


#define TI_GET_CPU_REVISION(x)
#define TI_GET_BOARD_REVISION(x)

#define TI_I2C_SIZE_MASK
#define TI_GET_I2C_SIZE(x)

#define TI_MAX_I2C_SIZE

#define TI_MANUF_VERSION_0

// IonConig2 flags
#define TI_CONFIG2_RS232
#define TI_CONFIG2_RS422
#define TI_CONFIG2_RS485
#define TI_CONFIG2_SWITCHABLE

#define TI_CONFIG2_WATCHPORT


struct edge_ti_manuf_descriptor {} __attribute__((packed));


#endif		// if !defined(_USBVEND_H)