3 * Byungjae Lee, Samsung Erectronics, bjlee@samsung.com.
4 * - only support for S3C6400
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 #ifndef __USBD_HS_OTG_H__
23 #define __USBD_HS_OTG_H__
26 #include <asm/byteorder.h>
27 #include <asm/arch/usb-hs-otg.h>
29 #define make_word_c(w) __constant_cpu_to_le16(w)
30 #define make_word(w) __cpu_to_le16(w)
37 #define FS_CTRL_PKT_SIZE 8
38 #define FS_BULK_PKT_SIZE 64
40 #define HS_CTRL_PKT_SIZE 64
41 #define HS_BULK_PKT_SIZE 512
43 #define RX_FIFO_SIZE 512
44 #define NPTX_FIFO_START_ADDR RX_FIFO_SIZE
45 #define NPTX_FIFO_SIZE 512
46 #define PTX_FIFO_SIZE 512
48 /* string descriptor */
49 #define LANGID_US_L (0x09)
50 #define LANGID_US_H (0x04)
52 /* Feature Selectors */
54 #define DEVICE_REMOTE_WAKEUP 1
57 /* Test Mode Selector*/
60 #define TEST_SE0_NAK 3
62 #define TEST_FORCE_ENABLE 5
64 #define OTG_DIEPCTL_IN (OTG_DIEPCTL0 + 0x20 * BULK_IN_EP)
65 #define OTG_DIEPINT_IN (OTG_DIEPINT0 + 0x20 * BULK_IN_EP)
66 #define OTG_DIEPTSIZ_IN (OTG_DIEPTSIZ0 + 0x20 * BULK_IN_EP)
67 #define OTG_DIEPDMA_IN (OTG_DIEPDMA0 + 0x20 * BULK_IN_EP)
68 #define OTG_DOEPCTL_OUT (OTG_DOEPCTL0 + 0x20 * BULK_OUT_EP)
69 #define OTG_DOEPINT_OUT (OTG_DOEPINT0 + 0x20 * BULK_OUT_EP)
70 #define OTG_DOEPTSIZ_OUT (OTG_DOEPTSIZ0 + 0x20 * BULK_OUT_EP)
71 #define OTG_DOEPDMA_OUT (OTG_DOEPDMA0 + 0x20 * BULK_OUT_EP)
72 #define OTG_IN_FIFO (OTG_EP0_FIFO + 0x1000 * BULK_IN_EP)
73 #define OTG_OUT_FIFO (OTG_EP0_FIFO + 0x1000 * BULK_OUT_EP)
93 u8 bNumConfigurations;
94 } __attribute__ ((packed)) device_desc_t;
102 u8 bConfigurationValue;
106 } __attribute__ ((packed)) config_desc_t;
112 u8 bAlternateSetting;
115 u8 bInterfaceSubClass;
116 u8 bInterfaceProtocol;
118 } __attribute__ ((packed)) intf_desc_t;
128 } __attribute__ ((packed)) ep_desc_t;
134 } __attribute__ ((packed)) string_desc_t;
145 } __attribute__ ((packed)) device_req_t;
149 config_desc_t config;
155 } __attribute__ ((packed)) descriptors_t;
163 } __attribute__ ((packed)) get_status_t;
167 } __attribute__ ((packed)) get_intf_t;
174 USB_HIGH, USB_FULL, USB_LOW
178 EP_TYPE_CONTROL, EP_TYPE_ISOCHRONOUS, EP_TYPE_BULK, EP_TYPE_INTERRUPT
183 device_req_t dev_req;
189 u32 ctrl_max_pktsize;
190 u32 bulkin_max_pktsize;
191 u32 bulkout_max_pktsize;
200 } __attribute__ ((packed)) otg_dev_t;
202 enum DEV_REQUEST_DIRECTION {
203 HOST_TO_DEVICE = 0x00,
204 DEVICE_TO_HOST = 0x80
207 enum DEV_REQUEST_TYPE {
208 STANDARD_TYPE = 0x00,
214 enum DEV_REQUEST_RECIPIENT {
215 DEVICE_RECIPIENT = 0,
216 INTERFACE_RECIPIENT = 1,
217 ENDPOINT_RECIPIENT = 2,
221 enum DESCRIPTOR_TYPE {
222 DEVICE_DESCRIPTOR = 1,
223 CONFIGURATION_DESCRIPTOR = 2,
224 STRING_DESCRIPTOR = 3,
225 INTERFACE_DESCRIPTOR = 4,
226 ENDPOINT_DESCRIPTOR = 5,
227 DEVICE_QUALIFIER = 6,
228 OTHER_SPEED_CONFIGURATION = 7,
232 enum CONFIG_ATTRIBUTES {
233 CONF_ATTR_DEFAULT = 0x80,
234 CONF_ATTR_REMOTE_WAKEUP = 0x20,
235 CONF_ATTR_SELFPOWERED = 0x40
238 enum ENDPOINT_ATTRIBUTES {
241 EP_ATTR_CONTROL = 0x0,
242 EP_ATTR_ISOCHRONOUS = 0x1,
244 EP_ATTR_INTERRUPT = 0x3
247 enum STANDARD_REQUEST_CODE {
248 STANDARD_GET_STATUS = 0,
249 STANDARD_CLEAR_FEATURE = 1,
250 STANDARD_RESERVED_1 = 2,
251 STANDARD_SET_FEATURE = 3,
252 STANDARD_RESERVED_2 = 4,
253 STANDARD_SET_ADDRESS = 5,
254 STANDARD_GET_DESCRIPTOR = 6,
255 STANDARD_SET_DESCRIPTOR = 7,
256 STANDARD_GET_CONFIGURATION = 8,
257 STANDARD_SET_CONFIGURATION = 9,
258 STANDARD_GET_INTERFACE = 10,
259 STANDARD_SET_INTERFACE = 11,
260 STANDARD_SYNCH_FRAME = 12
263 int s5p_usbctl_init(void);
264 void s5p_udc_int_hndlr(void);
265 void s5p_usb_tx(char *tx_data, int tx_size);
266 int s5p_usb_detect_irq(void);
267 void s5p_usb_clear_irq(void);
269 /* in usbd-otg-hs.c */
270 extern unsigned int s5p_usbd_dn_addr;
271 extern unsigned int s5p_usbd_dn_cnt;
272 extern int s5p_got_header;
273 extern int s5p_receive_done;