blob: 4509287ce493107dafa8fcd88b88cb9a04d75a03 [file] [log] [blame]
Uwe Hermann06694a82010-09-23 18:16:46 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007 AMD
5 * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Uwe Hermann06694a82010-09-23 18:16:46 +000015 */
16
Yinghai Lud57241f2007-02-28 11:17:02 +000017#ifndef USB_CH9_H
18#define USB_CH9_H
19
20#define USB_DIR_OUT 0 /* to device */
21#define USB_DIR_IN 0x80 /* to host */
22
23/*
24 * USB types, the second of three bRequestType fields
25 */
26#define USB_TYPE_MASK (0x03 << 5)
27#define USB_TYPE_STANDARD (0x00 << 5)
28#define USB_TYPE_CLASS (0x01 << 5)
29#define USB_TYPE_VENDOR (0x02 << 5)
30#define USB_TYPE_RESERVED (0x03 << 5)
31/*
32 * USB recipients, the third of three bRequestType fields
33 */
34#define USB_RECIP_MASK 0x1f
35#define USB_RECIP_DEVICE 0x00
36#define USB_RECIP_INTERFACE 0x01
37#define USB_RECIP_ENDPOINT 0x02
38#define USB_RECIP_OTHER 0x03
39/* From Wireless USB 1.0 */
40#define USB_RECIP_PORT 0x04
41#define USB_RECIP_RPIPE 0x05
42
43/*
44 * Standard requests, for the bRequest field of a SETUP packet.
45 *
46 * These are qualified by the bRequestType field, so that for example
47 * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
48 * by a GET_STATUS request.
49 */
50#define USB_REQ_GET_STATUS 0x00
51#define USB_REQ_CLEAR_FEATURE 0x01
52#define USB_REQ_SET_FEATURE 0x03
53#define USB_REQ_SET_ADDRESS 0x05
54#define USB_REQ_GET_DESCRIPTOR 0x06
55#define USB_REQ_SET_DESCRIPTOR 0x07
56#define USB_REQ_GET_CONFIGURATION 0x08
57#define USB_REQ_SET_CONFIGURATION 0x09
58#define USB_REQ_GET_INTERFACE 0x0A
59#define USB_REQ_SET_INTERFACE 0x0B
60#define USB_REQ_SYNCH_FRAME 0x0C
61
62#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
63#define USB_REQ_GET_ENCRYPTION 0x0E
64#define USB_REQ_RPIPE_ABORT 0x0E
65#define USB_REQ_SET_HANDSHAKE 0x0F
66#define USB_REQ_RPIPE_RESET 0x0F
67#define USB_REQ_GET_HANDSHAKE 0x10
68#define USB_REQ_SET_CONNECTION 0x11
69#define USB_REQ_SET_SECURITY_DATA 0x12
70#define USB_REQ_GET_SECURITY_DATA 0x13
71#define USB_REQ_SET_WUSB_DATA 0x14
72#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
73#define USB_REQ_LOOPBACK_DATA_READ 0x16
74#define USB_REQ_SET_INTERFACE_DS 0x17
75
76#define USB_DT_DEBUG 0x0a
77
78#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
79
Kyösti Mälkki46249be22014-10-27 14:07:28 +020080/*
81 * USB Packet IDs (PIDs)
82 */
83
84/* token */
85#define USB_PID_OUT 0xe1
86#define USB_PID_IN 0x69
87#define USB_PID_SOF 0xa5
88#define USB_PID_SETUP 0x2d
89/* handshake */
90#define USB_PID_ACK 0xd2
91#define USB_PID_NAK 0x5a
92#define USB_PID_STALL 0x1e
93#define USB_PID_NYET 0x96
94/* data */
95#define USB_PID_DATA0 0xc3
96#define USB_PID_DATA1 0x4b
97#define USB_PID_DATA2 0x87
98#define USB_PID_MDATA 0x0f
99/* Special */
100#define USB_PID_PREAMBLE 0x3c
101#define USB_PID_ERR 0x3c
102#define USB_PID_SPLIT 0x78
103#define USB_PID_PING 0xb4
104#define USB_PID_UNDEF_0 0xf0
105
106#define USB_PID_DATA_TOGGLE 0x88
107
Yinghai Lud57241f2007-02-28 11:17:02 +0000108struct usb_ctrlrequest {
Stefan Reinauer56394482010-05-25 16:02:28 +0000109 u8 bRequestType;
110 u8 bRequest;
111 u16 wValue;
112 u16 wIndex;
113 u16 wLength;
Yinghai Lud57241f2007-02-28 11:17:02 +0000114} __attribute__ ((packed));
115
116struct usb_debug_descriptor {
Stefan Reinauer56394482010-05-25 16:02:28 +0000117 u8 bLength;
118 u8 bDescriptorType;
Yinghai Lud57241f2007-02-28 11:17:02 +0000119
120 /* bulk endpoints with 8 byte maxpacket */
Stefan Reinauer56394482010-05-25 16:02:28 +0000121 u8 bDebugInEndpoint;
122 u8 bDebugOutEndpoint;
Yinghai Lud57241f2007-02-28 11:17:02 +0000123};
124
125#endif