2 * carl9170 firmware - used by the ar9170 wireless device
6 * Copyright (c) 2000-2005 ZyDAS Technology Corporation
7 * Copyright (c) 2007-2009 Atheros Communications, Inc.
8 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
9 * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; If not, see <http://www.gnu.org/licenses/>.
30 * NB: The firmware has to write into these structures
31 * so don't try to make them "const".
34 static struct ar9170_usb_config usb_config_highspeed = {
36 .bLength = USB_DT_CONFIG_SIZE,
37 .bDescriptorType = USB_DT_CONFIG,
38 .wTotalLength = cpu_to_le16(sizeof(usb_config_highspeed)),
40 .bConfigurationValue = 1,
42 .bmAttributes = USB_CONFIG_ATT_ONE |
43 #ifdef CONFIG_CARL9170FW_WOL
44 USB_CONFIG_ATT_WAKEUP |
45 #endif /* CONFIG_CARL9170FW_WOL */
47 .bMaxPower = 0xfa, /* 500 mA */
51 .bLength = USB_DT_INTERFACE_SIZE,
52 .bDescriptorType = USB_DT_INTERFACE,
53 .bInterfaceNumber = 0,
54 .bAlternateSetting = 0,
55 .bNumEndpoints = AR9170_USB_NUM_EXTRA_EP,
56 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
57 .bInterfaceSubClass = USB_SUBCLASS_VENDOR_SPEC,
58 .bInterfaceProtocol = 0,
64 .bLength = USB_DT_ENDPOINT_SIZE,
65 .bDescriptorType = USB_DT_ENDPOINT,
66 .bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_TX,
67 .bmAttributes = USB_ENDPOINT_XFER_BULK,
68 .wMaxPacketSize = cpu_to_le16(512),
73 .bLength = USB_DT_ENDPOINT_SIZE,
74 .bDescriptorType = USB_DT_ENDPOINT,
75 .bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_RX,
76 .bmAttributes = USB_ENDPOINT_XFER_BULK,
77 .wMaxPacketSize = cpu_to_le16(512),
82 .bLength = USB_DT_ENDPOINT_SIZE,
83 .bDescriptorType = USB_DT_ENDPOINT,
84 .bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_IRQ,
85 .bmAttributes = USB_ENDPOINT_XFER_INT,
86 .wMaxPacketSize = cpu_to_le16(64),
91 .bLength = USB_DT_ENDPOINT_SIZE,
92 .bDescriptorType = USB_DT_ENDPOINT,
93 .bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_CMD,
94 .bmAttributes = USB_ENDPOINT_XFER_INT,
95 .wMaxPacketSize = cpu_to_le16(64),
101 static struct ar9170_usb_config usb_config_fullspeed = {
103 .bLength = USB_DT_CONFIG_SIZE,
104 .bDescriptorType = USB_DT_CONFIG,
105 .wTotalLength = cpu_to_le16(sizeof(usb_config_fullspeed)),
107 .bConfigurationValue = 1,
109 .bmAttributes = USB_CONFIG_ATT_ONE |
110 #ifdef CONFIG_CARL9170FW_WOL
111 USB_CONFIG_ATT_WAKEUP |
112 #endif /* CONFIG_CARL9170FW_WOL */
114 .bMaxPower = 0xfa, /* 500 mA */
118 .bLength = USB_DT_INTERFACE_SIZE,
119 .bDescriptorType = USB_DT_INTERFACE,
120 .bInterfaceNumber = 0,
121 .bAlternateSetting = 0,
122 .bNumEndpoints = AR9170_USB_NUM_EXTRA_EP,
123 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
124 .bInterfaceSubClass = USB_SUBCLASS_VENDOR_SPEC,
125 .bInterfaceProtocol = 0,
131 .bLength = USB_DT_ENDPOINT_SIZE,
132 .bDescriptorType = USB_DT_ENDPOINT,
133 .bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_TX,
134 .bmAttributes = USB_ENDPOINT_XFER_BULK,
135 .wMaxPacketSize = cpu_to_le16(64),
140 .bLength = USB_DT_ENDPOINT_SIZE,
141 .bDescriptorType = USB_DT_ENDPOINT,
142 .bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_RX,
143 .bmAttributes = USB_ENDPOINT_XFER_BULK,
144 .wMaxPacketSize = cpu_to_le16(64),
149 .bLength = USB_DT_ENDPOINT_SIZE,
150 .bDescriptorType = USB_DT_ENDPOINT,
151 .bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_IRQ,
152 .bmAttributes = USB_ENDPOINT_XFER_INT,
153 .wMaxPacketSize = cpu_to_le16(64),
158 .bLength = USB_DT_ENDPOINT_SIZE,
159 .bDescriptorType = USB_DT_ENDPOINT,
160 .bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_CMD,
161 .bmAttributes = USB_ENDPOINT_XFER_BULK,
162 .wMaxPacketSize = cpu_to_le16(64),
168 void usb_reset_eps(void)
172 /* clear all EPs' toggle bit */
173 for (i = 1; i < __AR9170_USB_NUM_MAX_EP; i++) {
174 usb_set_input_ep_toggle(i);
175 usb_clear_input_ep_toggle(i);
176 usb_clear_input_ep_stall(i);
180 * NB: I've no idea why this cannot be integrated into the
183 for (i = 1; i < __AR9170_USB_NUM_MAX_EP; i++) {
184 usb_set_output_ep_toggle(i);
185 usb_clear_output_ep_toggle(i);
186 usb_clear_output_ep_stall(i);
190 static void usb_pta_init(void)
192 unsigned int usb_dma_ctrl = 0;
193 /* Set PTA mode to USB */
194 andl(AR9170_PTA_REG_DMA_MODE_CTRL,
195 ~AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB);
197 /* Do a software reset to PTA component */
198 orl(AR9170_PTA_REG_DMA_MODE_CTRL, AR9170_PTA_DMA_MODE_CTRL_RESET);
199 andl(AR9170_PTA_REG_DMA_MODE_CTRL, ~AR9170_PTA_DMA_MODE_CTRL_RESET);
201 if (usb_detect_highspeed()) {
202 fw.usb.os_cfg_desc = &usb_config_fullspeed;
203 fw.usb.cfg_desc = &usb_config_highspeed;
205 /* 512 Byte DMA transfers */
206 usb_dma_ctrl |= AR9170_USB_DMA_CTL_HIGH_SPEED;
208 fw.usb.cfg_desc = &usb_config_fullspeed;
209 fw.usb.os_cfg_desc = &usb_config_highspeed;
212 #ifdef CONFIG_CARL9170FW_USB_UP_STREAM
213 # if (CONFIG_CARL9170FW_RX_FRAME_LEN == 4096)
214 usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_4K;
215 # elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 8192)
216 usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_8K;
217 # elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 16384)
218 usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_16K;
219 # elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 32768)
220 usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_32K;
222 # error "Invalid AR9170_RX_FRAME_LEN setting"
225 #else /* CONFIG_CARL9170FW_USB_UP_STREAM */
226 usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_PACKET_MODE;
227 #endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
229 #ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM
230 /* Enable down stream mode */
231 usb_dma_ctrl |= AR9170_USB_DMA_CTL_DOWN_STREAM;
232 #endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */
234 #ifdef CONFIG_CARL9170FW_USB_UP_STREAM
235 /* Set the up stream mode maximum aggregate number */
236 set(AR9170_USB_REG_MAX_AGG_UPLOAD, 4);
239 * Set the up stream mode timeout value.
240 * NB: The vendor driver (otus) set 0x80?
242 set(AR9170_USB_REG_UPLOAD_TIME_CTL, 0x80);
243 #endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
245 /* Enable up stream and down stream */
246 usb_dma_ctrl |= AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE |
247 AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE;
249 set(AR9170_USB_REG_DMA_CTL, usb_dma_ctrl);
258 * The fw structure is always initialized with "0"
259 * during boot(); No need to waste precious bytes here.
261 * fw.usb.interface_setting = 0;
262 * fw.usb.alternate_interface_setting = 0;
263 * fw.usb.device_feature = 0;
266 #ifdef CONFIG_CARL9170FW_WOL
267 fw.usb.device_feature |= USB_DEVICE_REMOTE_WAKEUP;
268 usb_enable_remote_wakeup();
269 #endif /* CONFIG_CARL9170FW_WOL */
272 #define GET_ARRAY(a, o) ((uint32_t *) (((unsigned long) data) + offset))
274 static void usb_ep0rx_data(const void *data, const unsigned int len)
279 BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
280 BUILD_BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
282 for (offset = 0; offset < ((len + 3) & ~3); offset += 4) {
283 value = get(AR9170_USB_REG_EP0_DATA);
284 memcpy(GET_ARRAY(data, offset), &value,
285 min(len - offset, (unsigned int)4));
289 static int usb_ep0tx_data(const void *data, const unsigned int len)
291 unsigned int offset = 0, block, last_block = 0;
294 BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
295 BUILD_BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
297 block = min(len, (unsigned int) 4);
299 while (offset < len) {
301 if (last_block != block || block < 4)
302 setb(AR9170_USB_REG_FIFO_SIZE, (1 << block) - 1);
304 memcpy(&value, GET_ARRAY(data, offset), block);
306 set(AR9170_USB_REG_EP0_DATA, value);
309 last_block = block = min(len - offset, (unsigned int) 4);
312 setb(AR9170_USB_REG_FIFO_SIZE, 0xf);
314 /* this will push the data to the host */
319 #ifdef CONFIG_CARL9170FW_USB_STANDARD_CMDS
320 static int usb_get_status(const struct usb_ctrlrequest *ctrl)
322 __le16 status = cpu_to_le16(fw.usb.device_feature);
324 if ((ctrl->bRequestType & USB_DIR_MASK) != USB_DIR_IN)
327 switch (ctrl->bRequestType & USB_RECIP_MASK) {
328 case USB_RECIP_DEVICE:
329 status &= cpu_to_le16(~USB_DEVICE_SELF_POWERED);
330 status &= cpu_to_le16(~USB_DEVICE_REMOTE_WAKEUP);
333 case USB_RECIP_INTERFACE:
334 /* USB spec: This is reserved for future use. */
335 status = cpu_to_le16(0);
338 case USB_RECIP_ENDPOINT: {
339 unsigned int ep = le16_to_cpu(ctrl->wIndex) & 0xf;
340 unsigned int dir = le16_to_cpu(ctrl->wIndex) & USB_DIR_MASK;
343 status = !!(getb(AR9170_USB_REG_CX_CONFIG_STATUS) & BIT(2));
347 if (dir == USB_DIR_IN)
348 addr = AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH;
350 addr = AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH;
355 * AR9170_USB_EP_OUT_STALL == AR9170_USB_EP_IN_STALL
356 * so it doesn't matter which one we use
358 status = !!(getb(addr) & AR9170_USB_EP_OUT_STALL);
362 case USB_RECIP_OTHER:
367 return usb_ep0tx_data((const void *) &status, sizeof(status));
370 static int usb_get_string_desc(const struct usb_ctrlrequest *ctrl)
372 const struct usb_string_descriptor *string_desc = NULL;
374 switch (le16_to_cpu(ctrl->wValue) & 0xff) {
376 string_desc = (const struct usb_string_descriptor *)
377 rom.hw.usb.string0_desc;
381 string_desc = (const struct usb_string_descriptor *)
382 rom.hw.usb.string1_desc;
386 string_desc = (const struct usb_string_descriptor *)
387 rom.hw.usb.string2_desc;
391 string_desc = (const struct usb_string_descriptor *)
392 rom.hw.usb.string3_desc;
400 return usb_ep0tx_data(string_desc, string_desc->bLength);
405 static int usb_get_device_desc(const struct usb_ctrlrequest *ctrl __unused)
407 return usb_ep0tx_data(&rom.hw.usb.device_desc,
408 rom.hw.usb.device_desc.bLength);
411 static int usb_get_config_desc(const struct usb_ctrlrequest *ctrl __unused)
413 fw.usb.cfg_desc->cfg.bDescriptorType = USB_DT_CONFIG;
415 return usb_ep0tx_data(fw.usb.cfg_desc,
416 le16_to_cpu(fw.usb.cfg_desc->cfg.wTotalLength));
419 #ifdef CONFIG_CARL9170FW_USB_MODESWITCH
420 static int usb_get_otherspeed_desc(const struct usb_ctrlrequest *ctrl __unused)
423 fw.usb.os_cfg_desc->cfg.bDescriptorType = USB_DT_OTHER_SPEED_CONFIG;
425 return usb_ep0tx_data(fw.usb.os_cfg_desc,
426 le16_to_cpu(fw.usb.os_cfg_desc->cfg.wTotalLength));
428 #endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
430 static int usb_get_qualifier_desc(const struct usb_ctrlrequest *ctrl __unused)
432 struct usb_qualifier_descriptor qual;
435 * The qualifier descriptor shares some structural details
436 * with the main device descriptor.
439 memcpy(&qual, &rom.hw.usb.device_desc, sizeof(qual));
441 /* (Re)-Initialize fields */
442 qual.bDescriptorType = USB_DT_DEVICE_QUALIFIER;
443 qual.bLength = sizeof(qual);
444 qual.bNumConfigurations = rom.hw.usb.device_desc.bNumConfigurations;
447 return usb_ep0tx_data(&qual, qual.bLength);
450 #define USB_CHECK_REQTYPE(ctrl, recip, dir) \
451 (((ctrl->bRequestType & USB_RECIP_MASK) != recip) || \
452 ((ctrl->bRequestType & USB_DIR_MASK) != dir))
454 static int usb_get_descriptor(const struct usb_ctrlrequest *ctrl)
458 if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_IN))
461 switch (le16_to_cpu(ctrl->wValue) >> 8) {
463 status = usb_get_device_desc(ctrl);
467 status = usb_get_config_desc(ctrl);
471 status = usb_get_string_desc(ctrl);
474 case USB_DT_INTERFACE:
477 case USB_DT_ENDPOINT:
480 case USB_DT_DEVICE_QUALIFIER:
481 status = usb_get_qualifier_desc(ctrl);
484 #ifdef CONFIG_CARL9170FW_USB_MODESWITCH
485 case USB_DT_OTHER_SPEED_CONFIG:
486 status = usb_get_otherspeed_desc(ctrl);
488 #endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
497 static int usb_get_configuration(const struct usb_ctrlrequest *ctrl)
499 if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_IN))
502 return usb_ep0tx_data(&fw.usb.config, fw.usb.config);
505 static int usb_set_configuration(const struct usb_ctrlrequest *ctrl)
509 if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_OUT))
512 config = le16_to_cpu(ctrl->wValue);
516 andb(AR9170_USB_REG_DEVICE_ADDRESS,
517 (uint8_t) ~(AR9170_USB_DEVICE_ADDRESS_CONFIGURE));
520 fw.usb.config = config;
522 #ifdef CONFIG_CARL9170FW_USB_MODESWITCH
523 if (usb_detect_highspeed()) {
524 /* High Speed Configuration */
525 usb_init_highspeed_fifo_cfg();
527 /* Full Speed Configuration */
528 usb_init_fullspeed_fifo_cfg();
530 /* usb_pta_init() ? */
531 #endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
534 orb(AR9170_USB_REG_DEVICE_ADDRESS,
535 (AR9170_USB_DEVICE_ADDRESS_CONFIGURE));
537 usb_enable_global_int();
546 static int usb_set_address(const struct usb_ctrlrequest *ctrl)
548 unsigned int address;
550 if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_OUT))
553 address = le16_to_cpu(ctrl->wValue);
556 * The original firmware used 0x100 (which is, of course,
557 * too big to fit into uint8_t).
558 * However based on the available information (hw.h), BIT(7)
559 * is used as some sort of flag and should not be
560 * part of the device address.
562 if (address >= BIT(7))
565 setb(AR9170_USB_REG_DEVICE_ADDRESS, (uint8_t) address);
569 static int usb_get_interface(const struct usb_ctrlrequest *ctrl)
571 if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_INTERFACE, USB_DIR_IN))
574 if (usb_configured() == false)
577 switch (fw.usb.config) {
585 return usb_ep0tx_data(&fw.usb.alternate_interface_setting, 1);
588 static int usb_manipulate_feature(const struct usb_ctrlrequest *ctrl, bool __unused clear)
590 unsigned int feature;
592 if ((ctrl->bRequestType & USB_DIR_MASK) != USB_DIR_OUT)
595 if (usb_configured() == false)
598 feature = le16_to_cpu(ctrl->wValue);
600 switch (ctrl->bRequestType & USB_RECIP_MASK) {
601 case USB_RECIP_DEVICE: {
602 #ifdef CONFIG_CARL9170FW_WOL
603 if (feature & USB_DEVICE_REMOTE_WAKEUP) {
605 usb_disable_remote_wakeup();
607 usb_enable_remote_wakeup();
609 #endif /* CONFIG_CARL9170FW_WOL */
612 fw.usb.device_feature &= ~feature;
614 fw.usb.device_feature |= feature;
620 case USB_RECIP_ENDPOINT: {
621 unsigned int ep, dir;
623 ep = le16_to_cpu(ctrl->wIndex) & 0xf;
624 dir = le16_to_cpu(ctrl->wIndex) & USB_DIR_MASK;
626 /* According to the spec, EP cannot be stopped this way. */
631 if (dir == USB_DIR_IN)
632 addr = AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH;
634 addr = AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH;
639 andb(addr, ~AR9170_USB_EP_OUT_STALL);
641 orb(addr, AR9170_USB_EP_OUT_STALL);
646 case USB_RECIP_INTERFACE:
648 * the current USB Specification Revision 2
649 * specifies no interface features.
659 #ifdef CONFIG_CARL9170FW_USB_MODESWITCH
660 static int usb_set_interface(const struct usb_ctrlrequest *ctrl)
662 unsigned int intf, alt_intf;
663 if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_INTERFACE, USB_DIR_OUT))
666 if (usb_configured() == false)
669 intf = le16_to_cpu(ctrl->wIndex);
670 alt_intf = le16_to_cpu(ctrl->wValue);
674 if (alt_intf != fw.usb.cfg_desc->intf.bAlternateSetting)
677 fw.usb.interface_setting = (uint8_t) intf;
678 fw.usb.alternate_interface_setting = (uint8_t) alt_intf;
679 if (usb_detect_highspeed())
680 usb_init_highspeed_fifo_cfg();
682 usb_init_fullspeed_fifo_cfg();
685 usb_enable_global_int();
693 #endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
694 #endif /* CONFIG_CARL9170FW_USB_STANDARD_CMDS */
696 static int usb_standard_command(const struct usb_ctrlrequest *ctrl __unused)
700 #ifdef CONFIG_CARL9170FW_USB_STANDARD_CMDS
701 switch (ctrl->bRequest) {
702 case USB_REQ_GET_STATUS:
703 status = usb_get_status(ctrl);
706 case USB_REQ_CLEAR_FEATURE:
707 case USB_REQ_SET_FEATURE:
708 status = usb_manipulate_feature(ctrl, ctrl->bRequest == USB_REQ_CLEAR_FEATURE);
711 case USB_REQ_SET_ADDRESS:
712 status = usb_set_address(ctrl);
715 case USB_REQ_GET_DESCRIPTOR:
716 status = usb_get_descriptor(ctrl);
719 case USB_REQ_SET_DESCRIPTOR:
722 case USB_REQ_GET_CONFIGURATION:
723 status = usb_get_configuration(ctrl);
726 case USB_REQ_SET_CONFIGURATION:
727 status = usb_set_configuration(ctrl);
730 case USB_REQ_GET_INTERFACE:
731 status = usb_get_interface(ctrl);
734 case USB_REQ_SET_INTERFACE:
735 #ifdef CONFIG_CARL9170FW_USB_MODESWITCH
736 status = usb_set_interface(ctrl);
737 #endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
740 case USB_REQ_SYNCH_FRAME:
747 #endif /* CONFIG_CARL9170FW_USB_STANDARD_CMDS */
752 static int usb_class_command(const struct usb_ctrlrequest *ctrl __unused)
757 static int usb_vendor_command(const struct usb_ctrlrequest *ctrl __unused)
760 * Note: Firmware upload/boot is not implemented.
761 * It's impossible to replace the current image
768 #undef USB_CHECK_TYPE
770 void usb_ep0setup(void)
772 struct usb_ctrlrequest ctrl;
774 usb_ep0rx_data(&ctrl, sizeof(ctrl));
776 switch (ctrl.bRequestType & USB_TYPE_MASK) {
777 case USB_TYPE_STANDARD:
778 status = usb_standard_command(&ctrl);
782 status = usb_class_command(&ctrl);
785 case USB_TYPE_VENDOR:
786 status = usb_vendor_command(&ctrl);
795 fw.usb.ep0_action |= CARL9170_EP0_STALL;
796 #ifdef CONFIG_CARL9170FW_USB_STANDARD_CMDS
798 fw.usb.ep0_action |= CARL9170_EP0_TRIGGER;
799 #endif /* CONFIG_CARL9170FW_USB_STANDARD_CMDS */
804 if (BUG_ON(!fw.usb.ep0_txrx_buffer || !fw.usb.ep0_txrx_len))
807 usb_ep0rx_data(fw.usb.ep0_txrx_buffer, fw.usb.ep0_txrx_len);
808 fw.usb.ep0_txrx_pos = fw.usb.ep0_txrx_len;
813 if (BUG_ON(!fw.usb.ep0_txrx_buffer || !fw.usb.ep0_txrx_len))
816 usb_ep0tx_data(fw.usb.ep0_txrx_buffer, fw.usb.ep0_txrx_len);
817 fw.usb.ep0_txrx_pos = fw.usb.ep0_txrx_len;