Commit | Line | Data |
---|---|---|
dfb0f3ae RC |
1 | /* |
2 | * Broadcom USB remote download definitions | |
3 | * | |
4 | * Copyright (C) 1999-2016, Broadcom Corporation | |
5 | * | |
6 | * Unless you and Broadcom execute a separate written software license | |
7 | * agreement governing use of this software, this software is licensed to you | |
8 | * under the terms of the GNU General Public License version 2 (the "GPL"), | |
9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the | |
10 | * following added to such license: | |
11 | * | |
12 | * As a special exception, the copyright holders of this software give you | |
13 | * permission to link this software with independent modules, and to copy and | |
14 | * distribute the resulting executable under terms of your choice, provided that | |
15 | * you also meet, for each linked independent module, the terms and conditions of | |
16 | * the license of that module. An independent module is a module which is not | |
17 | * derived from this software. The special exception does not apply to any | |
18 | * modifications of the software. | |
19 | * | |
20 | * Notwithstanding the above, under no circumstances may you combine this | |
21 | * software in any way with any other Broadcom software provided under a license | |
22 | * other than the GPL, without Broadcom's express prior written consent. | |
23 | * | |
24 | * | |
25 | * <<Broadcom-WL-IPTag/Open:>> | |
26 | * | |
27 | * $Id: usbrdl.h 597933 2015-11-06 18:52:06Z $ | |
28 | */ | |
29 | ||
30 | #ifndef _USB_RDL_H | |
31 | #define _USB_RDL_H | |
32 | ||
33 | /* Control messages: bRequest values */ | |
34 | #define DL_GETSTATE 0 /* returns the rdl_state_t struct */ | |
35 | #define DL_CHECK_CRC 1 /* currently unused */ | |
36 | #define DL_GO 2 /* execute downloaded image */ | |
37 | #define DL_START 3 /* initialize dl state */ | |
38 | #define DL_REBOOT 4 /* reboot the device in 2 seconds */ | |
39 | #define DL_GETVER 5 /* returns the bootrom_id_t struct */ | |
40 | #define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset event | |
41 | * to occur in 2 seconds. It is the responsibility | |
42 | * of the downloaded code to clear this event | |
43 | */ | |
44 | #define DL_EXEC 7 /* jump to a supplied address */ | |
45 | #define DL_RESETCFG 8 /* To support single enum on dongle | |
46 | * - Not used by bootloader | |
47 | */ | |
48 | #define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup | |
49 | * if resp unavailable | |
50 | */ | |
51 | #define DL_CHGSPD 0x0A | |
52 | ||
53 | #define DL_HWCMD_MASK 0xfc /* Mask for hardware read commands: */ | |
54 | #define DL_RDHW 0x10 /* Read a hardware address (Ctl-in) */ | |
55 | #define DL_RDHW32 0x10 /* Read a 32 bit word */ | |
56 | #define DL_RDHW16 0x11 /* Read 16 bits */ | |
57 | #define DL_RDHW8 0x12 /* Read an 8 bit byte */ | |
58 | #define DL_WRHW 0x14 /* Write a hardware address (Ctl-out) */ | |
59 | #define DL_WRHW_BLK 0x13 /* Block write to hardware access */ | |
60 | ||
61 | #define DL_CMD_WRHW 2 | |
62 | ||
63 | ||
64 | /* states */ | |
65 | #define DL_WAITING 0 /* waiting to rx first pkt that includes the hdr info */ | |
66 | #define DL_READY 1 /* hdr was good, waiting for more of the compressed image */ | |
67 | #define DL_BAD_HDR 2 /* hdr was corrupted */ | |
68 | #define DL_BAD_CRC 3 /* compressed image was corrupted */ | |
69 | #define DL_RUNNABLE 4 /* download was successful, waiting for go cmd */ | |
70 | #define DL_START_FAIL 5 /* failed to initialize correctly */ | |
71 | #define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM value */ | |
72 | #define DL_IMAGE_TOOBIG 7 /* download image too big (exceeds DATA_START for rdl) */ | |
73 | ||
74 | #define TIMEOUT 5000 /* Timeout for usb commands */ | |
75 | ||
76 | struct bcm_device_id { | |
77 | char *name; | |
78 | uint32 vend; | |
79 | uint32 prod; | |
80 | }; | |
81 | ||
82 | typedef struct { | |
83 | uint32 state; | |
84 | uint32 bytes; | |
85 | } rdl_state_t; | |
86 | ||
87 | typedef struct { | |
88 | uint32 chip; /* Chip id */ | |
89 | uint32 chiprev; /* Chip rev */ | |
90 | uint32 ramsize; /* Size of RAM */ | |
91 | uint32 remapbase; /* Current remap base address */ | |
92 | uint32 boardtype; /* Type of board */ | |
93 | uint32 boardrev; /* Board revision */ | |
94 | } bootrom_id_t; | |
95 | ||
96 | /* struct for backplane & jtag accesses */ | |
97 | typedef struct { | |
98 | uint32 cmd; /* tag to identify the cmd */ | |
99 | uint32 addr; /* backplane address for write */ | |
100 | uint32 len; /* length of data: 1, 2, 4 bytes */ | |
101 | uint32 data; /* data to write */ | |
102 | } hwacc_t; | |
103 | ||
104 | ||
105 | /* struct for querying nvram params from bootloader */ | |
106 | #define QUERY_STRING_MAX 32 | |
107 | typedef struct { | |
108 | uint32 cmd; /* tag to identify the cmd */ | |
109 | char var[QUERY_STRING_MAX]; /* param name */ | |
110 | } nvparam_t; | |
111 | ||
112 | typedef void (*exec_fn_t)(void *sih); | |
113 | ||
114 | #define USB_CTRL_IN (USB_TYPE_VENDOR | 0x80 | USB_RECIP_INTERFACE) | |
115 | #define USB_CTRL_OUT (USB_TYPE_VENDOR | 0 | USB_RECIP_INTERFACE) | |
116 | ||
117 | #define USB_CTRL_EP_TIMEOUT 500 /* Timeout used in USB control_msg transactions. */ | |
118 | #define USB_BULK_EP_TIMEOUT 500 /* Timeout used in USB bulk transactions. */ | |
119 | ||
120 | #define RDL_CHUNK_MAX (64 * 1024) /* max size of each dl transfer */ | |
121 | #define RDL_CHUNK 1500 /* size of each dl transfer */ | |
122 | ||
123 | /* bootloader makes special use of trx header "offsets" array */ | |
124 | #define TRX_OFFSETS_DLFWLEN_IDX 0 /* Size of the fw; used in uncompressed case */ | |
125 | #define TRX_OFFSETS_JUMPTO_IDX 1 /* RAM address for jumpto after download */ | |
126 | #define TRX_OFFSETS_NVM_LEN_IDX 2 /* Length of appended NVRAM data */ | |
127 | #ifdef BCMTRXV2 | |
128 | #define TRX_OFFSETS_DSG_LEN_IDX 3 /* Length of digital signature for the first image */ | |
129 | #define TRX_OFFSETS_CFG_LEN_IDX 4 /* Length of config region, which is not digitally signed */ | |
130 | #endif /* BCMTRXV2 */ | |
131 | ||
132 | #define TRX_OFFSETS_DLBASE_IDX 0 /* RAM start address for download */ | |
133 | ||
134 | #endif /* _USB_RDL_H */ |