Lines Matching +full:dma +full:- +full:byte +full:- +full:en

4  * We call the USB code inside a Linux-based peripheral device a "gadget"
5 * driver, except for the hardware-specific bus glue. One USB host can
9 * (C) Copyright 2002-2004 by David Brownell
14 * Ported to U-Boot by: Thomas Smits <ts.smits@gmail.com> and
29 * struct usb_request - describes one i/o request
31 * only use PIO, or don't use DMA for some endpoints.
32 * @dma: DMA address corresponding to 'buf'. If you don't set this
39 * directly by DMA controllers.
45 * its buffer may be re-used.
57 * Code "-ESHUTDOWN" indicates completion caused by device disconnect,
64 * reside in a device-side FIFO when the request is reported as
68 * hardware's driver can add extra per-request data to the memory it returns,
79 * transfers. interrupt-only endpoints can be much less functional.
82 * it's thinner and promotes more pre-allocation.
88 dma_addr_t dma; member
104 /*-------------------------------------------------------------------------*/
106 /* endpoint-specific parts of the api to the usb controller hardware.
133 * struct usb_ep - device side representation of USB endpoint
134 * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
135 * @ops: Function pointers used to access hardware-specific operations.
144 * by this EP (0 - 16, actual number is 2^n)
147 * read-only to gadget drivers.
154 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
170 /*-------------------------------------------------------------------------*/
173 * usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint
183 ep->maxpacket_limit = maxpacket_limit; in usb_ep_set_maxpacket_limit()
184 ep->maxpacket = maxpacket_limit; in usb_ep_set_maxpacket_limit()
188 * usb_ep_enable - configure endpoint, making it usable
192 * remains valid until the endpoint is disabled; the data byte order
193 * is little-endian (usb-standard).
202 * for it. for example, an endpoint named "ep2in-bulk" would be usable
205 * configurable, with more generic names like "ep-a". (remember that for
213 return ep->ops->enable(ep, desc); in usb_ep_enable()
217 * usb_ep_disable - endpoint is no longer usable
222 * indicating disconnect (-ESHUTDOWN) before this call returns.
230 return ep->ops->disable(ep); in usb_ep_disable()
234 * usb_ep_alloc_request - allocate a request object to use with this endpoint
239 * need controller-specific setup and may even need endpoint-specific
240 * resources such as allocation of DMA descriptors.
250 return ep->ops->alloc_request(ep, gfp_flags); in usb_ep_alloc_request()
254 * usb_ep_free_request - frees a request object
265 ep->ops->free_request(ep, req); in usb_ep_free_request()
269 * usb_ep_queue - queues (submits) an I/O request to an endpoint.
273 * pre-allocate all necessary memory with the request.
287 * Drivers can rely on the fact that the first byte of the request's buffer
288 * always corresponds to the first byte of some USB packet, for both
298 * won't support every interrupt transfer. (Such as 768 byte packets.)
300 * Interrupt-only endpoints are less functional than bulk endpoints, for
325 return ep->ops->queue(ep, req, gfp_flags); in usb_ep_queue()
329 * usb_ep_dequeue - dequeues (cancels, unlinks) an I/O request from an endpoint
334 * completion routine is called (with status -ECONNRESET); else a negative
344 return ep->ops->dequeue(ep, req); in usb_ep_dequeue()
348 * usb_ep_set_halt - sets the endpoint halt feature.
349 * @ep: the non-isochronous endpoint being stalled
364 * Attempts to halt IN endpoints will fail (returning -EAGAIN) if any
370 return ep->ops->set_halt(ep, 1); in usb_ep_set_halt()
374 * usb_ep_clear_halt - clears endpoint halt, and resets toggle
388 return ep->ops->set_halt(ep, 0); in usb_ep_clear_halt()
392 * usb_ep_fifo_status - returns number of bytes in fifo, or error
408 if (ep->ops->fifo_status) in usb_ep_fifo_status()
409 return ep->ops->fifo_status(ep); in usb_ep_fifo_status()
411 return -EOPNOTSUPP; in usb_ep_fifo_status()
415 * usb_ep_fifo_flush - flushes contents of a fifo
425 if (ep->ops->fifo_flush) in usb_ep_fifo_flush()
426 ep->ops->fifo_flush(ep); in usb_ep_fifo_flush()
430 /*-------------------------------------------------------------------------*/
453 * struct usb_gadget - represents a usb slave device
454 * @ops: Function pointers used to access hardware-specific operations.
463 * @is_otg: true if the USB device port uses a Mini-AB jack, so that the
466 * is in the Mini-AB jack, and HNP has been used to switch roles
467 * so that the "A" device currently acts as A-Peripheral, not A-Host.
468 * @a_hnp_support: OTG device feature flag, indicating that the A-Host
470 * @a_alt_hnp_support: OTG device feature flag, indicating that the A-Host
472 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
480 * Gadgets have a mostly-portable "gadget driver" implementing device
482 * drivers talk to hardware-specific code indirectly, through ops vectors.
488 * read-only to the gadget driver. That driver data is part of the
496 * device is acting as a B-Peripheral (so is_a_peripheral is false).
519 gadget->dev.driver_data = data; in set_gadget_data()
524 return gadget->dev.driver_data; in get_gadget_data()
532 /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
534 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
538 * gadget_is_dualspeed - return true iff the hardware handles high speed
544 /* runtime test would check "g->is_dualspeed" ... that might be in gadget_is_dualspeed()
554 * gadget_is_otg - return true iff the hardware is OTG-ready
555 * @g: controller that might have a Mini-AB connector
557 * This is a runtime test, since kernels with a USB-OTG stack sometimes
558 * run on boards which only have a Mini-B (or Mini-A) connector.
563 return g->is_otg; in gadget_is_otg()
570 * usb_gadget_frame_number - returns the current frame number
578 return gadget->ops->get_frame(gadget); in usb_gadget_frame_number()
582 * usb_gadget_wakeup - tries to wake up the host connected to this gadget
596 if (!gadget->ops->wakeup) in usb_gadget_wakeup()
597 return -EOPNOTSUPP; in usb_gadget_wakeup()
598 return gadget->ops->wakeup(gadget); in usb_gadget_wakeup()
602 * usb_gadget_set_selfpowered - sets the device selfpowered feature.
603 * @gadget:the device being declared as self-powered
612 if (!gadget->ops->set_selfpowered) in usb_gadget_set_selfpowered()
613 return -EOPNOTSUPP; in usb_gadget_set_selfpowered()
614 return gadget->ops->set_selfpowered(gadget, 1); in usb_gadget_set_selfpowered()
618 * usb_gadget_clear_selfpowered - clear the device selfpowered feature.
619 * @gadget:the device being declared as bus-powered
622 * some hardware may not support bus-powered operation, in which
629 if (!gadget->ops->set_selfpowered) in usb_gadget_clear_selfpowered()
630 return -EOPNOTSUPP; in usb_gadget_clear_selfpowered()
631 return gadget->ops->set_selfpowered(gadget, 0); in usb_gadget_clear_selfpowered()
635 * usb_gadget_vbus_connect - Notify controller that VBUS is powered
640 * resuming the controller, activating the D+ (or D-) pullup to let the
648 if (!gadget->ops->vbus_session) in usb_gadget_vbus_connect()
649 return -EOPNOTSUPP; in usb_gadget_vbus_connect()
650 return gadget->ops->vbus_session(gadget, 1); in usb_gadget_vbus_connect()
654 * usb_gadget_vbus_draw - constrain controller's VBUS power usage
667 if (!gadget->ops->vbus_draw) in usb_gadget_vbus_draw()
668 return -EOPNOTSUPP; in usb_gadget_vbus_draw()
669 return gadget->ops->vbus_draw(gadget, mA); in usb_gadget_vbus_draw()
673 * usb_gadget_vbus_disconnect - notify controller about VBUS session end
684 if (!gadget->ops->vbus_session) in usb_gadget_vbus_disconnect()
685 return -EOPNOTSUPP; in usb_gadget_vbus_disconnect()
686 return gadget->ops->vbus_session(gadget, 0); in usb_gadget_vbus_disconnect()
690 * usb_gadget_connect - software-controlled connect to USB host
693 * Enables the D+ (or potentially D-) pullup. The host will start
702 if (!gadget->ops->pullup) in usb_gadget_connect()
703 return -EOPNOTSUPP; in usb_gadget_connect()
704 return gadget->ops->pullup(gadget, 1); in usb_gadget_connect()
708 * usb_gadget_disconnect - software-controlled disconnect from USB host
711 * Disables the D+ (or potentially D-) pullup, which the host may see
724 if (!gadget->ops->pullup) in usb_gadget_disconnect()
725 return -EOPNOTSUPP; in usb_gadget_disconnect()
726 return gadget->ops->pullup(gadget, 0); in usb_gadget_disconnect()
730 /*-------------------------------------------------------------------------*/
733 * struct usb_gadget_driver - driver for usb 'slave' devices
739 * the currently-available endpoints.
745 * USB byte order. Called in_interrupt; this may not sleep. Driver
763 * If gadget->is_otg is true, the gadget driver must provide an OTG
769 * Drivers use hardware-specific knowledge to configure the usb hardware.
798 * local controls (buttons, dials, etc) may need to be re-enabled since
817 /*-------------------------------------------------------------------------*/
822 * these will usually be implemented directly by the hardware-dependent
827 * usb_gadget_register_driver - register a gadget driver
840 * usb_gadget_unregister_driver - unregister a gadget driver
858 /*-------------------------------------------------------------------------*/
863 * struct usb_gadget_strings - a set of USB strings in a given language
864 * @language:identifies the strings' language (0x0409 for en-us)
871 u16 language; /* 0x0409 for en-us */
878 /*-------------------------------------------------------------------------*/
890 /*-------------------------------------------------------------------------*/
891 /* utility to simplify map/unmap of usb_requests to/from DMA */
899 /*-------------------------------------------------------------------------*/
906 /*-------------------------------------------------------------------------*/
912 /*-------------------------------------------------------------------------*/
919 /*-------------------------------------------------------------------------*/