xref: /OK3568_Linux_fs/u-boot/include/linux/usb/composite.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * composite.h -- framework for usb gadgets which are composite devices
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 2006-2008 David Brownell
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef	__LINUX_USB_COMPOSITE_H
10*4882a593Smuzhiyun #define	__LINUX_USB_COMPOSITE_H
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun /*
13*4882a593Smuzhiyun  * This framework is an optional layer on top of the USB Gadget interface,
14*4882a593Smuzhiyun  * making it easier to build (a) Composite devices, supporting multiple
15*4882a593Smuzhiyun  * functions within any single configuration, and (b) Multi-configuration
16*4882a593Smuzhiyun  * devices, also supporting multiple functions but without necessarily
17*4882a593Smuzhiyun  * having more than one function per configuration.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * Example:  a device with a single configuration supporting both network
20*4882a593Smuzhiyun  * link and mass storage functions is a composite device.  Those functions
21*4882a593Smuzhiyun  * might alternatively be packaged in individual configurations, but in
22*4882a593Smuzhiyun  * the composite model the host can use both functions at the same time.
23*4882a593Smuzhiyun  */
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #include <common.h>
26*4882a593Smuzhiyun #include <linux/usb/ch9.h>
27*4882a593Smuzhiyun #include <linux/usb/gadget.h>
28*4882a593Smuzhiyun #include <linux/bitmap.h>
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun /*
31*4882a593Smuzhiyun  * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
32*4882a593Smuzhiyun  * wish to delay the data/status stages of the control transfer till they
33*4882a593Smuzhiyun  * are ready. The control transfer will then be kept from completing till
34*4882a593Smuzhiyun  * all the function drivers that requested for USB_GADGET_DELAYED_STAUS
35*4882a593Smuzhiyun  * invoke usb_composite_setup_continue().
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun #define	USB_GADGET_DELAYED_STATUS	0x7fff /* Impossibly large value */
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun struct usb_configuration;
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /**
42*4882a593Smuzhiyun  * struct usb_function - describes one function of a configuration
43*4882a593Smuzhiyun  * @name: For diagnostics, identifies the function.
44*4882a593Smuzhiyun  * @strings: tables of strings, keyed by identifiers assigned during bind()
45*4882a593Smuzhiyun  *	and by language IDs provided in control requests
46*4882a593Smuzhiyun  * @descriptors: Table of full (or low) speed descriptors, using interface and
47*4882a593Smuzhiyun  *	string identifiers assigned during @bind().  If this pointer is null,
48*4882a593Smuzhiyun  *	the function will not be available at full speed (or at low speed).
49*4882a593Smuzhiyun  * @hs_descriptors: Table of high speed descriptors, using interface and
50*4882a593Smuzhiyun  *	string identifiers assigned during @bind().  If this pointer is null,
51*4882a593Smuzhiyun  *	the function will not be available at high speed.
52*4882a593Smuzhiyun  * @ss_descriptors: Table of super speed descriptors, using interface and
53*4882a593Smuzhiyun  *	string identifiers assigned during @bind(). If this pointer is null,
54*4882a593Smuzhiyun  *	the function will not be available at super speed.
55*4882a593Smuzhiyun  * @config: assigned when @usb_add_function() is called; this is the
56*4882a593Smuzhiyun  *	configuration with which this function is associated.
57*4882a593Smuzhiyun  * @bind: Before the gadget can register, all of its functions bind() to the
58*4882a593Smuzhiyun  *	available resources including string and interface identifiers used
59*4882a593Smuzhiyun  *	in interface or class descriptors; endpoints; I/O buffers; and so on.
60*4882a593Smuzhiyun  * @unbind: Reverses @bind; called as a side effect of unregistering the
61*4882a593Smuzhiyun  *	driver which added this function.
62*4882a593Smuzhiyun  * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
63*4882a593Smuzhiyun  *	initialize usb_ep.driver data at this time (when it is used).
64*4882a593Smuzhiyun  *	Note that setting an interface to its current altsetting resets
65*4882a593Smuzhiyun  *	interface state, and that all interfaces have a disabled state.
66*4882a593Smuzhiyun  * @get_alt: Returns the active altsetting.  If this is not provided,
67*4882a593Smuzhiyun  *	then only altsetting zero is supported.
68*4882a593Smuzhiyun  * @disable: (REQUIRED) Indicates the function should be disabled.  Reasons
69*4882a593Smuzhiyun  *	include host resetting or reconfiguring the gadget, and disconnection.
70*4882a593Smuzhiyun  * @setup: Used for interface-specific control requests.
71*4882a593Smuzhiyun  * @suspend: Notifies functions when the host stops sending USB traffic.
72*4882a593Smuzhiyun  * @resume: Notifies functions when the host restarts USB traffic.
73*4882a593Smuzhiyun  *
74*4882a593Smuzhiyun  * A single USB function uses one or more interfaces, and should in most
75*4882a593Smuzhiyun  * cases support operation at both full and high speeds.  Each function is
76*4882a593Smuzhiyun  * associated by @usb_add_function() with a one configuration; that function
77*4882a593Smuzhiyun  * causes @bind() to be called so resources can be allocated as part of
78*4882a593Smuzhiyun  * setting up a gadget driver.  Those resources include endpoints, which
79*4882a593Smuzhiyun  * should be allocated using @usb_ep_autoconfig().
80*4882a593Smuzhiyun  *
81*4882a593Smuzhiyun  * To support dual speed operation, a function driver provides descriptors
82*4882a593Smuzhiyun  * for both high and full speed operation.  Except in rare cases that don't
83*4882a593Smuzhiyun  * involve bulk endpoints, each speed needs different endpoint descriptors.
84*4882a593Smuzhiyun  *
85*4882a593Smuzhiyun  * Function drivers choose their own strategies for managing instance data.
86*4882a593Smuzhiyun  * The simplest strategy just declares it "static', which means the function
87*4882a593Smuzhiyun  * can only be activated once.  If the function needs to be exposed in more
88*4882a593Smuzhiyun  * than one configuration at a given speed, it needs to support multiple
89*4882a593Smuzhiyun  * usb_function structures (one for each configuration).
90*4882a593Smuzhiyun  *
91*4882a593Smuzhiyun  * A more complex strategy might encapsulate a @usb_function structure inside
92*4882a593Smuzhiyun  * a driver-specific instance structure to allows multiple activations.  An
93*4882a593Smuzhiyun  * example of multiple activations might be a CDC ACM function that supports
94*4882a593Smuzhiyun  * two or more distinct instances within the same configuration, providing
95*4882a593Smuzhiyun  * several independent logical data links to a USB host.
96*4882a593Smuzhiyun  */
97*4882a593Smuzhiyun struct usb_function {
98*4882a593Smuzhiyun 	const char			*name;
99*4882a593Smuzhiyun 	struct usb_gadget_strings	**strings;
100*4882a593Smuzhiyun 	struct usb_descriptor_header	**descriptors;
101*4882a593Smuzhiyun 	struct usb_descriptor_header	**hs_descriptors;
102*4882a593Smuzhiyun 	struct usb_descriptor_header	**ss_descriptors;
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun 	struct usb_configuration	*config;
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun 	/* REVISIT:  bind() functions can be marked __init, which
107*4882a593Smuzhiyun 	 * makes trouble for section mismatch analysis.  See if
108*4882a593Smuzhiyun 	 * we can't restructure things to avoid mismatching.
109*4882a593Smuzhiyun 	 * Related:  unbind() may kfree() but bind() won't...
110*4882a593Smuzhiyun 	 */
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun 	/* configuration management:  bind/unbind */
113*4882a593Smuzhiyun 	int			(*bind)(struct usb_configuration *,
114*4882a593Smuzhiyun 					struct usb_function *);
115*4882a593Smuzhiyun 	void			(*unbind)(struct usb_configuration *,
116*4882a593Smuzhiyun 					struct usb_function *);
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun 	/* runtime state management */
119*4882a593Smuzhiyun 	int			(*set_alt)(struct usb_function *,
120*4882a593Smuzhiyun 					unsigned interface, unsigned alt);
121*4882a593Smuzhiyun 	int			(*get_alt)(struct usb_function *,
122*4882a593Smuzhiyun 					unsigned interface);
123*4882a593Smuzhiyun 	void			(*disable)(struct usb_function *);
124*4882a593Smuzhiyun 	int			(*setup)(struct usb_function *,
125*4882a593Smuzhiyun 					const struct usb_ctrlrequest *);
126*4882a593Smuzhiyun 	void			(*suspend)(struct usb_function *);
127*4882a593Smuzhiyun 	void			(*resume)(struct usb_function *);
128*4882a593Smuzhiyun 
129*4882a593Smuzhiyun 	/* private: */
130*4882a593Smuzhiyun 	/* internals */
131*4882a593Smuzhiyun 	struct list_head		list;
132*4882a593Smuzhiyun 	DECLARE_BITMAP(endpoints, 32);
133*4882a593Smuzhiyun };
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun int usb_add_function(struct usb_configuration *, struct usb_function *);
136*4882a593Smuzhiyun 
137*4882a593Smuzhiyun int usb_function_deactivate(struct usb_function *);
138*4882a593Smuzhiyun int usb_function_activate(struct usb_function *);
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun int usb_interface_id(struct usb_configuration *, struct usb_function *);
141*4882a593Smuzhiyun 
142*4882a593Smuzhiyun /**
143*4882a593Smuzhiyun  * ep_choose - select descriptor endpoint at current device speed
144*4882a593Smuzhiyun  * @g: gadget, connected and running at some speed
145*4882a593Smuzhiyun  * @hs: descriptor to use for high speed operation
146*4882a593Smuzhiyun  * @fs: descriptor to use for full or low speed operation
147*4882a593Smuzhiyun  */
148*4882a593Smuzhiyun static inline struct usb_endpoint_descriptor *
ep_choose(struct usb_gadget * g,struct usb_endpoint_descriptor * hs,struct usb_endpoint_descriptor * fs)149*4882a593Smuzhiyun ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
150*4882a593Smuzhiyun 		struct usb_endpoint_descriptor *fs)
151*4882a593Smuzhiyun {
152*4882a593Smuzhiyun 	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
153*4882a593Smuzhiyun 		return hs;
154*4882a593Smuzhiyun 	return fs;
155*4882a593Smuzhiyun }
156*4882a593Smuzhiyun 
157*4882a593Smuzhiyun #define	MAX_CONFIG_INTERFACES		16	/* arbitrary; max 255 */
158*4882a593Smuzhiyun 
159*4882a593Smuzhiyun /**
160*4882a593Smuzhiyun  * struct usb_configuration - represents one gadget configuration
161*4882a593Smuzhiyun  * @label: For diagnostics, describes the configuration.
162*4882a593Smuzhiyun  * @strings: Tables of strings, keyed by identifiers assigned during @bind()
163*4882a593Smuzhiyun  *	and by language IDs provided in control requests.
164*4882a593Smuzhiyun  * @descriptors: Table of descriptors preceding all function descriptors.
165*4882a593Smuzhiyun  *	Examples include OTG and vendor-specific descriptors.
166*4882a593Smuzhiyun  * @bind: Called from @usb_add_config() to allocate resources unique to this
167*4882a593Smuzhiyun  *	configuration and to call @usb_add_function() for each function used.
168*4882a593Smuzhiyun  * @unbind: Reverses @bind; called as a side effect of unregistering the
169*4882a593Smuzhiyun  *	driver which added this configuration.
170*4882a593Smuzhiyun  * @setup: Used to delegate control requests that aren't handled by standard
171*4882a593Smuzhiyun  *	device infrastructure or directed at a specific interface.
172*4882a593Smuzhiyun  * @bConfigurationValue: Copied into configuration descriptor.
173*4882a593Smuzhiyun  * @iConfiguration: Copied into configuration descriptor.
174*4882a593Smuzhiyun  * @bmAttributes: Copied into configuration descriptor.
175*4882a593Smuzhiyun  * @bMaxPower: Copied into configuration descriptor.
176*4882a593Smuzhiyun  * @cdev: assigned by @usb_add_config() before calling @bind(); this is
177*4882a593Smuzhiyun  *	the device associated with this configuration.
178*4882a593Smuzhiyun  *
179*4882a593Smuzhiyun  * Configurations are building blocks for gadget drivers structured around
180*4882a593Smuzhiyun  * function drivers.  Simple USB gadgets require only one function and one
181*4882a593Smuzhiyun  * configuration, and handle dual-speed hardware by always providing the same
182*4882a593Smuzhiyun  * functionality.  Slightly more complex gadgets may have more than one
183*4882a593Smuzhiyun  * single-function configuration at a given speed; or have configurations
184*4882a593Smuzhiyun  * that only work at one speed.
185*4882a593Smuzhiyun  *
186*4882a593Smuzhiyun  * Composite devices are, by definition, ones with configurations which
187*4882a593Smuzhiyun  * include more than one function.
188*4882a593Smuzhiyun  *
189*4882a593Smuzhiyun  * The lifecycle of a usb_configuration includes allocation, initialization
190*4882a593Smuzhiyun  * of the fields described above, and calling @usb_add_config() to set up
191*4882a593Smuzhiyun  * internal data and bind it to a specific device.  The configuration's
192*4882a593Smuzhiyun  * @bind() method is then used to initialize all the functions and then
193*4882a593Smuzhiyun  * call @usb_add_function() for them.
194*4882a593Smuzhiyun  *
195*4882a593Smuzhiyun  * Those functions would normally be independant of each other, but that's
196*4882a593Smuzhiyun  * not mandatory.  CDC WMC devices are an example where functions often
197*4882a593Smuzhiyun  * depend on other functions, with some functions subsidiary to others.
198*4882a593Smuzhiyun  * Such interdependency may be managed in any way, so long as all of the
199*4882a593Smuzhiyun  * descriptors complete by the time the composite driver returns from
200*4882a593Smuzhiyun  * its bind() routine.
201*4882a593Smuzhiyun  */
202*4882a593Smuzhiyun struct usb_configuration {
203*4882a593Smuzhiyun 	const char			*label;
204*4882a593Smuzhiyun 	struct usb_gadget_strings	**strings;
205*4882a593Smuzhiyun 	const struct usb_descriptor_header **descriptors;
206*4882a593Smuzhiyun 
207*4882a593Smuzhiyun 	/* REVISIT:  bind() functions can be marked __init, which
208*4882a593Smuzhiyun 	 * makes trouble for section mismatch analysis.  See if
209*4882a593Smuzhiyun 	 * we can't restructure things to avoid mismatching...
210*4882a593Smuzhiyun 	 */
211*4882a593Smuzhiyun 
212*4882a593Smuzhiyun 	/* configuration management:  bind/unbind */
213*4882a593Smuzhiyun 	int			(*bind)(struct usb_configuration *);
214*4882a593Smuzhiyun 	void			(*unbind)(struct usb_configuration *);
215*4882a593Smuzhiyun 	int			(*setup)(struct usb_configuration *,
216*4882a593Smuzhiyun 					const struct usb_ctrlrequest *);
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun 	/* fields in the config descriptor */
219*4882a593Smuzhiyun 	u8			bConfigurationValue;
220*4882a593Smuzhiyun 	u8			iConfiguration;
221*4882a593Smuzhiyun 	u8			bmAttributes;
222*4882a593Smuzhiyun 	u8			bMaxPower;
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun 	struct usb_composite_dev	*cdev;
225*4882a593Smuzhiyun 
226*4882a593Smuzhiyun 	/* private: */
227*4882a593Smuzhiyun 	/* internals */
228*4882a593Smuzhiyun 	struct list_head	list;
229*4882a593Smuzhiyun 	struct list_head	functions;
230*4882a593Smuzhiyun 	u8			next_interface_id;
231*4882a593Smuzhiyun 	unsigned		superspeed:1;
232*4882a593Smuzhiyun 	unsigned		highspeed:1;
233*4882a593Smuzhiyun 	unsigned		fullspeed:1;
234*4882a593Smuzhiyun 	struct usb_function	*interface[MAX_CONFIG_INTERFACES];
235*4882a593Smuzhiyun };
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun int usb_add_config(struct usb_composite_dev *,
238*4882a593Smuzhiyun 		struct usb_configuration *);
239*4882a593Smuzhiyun 
240*4882a593Smuzhiyun /**
241*4882a593Smuzhiyun  * struct usb_composite_driver - groups configurations into a gadget
242*4882a593Smuzhiyun  * @name: For diagnostics, identifies the driver.
243*4882a593Smuzhiyun  * @dev: Template descriptor for the device, including default device
244*4882a593Smuzhiyun  *	identifiers.
245*4882a593Smuzhiyun  * @strings: tables of strings, keyed by identifiers assigned during bind()
246*4882a593Smuzhiyun  *	and language IDs provided in control requests
247*4882a593Smuzhiyun  * @bind: (REQUIRED) Used to allocate resources that are shared across the
248*4882a593Smuzhiyun  *	whole device, such as string IDs, and add its configurations using
249*4882a593Smuzhiyun  *	@usb_add_config().  This may fail by returning a negative errno
250*4882a593Smuzhiyun  *	value; it should return zero on successful initialization.
251*4882a593Smuzhiyun  * @unbind: Reverses @bind(); called as a side effect of unregistering
252*4882a593Smuzhiyun  *	this driver.
253*4882a593Smuzhiyun  * @disconnect: optional driver disconnect method
254*4882a593Smuzhiyun  * @suspend: Notifies when the host stops sending USB traffic,
255*4882a593Smuzhiyun  *	after function notifications
256*4882a593Smuzhiyun  * @resume: Notifies configuration when the host restarts USB traffic,
257*4882a593Smuzhiyun  *	before function notifications
258*4882a593Smuzhiyun  *
259*4882a593Smuzhiyun  * Devices default to reporting self powered operation.  Devices which rely
260*4882a593Smuzhiyun  * on bus powered operation should report this in their @bind() method.
261*4882a593Smuzhiyun  *
262*4882a593Smuzhiyun  * Before returning from @bind, various fields in the template descriptor
263*4882a593Smuzhiyun  * may be overridden.  These include the idVendor/idProduct/bcdDevice values
264*4882a593Smuzhiyun  * normally to bind the appropriate host side driver, and the three strings
265*4882a593Smuzhiyun  * (iManufacturer, iProduct, iSerialNumber) normally used to provide user
266*4882a593Smuzhiyun  * meaningful device identifiers.  (The strings will not be defined unless
267*4882a593Smuzhiyun  * they are defined in @dev and @strings.)  The correct ep0 maxpacket size
268*4882a593Smuzhiyun  * is also reported, as defined by the underlying controller driver.
269*4882a593Smuzhiyun  */
270*4882a593Smuzhiyun struct usb_composite_driver {
271*4882a593Smuzhiyun 	const char				*name;
272*4882a593Smuzhiyun 	const struct usb_device_descriptor	*dev;
273*4882a593Smuzhiyun 	struct usb_gadget_strings		**strings;
274*4882a593Smuzhiyun 
275*4882a593Smuzhiyun 	/* REVISIT:  bind() functions can be marked __init, which
276*4882a593Smuzhiyun 	 * makes trouble for section mismatch analysis.  See if
277*4882a593Smuzhiyun 	 * we can't restructure things to avoid mismatching...
278*4882a593Smuzhiyun 	 */
279*4882a593Smuzhiyun 
280*4882a593Smuzhiyun 	int			(*bind)(struct usb_composite_dev *);
281*4882a593Smuzhiyun 	int			(*unbind)(struct usb_composite_dev *);
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun 	void			(*disconnect)(struct usb_composite_dev *);
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun 	/* global suspend hooks */
286*4882a593Smuzhiyun 	void			(*suspend)(struct usb_composite_dev *);
287*4882a593Smuzhiyun 	void			(*resume)(struct usb_composite_dev *);
288*4882a593Smuzhiyun };
289*4882a593Smuzhiyun 
290*4882a593Smuzhiyun extern int usb_composite_register(struct usb_composite_driver *);
291*4882a593Smuzhiyun extern void usb_composite_unregister(struct usb_composite_driver *);
292*4882a593Smuzhiyun 
293*4882a593Smuzhiyun 
294*4882a593Smuzhiyun /**
295*4882a593Smuzhiyun  * struct usb_composite_device - represents one composite usb gadget
296*4882a593Smuzhiyun  * @gadget: read-only, abstracts the gadget's usb peripheral controller
297*4882a593Smuzhiyun  * @req: used for control responses; buffer is pre-allocated
298*4882a593Smuzhiyun  * @bufsiz: size of buffer pre-allocated in @req
299*4882a593Smuzhiyun  * @config: the currently active configuration
300*4882a593Smuzhiyun  *
301*4882a593Smuzhiyun  * One of these devices is allocated and initialized before the
302*4882a593Smuzhiyun  * associated device driver's bind() is called.
303*4882a593Smuzhiyun  *
304*4882a593Smuzhiyun  * OPEN ISSUE:  it appears that some WUSB devices will need to be
305*4882a593Smuzhiyun  * built by combining a normal (wired) gadget with a wireless one.
306*4882a593Smuzhiyun  * This revision of the gadget framework should probably try to make
307*4882a593Smuzhiyun  * sure doing that won't hurt too much.
308*4882a593Smuzhiyun  *
309*4882a593Smuzhiyun  * One notion for how to handle Wireless USB devices involves:
310*4882a593Smuzhiyun  * (a) a second gadget here, discovery mechanism TBD, but likely
311*4882a593Smuzhiyun  *     needing separate "register/unregister WUSB gadget" calls;
312*4882a593Smuzhiyun  * (b) updates to usb_gadget to include flags "is it wireless",
313*4882a593Smuzhiyun  *     "is it wired", plus (presumably in a wrapper structure)
314*4882a593Smuzhiyun  *     bandgroup and PHY info;
315*4882a593Smuzhiyun  * (c) presumably a wireless_ep wrapping a usb_ep, and reporting
316*4882a593Smuzhiyun  *     wireless-specific parameters like maxburst and maxsequence;
317*4882a593Smuzhiyun  * (d) configurations that are specific to wireless links;
318*4882a593Smuzhiyun  * (e) function drivers that understand wireless configs and will
319*4882a593Smuzhiyun  *     support wireless for (additional) function instances;
320*4882a593Smuzhiyun  * (f) a function to support association setup (like CBAF), not
321*4882a593Smuzhiyun  *     necessarily requiring a wireless adapter;
322*4882a593Smuzhiyun  * (g) composite device setup that can create one or more wireless
323*4882a593Smuzhiyun  *     configs, including appropriate association setup support;
324*4882a593Smuzhiyun  * (h) more, TBD.
325*4882a593Smuzhiyun  */
326*4882a593Smuzhiyun struct usb_composite_dev {
327*4882a593Smuzhiyun 	struct usb_gadget		*gadget;
328*4882a593Smuzhiyun 	struct usb_request		*req;
329*4882a593Smuzhiyun 	unsigned			bufsiz;
330*4882a593Smuzhiyun 
331*4882a593Smuzhiyun 	struct usb_configuration	*config;
332*4882a593Smuzhiyun 
333*4882a593Smuzhiyun 	/* private: */
334*4882a593Smuzhiyun 	/* internals */
335*4882a593Smuzhiyun 	unsigned int			suspended:1;
336*4882a593Smuzhiyun 	struct usb_device_descriptor __aligned(CONFIG_SYS_CACHELINE_SIZE) desc;
337*4882a593Smuzhiyun 	struct list_head		configs;
338*4882a593Smuzhiyun 	struct usb_composite_driver	*driver;
339*4882a593Smuzhiyun 	u8				next_string_id;
340*4882a593Smuzhiyun 
341*4882a593Smuzhiyun 	/* the gadget driver won't enable the data pullup
342*4882a593Smuzhiyun 	 * while the deactivation count is nonzero.
343*4882a593Smuzhiyun 	 */
344*4882a593Smuzhiyun 	unsigned			deactivations;
345*4882a593Smuzhiyun };
346*4882a593Smuzhiyun 
347*4882a593Smuzhiyun extern int usb_string_id(struct usb_composite_dev *c);
348*4882a593Smuzhiyun extern int usb_string_ids_tab(struct usb_composite_dev *c,
349*4882a593Smuzhiyun 			      struct usb_string *str);
350*4882a593Smuzhiyun extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
351*4882a593Smuzhiyun 
352*4882a593Smuzhiyun #endif	/* __LINUX_USB_COMPOSITE_H */
353