Setting up repository
[linux-libre-firmware.git] / ath9k_htc / sboot / magpie_1_1 / sboot / hif / usb / src / usb_table.c
1 /*
2  * Copyright (c) 2013 Qualcomm Atheros, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted (subject to the limitations in the
7  * disclaimer below) provided that the following conditions are met:
8  *
9  *  * Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  *  * Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the
15  *    distribution.
16  *
17  *  * Neither the name of Qualcomm Atheros nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
22  * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
24  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 #include "usb_type.h"
36 #include "usb_table.h"
37 #include "sys_cfg.h"
38
39 #if SYSTEM_MODULE_USB
40
41 //#if defined(_ROM_)
42 //const uint16_t UsbDeviceDescriptor[] __attribute__ ((section(".dport0.usb_in_rom"))) = 
43 //#else
44 uint16_t UsbDeviceDescriptor[] =
45 //#endif
46 {
47     m2BYTE(USB_DEVICE_DESC_LEN, USB_DEVICE_DESC_TYPE),
48     USB_SPEC_VERSION,
49     m2BYTE(USB_DEVICE_CLASS, USB_DEVICE_SUB_CLASS),
50     m2BYTE(USB_DEVICE_PROTOCOL, USB_MAX_PKT_SIZE),
51     USB_VENDOR_ID,
52     USB_PRODUCT_ID,
53     USB_DEVICE_BCD,
54     m2BYTE(USB_MANUFACTURER_INDEX, USB_PRODUCT_INDEX),
55     m2BYTE(USB_SERIAL_INDEX, USB_CONFIGURATION_NUM)
56 };
57
58 //#if defined(_ROM_)
59 //const uint16_t u8HSConfigDescriptor01[] __attribute__ ((section(".dport0.usb_in_rom"))) =
60 //#else
61 uint16_t u8HSConfigDescriptor01[] =
62 //#endif
63 {
64     m2BYTE(USB_CONFIG_DESC_LEN, USB_CONFIG_DESC_TYPE),
65     USB_TOTAL_DESC_LEN,
66     m2BYTE(USB_INTERFACE_NUM, USB_CONFIG_NUM),
67     m2BYTE(USB_STRING_INDEX, USB_ATTRIBUTE),
68     m2BYTE(USB_MAX_POWER, USB_INTERFACE_DESC_LEN),
69     m2BYTE(USB_INTERFACE_DESC_TYPE, USB_INTERFACE_INDEX_NUM),
70     m2BYTE(USB_INTERFACE_ALT_SETTING, USB_INTERFACE_EP_NUM),
71     m2BYTE(USB_INTERFACE_CLASS, USB_INTERFACE_SUB_CLASS),
72     m2BYTE(USB_INTERFACE_PROTOCOL, USB_INTERFACE_STRING_INDEX),
73     m2BYTE(USB_EP_DESC_LEN, USB_EP_DESC_TYPE),                      // EP 1
74     m2BYTE(USB_HS_EP1_ADDRESS, USB_HS_EP1_ATTRIBUTE),
75     USB_HS_EP1_MAX_PACKET_SIZE, 
76     m2BYTE(USB_HS_EP1_INTERVAL, USB_EP_DESC_LEN),                   // EP 2
77     m2BYTE(USB_EP_DESC_TYPE, USB_HS_EP2_ADDRESS),
78     m2BYTE(USB_HS_EP2_ATTRIBUTE, USB_HS_EP2_MAX_PACKET_SIZE),
79     m2BYTE(mHIGH_BYTE(USB_HS_EP2_MAX_PACKET_SIZE), USB_HS_EP2_INTERVAL),
80     m2BYTE(USB_EP_DESC_LEN, USB_EP_DESC_TYPE),                      // EP 3
81     m2BYTE(USB_HS_EP3_ADDRESS, USB_HS_EP3_ATTRIBUTE),
82     USB_HS_EP3_MAX_PACKET_SIZE,
83     m2BYTE(USB_HS_EP3_INTERVAL, USB_EP_DESC_LEN),                   // EP 4
84     m2BYTE(USB_EP_DESC_TYPE, USB_HS_EP4_ADDRESS),
85     m2BYTE(USB_HS_EP4_ATTRIBUTE, USB_HS_EP4_MAX_PACKET_SIZE),
86     m2BYTE(mHIGH_BYTE(USB_HS_EP4_MAX_PACKET_SIZE), USB_HS_EP4_INTERVAL),
87     m2BYTE(USB_EP_DESC_LEN, USB_EP_DESC_TYPE),                      // EP 5
88     m2BYTE(USB_HS_EP5_ADDRESS, USB_HS_EP5_ATTRIBUTE),
89     USB_HS_EP5_MAX_PACKET_SIZE,
90     m2BYTE(USB_HS_EP5_INTERVAL, USB_EP_DESC_LEN),                 // EP 6
91     m2BYTE(USB_EP_DESC_TYPE, USB_HS_EP6_ADDRESS),
92     m2BYTE(USB_HS_EP6_ATTRIBUTE, USB_HS_EP6_MAX_PACKET_SIZE),
93     m2BYTE(mHIGH_BYTE(USB_HS_EP6_MAX_PACKET_SIZE), USB_HS_EP6_INTERVAL)
94 };
95
96
97 //#if defined(_ROM_)
98 //const uint16_t u8FSConfigDescriptor01[] __attribute__ ((section(".dport0.usb_in_rom"))) =
99 //#else
100 uint16_t u8FSConfigDescriptor01[] =
101 //#endif
102 {
103     m2BYTE(USB_CONFIG_DESC_LEN, USB_CONFIG_DESC_TYPE),
104     USB_TOTAL_DESC_LEN,
105     m2BYTE(USB_INTERFACE_NUM, USB_CONFIG_NUM),
106     m2BYTE(USB_STRING_INDEX, USB_ATTRIBUTE),
107     m2BYTE(USB_MAX_POWER, USB_INTERFACE_DESC_LEN),
108     m2BYTE(USB_INTERFACE_DESC_TYPE, USB_INTERFACE_INDEX_NUM),
109     m2BYTE(USB_INTERFACE_ALT_SETTING, USB_INTERFACE_EP_NUM),
110     m2BYTE(USB_INTERFACE_CLASS, USB_INTERFACE_SUB_CLASS),
111     m2BYTE(USB_INTERFACE_PROTOCOL, USB_INTERFACE_STRING_INDEX),
112     m2BYTE(USB_EP_DESC_LEN, USB_EP_DESC_TYPE),                      // EP 1
113     m2BYTE(USB_FS_EP1_ADDRESS, USB_FS_EP1_ATTRIBUTE),
114     USB_FS_EP1_MAX_PACKET_SIZE,
115     m2BYTE(USB_FS_EP1_INTERVAL, USB_EP_DESC_LEN),                   // EP 2
116     m2BYTE(USB_EP_DESC_TYPE, USB_FS_EP2_ADDRESS),
117     m2BYTE(USB_FS_EP2_ATTRIBUTE, USB_FS_EP2_MAX_PACKET_SIZE),
118     m2BYTE(mHIGH_BYTE(USB_FS_EP2_MAX_PACKET_SIZE), USB_FS_EP2_INTERVAL),
119     m2BYTE(USB_EP_DESC_LEN, USB_EP_DESC_TYPE),                      // EP 3
120     m2BYTE(USB_FS_EP3_ADDRESS, USB_FS_EP3_ATTRIBUTE),
121     USB_FS_EP3_MAX_PACKET_SIZE, 
122     m2BYTE(USB_FS_EP3_INTERVAL, USB_EP_DESC_LEN),                   // EP 4
123     m2BYTE(USB_EP_DESC_TYPE, USB_FS_EP4_ADDRESS),
124     m2BYTE(USB_FS_EP4_ATTRIBUTE, USB_FS_EP4_MAX_PACKET_SIZE),
125     m2BYTE(mHIGH_BYTE(USB_FS_EP4_MAX_PACKET_SIZE), USB_FS_EP4_INTERVAL),
126     m2BYTE(USB_EP_DESC_LEN, USB_EP_DESC_TYPE),                      // EP 5
127     m2BYTE(USB_FS_EP5_ADDRESS, USB_FS_EP5_ATTRIBUTE),
128     USB_FS_EP5_MAX_PACKET_SIZE, 
129     m2BYTE(USB_FS_EP5_INTERVAL, USB_EP_DESC_LEN),                   // EP 6
130     m2BYTE(USB_EP_DESC_TYPE, USB_FS_EP6_ADDRESS),
131     m2BYTE(USB_FS_EP6_ATTRIBUTE, USB_FS_EP6_MAX_PACKET_SIZE),
132     m2BYTE(mHIGH_BYTE(USB_FS_EP6_MAX_PACKET_SIZE), USB_FS_EP6_INTERVAL)
133 };
134
135 uint16_t u8DeviceQualifierDescriptorEX[] =
136 {
137     0x0000,
138     0x0000,
139     0x0000,
140     0x0000,
141     0x0000
142 };
143
144 uint16_t u8OtherSpeedConfigDescriptorEX[] =
145 {
146     0x0709,             // 0
147     0x0000,
148     0x0000,
149     0x0000,
150     0x0000,
151     0x0000,             // 5
152     0x0000,
153     0x0000,
154     0x0000,
155     0x0000,
156     0x0000,             // 10
157     0x0000,
158     0x0000,
159     0x0000,
160     0x0000,
161     0x0000,             // 15
162     0x0000,
163     0x0000,
164     0x0000,
165     0x0000,
166     0x0000,             // 20
167     0x0000,
168     0x0000,
169     0x0000,
170     0x0000,
171     0x0000,             // 25
172     0x0000,
173     0x0000,
174     0x0000,
175     0x0000
176 };
177
178 //#if defined(_ROM_)
179 //const uint16_t String00Descriptor[] __attribute__ ((section(".dport0.usb_in_rom"))) = 
180 //#else
181 uint16_t String00Descriptor[] = 
182 //#endif
183 {
184         0x0304, 
185         0x0409
186 };
187
188 //#if defined(_ROM_)
189 //const uint16_t String10Descriptor[] __attribute__ ((section(".dport0.usb_in_rom"))) = 
190 //#else
191 uint16_t String10Descriptor[] = 
192 //#endif
193 {
194         0x0360,                 //length
195         0x0041,                         //A
196         0x0054,                         //T
197         0x0048,                         //H 
198         0x0045,                         //E 
199         0x0052,                         //R
200         0x004f,                         //O
201         0x0053,             //S
202     0x002c,             //,
203         0x0041,                         //A
204         0x0054,                         //T
205         0x0048,                         //H 
206         0x0045,                         //E 
207         0x0052,                         //R
208         0x004f,                         //O
209         0x0053,             //S
210     0x002c,             //,
211         0x0041,                         //A
212         0x0054,                         //T
213         0x0048,                         //H 
214         0x0045,                         //E 
215         0x0052,                         //R
216         0x004f,                         //O
217         0x0053,             //S
218     0x002c,             //,
219         0x0041,                         //A
220         0x0054,                         //T
221         0x0048,                         //H 
222         0x0045,                         //E 
223         0x0052,                         //R
224         0x004f,                         //O
225         0x0053,             //S
226     0x002c,             //,
227         0x0041,                         //A
228         0x0054,                         //T
229         0x0048,                         //H 
230         0x0045,                         //E 
231         0x0052,                         //R
232         0x004f,                         //O
233         0x0053,             //S
234     0x002c,             //,
235         0x0041,                         //A
236         0x0054,                         //T
237         0x0048,                         //H 
238         0x0045,                         //E 
239         0x0052,                         //R
240         0x004f,                         //O
241         0x0053,             //S 
242 };
243
244 //#if defined(_ROM_)
245 //const uint16_t String20Descriptor[] __attribute__ ((section(".dport0.usb_in_rom"))) = 
246 //#else
247 uint16_t String20Descriptor[] = 
248 //#endif
249 {
250         0x0318,                  //length
251         0x0055,          //'U' 
252         0x0053,          //'S'
253         0x0042,          //'B'
254         0x0032,          //'2'
255         0x002E,          //'.'
256         0x0030,          //'0'
257         0x0020,          //' '
258         0x0057,          //'W'
259         0x004C,          //'L'
260         0x0041,          //'A'
261         0x004E,          //'N'
262 };
263
264 //#if defined(_ROM_)
265 //const uint16_t String30Descriptor[] __attribute__ ((section(".dport0.usb_in_rom"))) = 
266 //#else
267 uint16_t String30Descriptor[] = 
268 //#endif
269 {
270         0x030c,                  //length
271         0x0031,          //;'1'
272         0x0032,          //;'2'
273         0x0033,          //;'3'
274         0x0034,          //;'4'
275         0x0035,          //;'5'
276 };
277
278 #endif