// SPDX-License-Identifier: GPL-2.0+ /* * linux/drivers/usb/gadget/pxa27x_udc.h * Intel PXA27x on-chip full speed USB device controller * * Inspired by original driver by Frank Becker, David Brownell, and others. * Copyright (C) 2008 Robert Jarzmik
*/
/* * Endpoint definitions * * Once enabled, pxa endpoint configuration is freezed, and cannot change * unless a reset happens or the udc is disabled. * Therefore, we must define all pxa potential endpoint definitions needed for * all gadget and set them up before the udc is enabled. * * As the architecture chosen is fully static, meaning the pxa endpoint * configurations are set up once and for all, we must provide a way to match * one usb endpoint (usb_ep) to several pxa endpoints. The reason is that gadget * layer autoconf doesn't choose the usb_ep endpoint on (config, interface, alt) * criteria, while the pxa architecture requires that. * * The solution is to define several pxa endpoints matching one usb_ep. Ex: * - "ep1-in" matches pxa endpoint EPA (which is an IN ep at addr 1, when * the udc talks on (config=3, interface=0, alt=0) * - "ep1-in" matches pxa endpoint EPB (which is an IN ep at addr 1, when * the udc talks on (config=3, interface=0, alt=1) * - "ep1-in" matches pxa endpoint EPC (which is an IN ep at addr 1, when * the udc talks on (config=2, interface=0, alt=0) * * We'll define the pxa endpoint by its index (EPA => idx=1, EPB => idx=2, ...)
*/
/** * struct udc_usb_ep - container of each usb_ep structure * @usb_ep: usb endpoint * @desc: usb descriptor, especially type and address * @dev: udc managing this endpoint * @pxa_ep: matching pxa_ep (cache of find_pxa_ep() call)
*/ struct udc_usb_ep { struct usb_ep usb_ep; struct usb_endpoint_descriptor desc; struct pxa_udc *dev; struct pxa_ep *pxa_ep;
};
/** * struct pxa_ep - pxa endpoint * @dev: udc device * @queue: requests queue * @lock: lock to pxa_ep data (queues and stats) * @enabled: true when endpoint enabled (not stopped by gadget layer) * @in_handle_ep: number of recursions of handle_ep() function * Prevents deadlocks or infinite recursions of types : * irq->handle_ep()->req_done()->req.complete()->pxa_ep_queue()->handle_ep() * or * pxa_ep_queue()->handle_ep()->req_done()->req.complete()->pxa_ep_queue() * @idx: endpoint index (1 => epA, 2 => epB, ..., 24 => epX) * @name: endpoint name (for trace/debug purpose) * @dir_in: 1 if IN endpoint, 0 if OUT endpoint * @addr: usb endpoint number * @config: configuration in which this endpoint is active * @interface: interface in which this endpoint is active * @alternate: altsetting in which this endpoint is active * @fifo_size: max packet size in the endpoint fifo * @type: endpoint type (bulk, iso, int, ...) * @udccsr_value: save register of UDCCSR0 for suspend/resume * @udccr_value: save register of UDCCR for suspend/resume * @stats: endpoint statistics * * The *PROBLEM* is that pxa's endpoint configuration scheme is both misdesigned * (cares about config/interface/altsetting, thus placing needless limits on * device capability) and full of implementation bugs forcing it to be set up * for use more or less like a pxa255. * * As we define the pxa_ep statically, we must guess all needed pxa_ep for all * gadget which may work with this udc driver.
*/ struct pxa_ep { struct pxa_udc *dev;
/** * struct pxa27x_request - container of each usb_request structure * @req: usb request * @udc_usb_ep: usb endpoint the request was submitted on * @in_use: sanity check if request already queued on an pxa_ep * @queue: linked list of requests, linked on pxa_ep->queue
*/ struct pxa27x_request { struct usb_request req; struct udc_usb_ep *udc_usb_ep; unsigned in_use:1; struct list_head queue;
};
/** * struct pxa_udc - udc structure * @regs: mapped IO space * @irq: udc irq * @clk: udc clock * @usb_gadget: udc gadget structure * @driver: bound gadget (zero, g_ether, g_mass_storage, ...) * @dev: device * @udc_command: machine specific function to activate D+ pullup * @gpiod: gpio descriptor of gpio for D+ pullup (or NULL if none) * @transceiver: external transceiver to handle vbus sense and D+ pullup * @ep0state: control endpoint state machine state * @stats: statistics on udc usage * @udc_usb_ep: array of usb endpoints offered by the gadget * @pxa_ep: array of pxa available endpoints * @enabled: UDC was enabled by a previous udc_enable() * @pullup_on: if pullup resistor connected to D+ pin * @pullup_resume: if pullup resistor should be connected to D+ pin on resume * @config: UDC active configuration * @last_interface: UDC interface of the last SET_INTERFACE host request * @last_alternate: UDC altsetting of the last SET_INTERFACE host request * @udccsr0: save of udccsr0 in case of suspend * @debugfs_state: debugfs entry for "udcstate" * @debugfs_queues: debugfs entry for "queues" * @debugfs_eps: debugfs entry for "epstate"
*/ struct pxa_udc { void __iomem *regs; int irq; struct clk *clk;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.