Lines Matching +full:tx +full:- +full:fifo +full:- +full:max +full:- +full:num
1 // SPDX-License-Identifier: GPL-2.0
121 /*-------------------------------------------------------------------------*/
123 __raw_readl(aspeed_udc->udc_base + (offset))
125 __raw_writel((u32)val, aspeed_udc->udc_base + (offset))
131 /*-------------------------------------------------------------------------*/
148 ep_reg = aspeed_udc->udc_base + AST_EP_BASE + in udc_stall_ep()
149 (AST_EP_OFFSET * (ep_num - 1)); in udc_stall_ep()
162 struct urb *urb = endpoint->tx_urb; in udc_endpoint_write()
171 return -1; in udc_endpoint_write()
174 ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; in udc_endpoint_write()
175 ep_reg = aspeed_udc->udc_base + AST_EP_BASE + (AST_EP_OFFSET * (ep_num - 1)); in udc_endpoint_write()
176 remaining_packet = urb->actual_length - endpoint->sent; in udc_endpoint_write()
178 if (endpoint->tx_packetSize < remaining_packet) in udc_endpoint_write()
179 length = endpoint->tx_packetSize; in udc_endpoint_write()
184 // ep_num, length, endpoint->sent, urb->actual_length); in udc_endpoint_write()
186 data = (u8 *)urb->buffer; in udc_endpoint_write()
187 data += endpoint->sent; in udc_endpoint_write()
189 // tx trigger in udc_endpoint_write()
195 endpoint->last = length; in udc_endpoint_write()
197 // wait for tx complete in udc_endpoint_write()
199 if (timeout-- == 0) in udc_endpoint_write()
200 return -1; in udc_endpoint_write()
214 ep_isout = (endpoint->endpoint_address & USB_ENDPOINT_DIR_MASK) == in aspeed_udc_ep_handle()
216 ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; in aspeed_udc_ep_handle()
218 ep_reg = aspeed_udc->udc_base + AST_EP_BASE + (AST_EP_OFFSET * (ep_num - 1)); in aspeed_udc_ep_handle()
242 urb = endpoint->rcv_urb; in aspeed_udc_ep0_rx()
248 buff = urb->buffer; in aspeed_udc_ep0_rx()
260 if ((ep0_urb->device_request.bmRequestType & USB_REQ_DIRECTION_MASK) == in aspeed_udc_ep0_out()
266 usbdbg("EP0 OUT packet ACK, sent zero-length packet"); in aspeed_udc_ep0_out()
281 urb = endpoint->tx_urb; in aspeed_udc_ep0_tx()
287 usbdbg("urb->buffer: %p, buffer_length: %d, actual_length: %d, sent:%d", in aspeed_udc_ep0_tx()
288 urb->buffer, urb->buffer_length, in aspeed_udc_ep0_tx()
289 urb->actual_length, endpoint->sent); in aspeed_udc_ep0_tx()
291 last = min((int)(urb->actual_length - endpoint->sent), in aspeed_udc_ep0_tx()
292 (int)endpoint->tx_packetSize); in aspeed_udc_ep0_tx()
295 u8 *cp = urb->buffer + endpoint->sent; in aspeed_udc_ep0_tx()
300 * This ensures that USBD packet fifo is accessed in aspeed_udc_ep0_tx()
301 * - through word aligned pointer or in aspeed_udc_ep0_tx()
302 * - through non word aligned pointer but only in aspeed_udc_ep0_tx()
303 * with a max length to make the next packet in aspeed_udc_ep0_tx()
308 endpoint->sent, endpoint->tx_packetSize, last); in aspeed_udc_ep0_tx()
312 // trigger tx in aspeed_udc_ep0_tx()
317 endpoint->last = last; in aspeed_udc_ep0_tx()
322 struct usb_device_request *request = &ep0_urb->device_request; in aspeed_udc_ep0_in()
327 if ((request->bmRequestType & USB_REQ_DIRECTION_MASK) == in aspeed_udc_ep0_in()
330 * This tx interrupt must be for a control write status in aspeed_udc_ep0_in()
336 * This tx interrupt must be for a control read data in aspeed_udc_ep0_in()
339 int wLength = le16_to_cpu(request->wLength); in aspeed_udc_ep0_in()
345 endpoint->sent += endpoint->last; in aspeed_udc_ep0_in()
349 * all of the bytes in our tx urb (urb->actual_length) in aspeed_udc_ep0_in()
350 * unless we need a zero-length terminating packet. We in aspeed_udc_ep0_in()
351 * need a zero-length terminating packet if we returned in aspeed_udc_ep0_in()
354 * multiple of the packet size endpoint->tx_packetSize. in aspeed_udc_ep0_in()
356 if (endpoint->sent == ep0_urb->actual_length && in aspeed_udc_ep0_in()
357 (ep0_urb->actual_length == wLength || in aspeed_udc_ep0_in()
358 endpoint->last != endpoint->tx_packetSize)) { in aspeed_udc_ep0_in()
362 endpoint->rcv_urb = ep0_urb; in aspeed_udc_ep0_in()
363 endpoint->sent = 0; in aspeed_udc_ep0_in()
370 * need a zero-length terminating packet. in aspeed_udc_ep0_in()
381 u32 *setup = (u32 *)(aspeed_udc->udc_base + AST_VHUB_SETUP_DATA0); in aspeed_udc_setup_handle()
382 u8 *datap = (u8 *)&ep0_urb->device_request; in aspeed_udc_setup_handle()
384 usbdbg("-> Entering device setup"); in aspeed_udc_setup_handle()
398 if ((ep0_urb->device_request.bmRequestType & USB_REQ_DIRECTION_MASK) == in aspeed_udc_setup_handle()
400 switch (ep0_urb->device_request.bRequest) { in aspeed_udc_setup_handle()
402 usbdbg("set addr: %x", ep0_urb->device_request.wValue); in aspeed_udc_setup_handle()
403 ast_udc_write(ep0_urb->device_request.wValue, in aspeed_udc_setup_handle()
418 if (ep0_urb->device_request.wLength) { in aspeed_udc_setup_handle()
419 endpoint->rcv_urb = ep0_urb; in aspeed_udc_setup_handle()
420 endpoint->sent = 0; in aspeed_udc_setup_handle()
424 // send zero-length IN packet in aspeed_udc_setup_handle()
435 * packet data in ep0_urb->buffer and the packet length in in aspeed_udc_setup_handle()
436 * ep0_urb->actual_length. in aspeed_udc_setup_handle()
438 endpoint->tx_urb = ep0_urb; in aspeed_udc_setup_handle()
439 endpoint->sent = 0; in aspeed_udc_setup_handle()
443 usbdbg("<- Leaving device setup"); in aspeed_udc_setup_handle()
476 aspeed_udc_ep0_in(udc_device->bus->endpoint_array); in udc_irq()
482 aspeed_udc_ep0_out(udc_device->bus->endpoint_array); in udc_irq()
498 aspeed_udc_setup_handle(udc_device->bus->endpoint_array); in udc_irq()
535 aspeed_udc_ep_handle(udc_device->bus->endpoint_array + i + 1); in udc_irq()
582 ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; in udc_setup_ep()
584 usberr("Error: ep num is out-of-range %d", ep_num); in udc_setup_ep()
593 ep_addr = endpoint->endpoint_address; in udc_setup_ep()
595 ep_type = ep_isout ? endpoint->rcv_attributes : endpoint->tx_attributes; in udc_setup_ep()
596 ep_size = ep_isout ? endpoint->rcv_packetSize : endpoint->tx_packetSize; in udc_setup_ep()
598 usbdbg("addr %x, num %d, dir %s, type %s, packet size %d", in udc_setup_ep()
635 ep_reg = aspeed_udc->udc_base + AST_EP_BASE + (AST_EP_OFFSET * (ep_num - 1)); in udc_setup_ep()
643 ast_ep_write(ep_reg, endpoint->rcv_urb->buffer, AST_EP_DMA_BUFF); in udc_setup_ep()
647 ast_ep_write(ep_reg, endpoint->tx_urb->buffer, AST_EP_DMA_BUFF); in udc_setup_ep()
674 udc_device->bus->endpoint_array); in udc_enable()
715 return -1; in udc_init()
760 aspeed_udc->udc_base = (u32)devfdt_get_addr_index(dev, 0); in aspeed_udc_ofdata_to_platdata()
766 { .compatible = "aspeed,ast2600-usb-vhub" },