Lines Matching +full:hnp +full:- +full:disable
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
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.
104 /*-------------------------------------------------------------------------*/
106 /* endpoint-specific parts of the api to the usb controller hardware.
116 int (*disable) (struct usb_ep *ep); member
133 * struct usb_ep_caps - endpoint capabilities description
151 * struct usb_ep - device side representation of USB endpoint
152 * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
153 * @ops: Function pointers used to access hardware-specific operations.
163 * by this EP (0 - 16, actual number is 2^n)
166 * read-only to gadget drivers.
173 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
190 /*-------------------------------------------------------------------------*/
193 * usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint
203 ep->maxpacket_limit = maxpacket_limit; in usb_ep_set_maxpacket_limit()
204 ep->maxpacket = maxpacket_limit; in usb_ep_set_maxpacket_limit()
208 * usb_ep_enable - configure endpoint, making it usable
213 * is little-endian (usb-standard).
216 * will enable or disable the relevant endpoints. while it is enabled, an
222 * for it. for example, an endpoint named "ep2in-bulk" would be usable
225 * configurable, with more generic names like "ep-a". (remember that for
233 return ep->ops->enable(ep, desc); in usb_ep_enable()
237 * usb_ep_disable - endpoint is no longer usable
242 * indicating disconnect (-ESHUTDOWN) before this call returns.
250 return ep->ops->disable(ep); in usb_ep_disable()
254 * usb_ep_alloc_request - allocate a request object to use with this endpoint
259 * need controller-specific setup and may even need endpoint-specific
270 return ep->ops->alloc_request(ep, gfp_flags); in usb_ep_alloc_request()
274 * usb_ep_free_request - frees a request object
285 ep->ops->free_request(ep, req); in usb_ep_free_request()
289 * usb_ep_queue - queues (submits) an I/O request to an endpoint.
293 * pre-allocate all necessary memory with the request.
320 * Interrupt-only endpoints are less functional than bulk endpoints, for
345 return ep->ops->queue(ep, req, gfp_flags); in usb_ep_queue()
349 * usb_ep_dequeue - dequeues (cancels, unlinks) an I/O request from an endpoint
354 * completion routine is called (with status -ECONNRESET); else a negative
364 return ep->ops->dequeue(ep, req); in usb_ep_dequeue()
368 * usb_ep_set_halt - sets the endpoint halt feature.
369 * @ep: the non-isochronous endpoint being stalled
384 * Attempts to halt IN endpoints will fail (returning -EAGAIN) if any
390 return ep->ops->set_halt(ep, 1); in usb_ep_set_halt()
394 * usb_ep_clear_halt - clears endpoint halt, and resets toggle
408 return ep->ops->set_halt(ep, 0); in usb_ep_clear_halt()
412 * usb_ep_fifo_status - returns number of bytes in fifo, or error
428 if (ep->ops->fifo_status) in usb_ep_fifo_status()
429 return ep->ops->fifo_status(ep); in usb_ep_fifo_status()
431 return -EOPNOTSUPP; in usb_ep_fifo_status()
435 * usb_ep_fifo_flush - flushes contents of a fifo
445 if (ep->ops->fifo_flush) in usb_ep_fifo_flush()
446 ep->ops->fifo_flush(ep); in usb_ep_fifo_flush()
450 /*-------------------------------------------------------------------------*/
480 * struct usb_gadget - represents a usb slave device
481 * @ops: Function pointers used to access hardware-specific operations.
490 * @is_otg: true if the USB device port uses a Mini-AB jack, so that the
493 * is in the Mini-AB jack, and HNP has been used to switch roles
494 * so that the "A" device currently acts as A-Peripheral, not A-Host.
495 * @a_hnp_support: OTG device feature flag, indicating that the A-Host
496 * supports HNP at this port.
497 * @a_alt_hnp_support: OTG device feature flag, indicating that the A-Host
498 * only supports HNP on a different root port.
499 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
500 * enabled HNP support.
507 * Gadgets have a mostly-portable "gadget driver" implementing device
509 * drivers talk to hardware-specific code indirectly, through ops vectors.
515 * read-only to the gadget driver. That driver data is part of the
523 * device is acting as a B-Peripheral (so is_a_peripheral is false).
546 gadget->dev.driver_data = data; in set_gadget_data()
551 return gadget->dev.driver_data; in get_gadget_data()
559 /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
561 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
565 * gadget_is_dualspeed - return true iff the hardware handles high speed
571 /* runtime test would check "g->is_dualspeed" ... that might be in gadget_is_dualspeed()
581 * gadget_is_superspeed() - return true if the hardware handles superspeed
586 return g->max_speed >= USB_SPEED_SUPER; in gadget_is_superspeed()
590 * gadget_is_otg - return true iff the hardware is OTG-ready
591 * @g: controller that might have a Mini-AB connector
593 * This is a runtime test, since kernels with a USB-OTG stack sometimes
594 * run on boards which only have a Mini-B (or Mini-A) connector.
599 return g->is_otg; in gadget_is_otg()
606 * usb_gadget_frame_number - returns the current frame number
614 return gadget->ops->get_frame(gadget); in usb_gadget_frame_number()
618 * usb_gadget_wakeup - tries to wake up the host connected to this gadget
632 if (!gadget->ops->wakeup) in usb_gadget_wakeup()
633 return -EOPNOTSUPP; in usb_gadget_wakeup()
634 return gadget->ops->wakeup(gadget); in usb_gadget_wakeup()
638 * usb_gadget_set_selfpowered - sets the device selfpowered feature.
639 * @gadget:the device being declared as self-powered
648 if (!gadget->ops->set_selfpowered) in usb_gadget_set_selfpowered()
649 return -EOPNOTSUPP; in usb_gadget_set_selfpowered()
650 return gadget->ops->set_selfpowered(gadget, 1); in usb_gadget_set_selfpowered()
654 * usb_gadget_clear_selfpowered - clear the device selfpowered feature.
655 * @gadget:the device being declared as bus-powered
658 * some hardware may not support bus-powered operation, in which
665 if (!gadget->ops->set_selfpowered) in usb_gadget_clear_selfpowered()
666 return -EOPNOTSUPP; in usb_gadget_clear_selfpowered()
667 return gadget->ops->set_selfpowered(gadget, 0); in usb_gadget_clear_selfpowered()
671 * usb_gadget_vbus_connect - Notify controller that VBUS is powered
676 * resuming the controller, activating the D+ (or D-) pullup to let the
684 if (!gadget->ops->vbus_session) in usb_gadget_vbus_connect()
685 return -EOPNOTSUPP; in usb_gadget_vbus_connect()
686 return gadget->ops->vbus_session(gadget, 1); in usb_gadget_vbus_connect()
690 * usb_gadget_vbus_draw - constrain controller's VBUS power usage
703 if (!gadget->ops->vbus_draw) in usb_gadget_vbus_draw()
704 return -EOPNOTSUPP; in usb_gadget_vbus_draw()
705 return gadget->ops->vbus_draw(gadget, mA); in usb_gadget_vbus_draw()
709 * usb_gadget_vbus_disconnect - notify controller about VBUS session end
720 if (!gadget->ops->vbus_session) in usb_gadget_vbus_disconnect()
721 return -EOPNOTSUPP; in usb_gadget_vbus_disconnect()
722 return gadget->ops->vbus_session(gadget, 0); in usb_gadget_vbus_disconnect()
726 * usb_gadget_connect - software-controlled connect to USB host
729 * Enables the D+ (or potentially D-) pullup. The host will start
732 * usb_gadget_disconnect() has been used to disable it.
738 if (!gadget->ops->pullup) in usb_gadget_connect()
739 return -EOPNOTSUPP; in usb_gadget_connect()
740 return gadget->ops->pullup(gadget, 1); in usb_gadget_connect()
744 * usb_gadget_disconnect - software-controlled disconnect from USB host
747 * Disables the D+ (or potentially D-) pullup, which the host may see
760 if (!gadget->ops->pullup) in usb_gadget_disconnect()
761 return -EOPNOTSUPP; in usb_gadget_disconnect()
762 return gadget->ops->pullup(gadget, 0); in usb_gadget_disconnect()
766 /*-------------------------------------------------------------------------*/
769 * struct usb_gadget_driver - driver for usb 'slave' devices
775 * the currently-available endpoints.
799 * If gadget->is_otg is true, the gadget driver must provide an OTG
805 * Drivers use hardware-specific knowledge to configure the usb hardware.
834 * local controls (buttons, dials, etc) may need to be re-enabled since
853 /*-------------------------------------------------------------------------*/
858 * these will usually be implemented directly by the hardware-dependent
863 * usb_gadget_register_driver - register a gadget driver
876 * usb_gadget_unregister_driver - unregister a gadget driver
894 /*-------------------------------------------------------------------------*/
899 * struct usb_gadget_strings - a set of USB strings in a given language
900 * @language:identifies the strings' language (0x0409 for en-us)
907 u16 language; /* 0x0409 for en-us */
914 /*-------------------------------------------------------------------------*/
926 /*-------------------------------------------------------------------------*/
935 /*-------------------------------------------------------------------------*/
942 /*-------------------------------------------------------------------------*/
948 /*-------------------------------------------------------------------------*/
955 /*-------------------------------------------------------------------------*/