18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Infinity Unlimited USB Phoenix driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2007 Alain Degreffe (eczema@ecze.com)
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Original code taken from iuutool ( Copyright (C) 2006 Juan Carlos Borrás )
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci *  And tested with help of WB Electronics
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define   IUU_USB_VENDOR_ID  0x104f
148c2ecf20Sopenharmony_ci#define   IUU_USB_PRODUCT_ID  0x0004
158c2ecf20Sopenharmony_ci#define   IUU_USB_OP_TIMEOUT  0x0200
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Programmer commands */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define IUU_NO_OPERATION   0x00
208c2ecf20Sopenharmony_ci#define IUU_GET_FIRMWARE_VERSION   0x01
218c2ecf20Sopenharmony_ci#define IUU_GET_PRODUCT_NAME   0x02
228c2ecf20Sopenharmony_ci#define IUU_GET_STATE_REGISTER   0x03
238c2ecf20Sopenharmony_ci#define IUU_SET_LED   0x04
248c2ecf20Sopenharmony_ci#define IUU_WAIT_MUS   0x05
258c2ecf20Sopenharmony_ci#define IUU_WAIT_MS   0x06
268c2ecf20Sopenharmony_ci#define IUU_GET_LOADER_VERSION   0x50
278c2ecf20Sopenharmony_ci#define IUU_RST_SET   0x52
288c2ecf20Sopenharmony_ci#define IUU_RST_CLEAR   0x53
298c2ecf20Sopenharmony_ci#define IUU_SET_VCC   0x59
308c2ecf20Sopenharmony_ci#define IUU_UART_ENABLE   0x49
318c2ecf20Sopenharmony_ci#define IUU_UART_DISABLE   0x4A
328c2ecf20Sopenharmony_ci#define IUU_UART_WRITE_I2C   0x4C
338c2ecf20Sopenharmony_ci#define IUU_UART_ESC   0x5E
348c2ecf20Sopenharmony_ci#define IUU_UART_TRAP   0x54
358c2ecf20Sopenharmony_ci#define IUU_UART_TRAP_BREAK   0x5B
368c2ecf20Sopenharmony_ci#define IUU_UART_RX   0x56
378c2ecf20Sopenharmony_ci#define IUU_AVR_ON   0x21
388c2ecf20Sopenharmony_ci#define IUU_AVR_OFF   0x22
398c2ecf20Sopenharmony_ci#define IUU_AVR_1CLK   0x23
408c2ecf20Sopenharmony_ci#define IUU_AVR_RESET   0x24
418c2ecf20Sopenharmony_ci#define IUU_AVR_RESET_PC   0x25
428c2ecf20Sopenharmony_ci#define IUU_AVR_INC_PC   0x26
438c2ecf20Sopenharmony_ci#define IUU_AVR_INCN_PC   0x27
448c2ecf20Sopenharmony_ci#define IUU_AVR_PREAD   0x29
458c2ecf20Sopenharmony_ci#define IUU_AVR_PREADN   0x2A
468c2ecf20Sopenharmony_ci#define IUU_AVR_PWRITE   0x28
478c2ecf20Sopenharmony_ci#define IUU_AVR_DREAD   0x2C
488c2ecf20Sopenharmony_ci#define IUU_AVR_DREADN   0x2D
498c2ecf20Sopenharmony_ci#define IUU_AVR_DWRITE   0x2B
508c2ecf20Sopenharmony_ci#define IUU_AVR_PWRITEN   0x2E
518c2ecf20Sopenharmony_ci#define IUU_EEPROM_ON   0x37
528c2ecf20Sopenharmony_ci#define IUU_EEPROM_OFF   0x38
538c2ecf20Sopenharmony_ci#define IUU_EEPROM_WRITE   0x39
548c2ecf20Sopenharmony_ci#define IUU_EEPROM_WRITEX   0x3A
558c2ecf20Sopenharmony_ci#define IUU_EEPROM_WRITE8   0x3B
568c2ecf20Sopenharmony_ci#define IUU_EEPROM_WRITE16   0x3C
578c2ecf20Sopenharmony_ci#define IUU_EEPROM_WRITEX32   0x3D
588c2ecf20Sopenharmony_ci#define IUU_EEPROM_WRITEX64   0x3E
598c2ecf20Sopenharmony_ci#define IUU_EEPROM_READ   0x3F
608c2ecf20Sopenharmony_ci#define IUU_EEPROM_READX   0x40
618c2ecf20Sopenharmony_ci#define IUU_EEPROM_BREAD   0x41
628c2ecf20Sopenharmony_ci#define IUU_EEPROM_BREADX   0x42
638c2ecf20Sopenharmony_ci#define IUU_PIC_CMD   0x0A
648c2ecf20Sopenharmony_ci#define IUU_PIC_CMD_LOAD   0x0B
658c2ecf20Sopenharmony_ci#define IUU_PIC_CMD_READ   0x0C
668c2ecf20Sopenharmony_ci#define IUU_PIC_ON   0x0D
678c2ecf20Sopenharmony_ci#define IUU_PIC_OFF   0x0E
688c2ecf20Sopenharmony_ci#define IUU_PIC_RESET   0x16
698c2ecf20Sopenharmony_ci#define IUU_PIC_INC_PC   0x0F
708c2ecf20Sopenharmony_ci#define IUU_PIC_INCN_PC   0x10
718c2ecf20Sopenharmony_ci#define IUU_PIC_PWRITE   0x11
728c2ecf20Sopenharmony_ci#define IUU_PIC_PREAD   0x12
738c2ecf20Sopenharmony_ci#define IUU_PIC_PREADN   0x13
748c2ecf20Sopenharmony_ci#define IUU_PIC_DWRITE   0x14
758c2ecf20Sopenharmony_ci#define IUU_PIC_DREAD   0x15
768c2ecf20Sopenharmony_ci#define IUU_UART_NOP   0x00
778c2ecf20Sopenharmony_ci#define IUU_UART_CHANGE   0x02
788c2ecf20Sopenharmony_ci#define IUU_UART_TX   0x04
798c2ecf20Sopenharmony_ci#define IUU_DELAY_MS   0x06
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define IUU_OPERATION_OK   0x00
828c2ecf20Sopenharmony_ci#define IUU_DEVICE_NOT_FOUND   0x01
838c2ecf20Sopenharmony_ci#define IUU_INVALID_HANDLE   0x02
848c2ecf20Sopenharmony_ci#define IUU_INVALID_PARAMETER   0x03
858c2ecf20Sopenharmony_ci#define IUU_INVALID_voidERFACE   0x04
868c2ecf20Sopenharmony_ci#define IUU_INVALID_REQUEST_LENGTH   0x05
878c2ecf20Sopenharmony_ci#define IUU_UART_NOT_ENABLED   0x06
888c2ecf20Sopenharmony_ci#define IUU_WRITE_ERROR   0x07
898c2ecf20Sopenharmony_ci#define IUU_READ_ERROR   0x08
908c2ecf20Sopenharmony_ci#define IUU_TX_ERROR   0x09
918c2ecf20Sopenharmony_ci#define IUU_RX_ERROR   0x0A
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define IUU_PARITY_NONE   0x00
948c2ecf20Sopenharmony_ci#define IUU_PARITY_EVEN   0x01
958c2ecf20Sopenharmony_ci#define IUU_PARITY_ODD   0x02
968c2ecf20Sopenharmony_ci#define IUU_PARITY_MARK   0x03
978c2ecf20Sopenharmony_ci#define IUU_PARITY_SPACE   0x04
988c2ecf20Sopenharmony_ci#define IUU_SC_INSERTED   0x01
998c2ecf20Sopenharmony_ci#define IUU_VERIFY_ERROR   0x02
1008c2ecf20Sopenharmony_ci#define IUU_SIM_INSERTED   0x04
1018c2ecf20Sopenharmony_ci#define IUU_TWO_STOP_BITS   0x00
1028c2ecf20Sopenharmony_ci#define IUU_ONE_STOP_BIT   0x20
1038c2ecf20Sopenharmony_ci#define IUU_BAUD_2400   0x0398
1048c2ecf20Sopenharmony_ci#define IUU_BAUD_9600   0x0298
1058c2ecf20Sopenharmony_ci#define IUU_BAUD_19200   0x0164
1068c2ecf20Sopenharmony_ci#define IUU_BAUD_28800   0x0198
1078c2ecf20Sopenharmony_ci#define IUU_BAUD_38400   0x01B2
1088c2ecf20Sopenharmony_ci#define IUU_BAUD_57600   0x0030
1098c2ecf20Sopenharmony_ci#define IUU_BAUD_115200   0x0098
1108c2ecf20Sopenharmony_ci#define IUU_CLK_3579000   3579000
1118c2ecf20Sopenharmony_ci#define IUU_CLK_3680000   3680000
1128c2ecf20Sopenharmony_ci#define IUU_CLK_6000000   6000000
1138c2ecf20Sopenharmony_ci#define IUU_FULLCARD_IN   0x01
1148c2ecf20Sopenharmony_ci#define IUU_DEV_ERROR   0x02
1158c2ecf20Sopenharmony_ci#define IUU_MINICARD_IN   0x04
1168c2ecf20Sopenharmony_ci#define IUU_VCC_5V   0x00
1178c2ecf20Sopenharmony_ci#define IUU_VCC_3V   0x01
118