xref: /rk3399_rockchip-uboot/include/linux/usb/composite.h (revision 1a4596601fd395f3afb8f82f3f840c5e00bdd57a)
17010f5b9SLukasz Majewski /*
27010f5b9SLukasz Majewski  * composite.h -- framework for usb gadgets which are composite devices
37010f5b9SLukasz Majewski  *
47010f5b9SLukasz Majewski  * Copyright (C) 2006-2008 David Brownell
57010f5b9SLukasz Majewski  *
6*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
77010f5b9SLukasz Majewski  */
87010f5b9SLukasz Majewski 
97010f5b9SLukasz Majewski #ifndef	__LINUX_USB_COMPOSITE_H
107010f5b9SLukasz Majewski #define	__LINUX_USB_COMPOSITE_H
117010f5b9SLukasz Majewski 
127010f5b9SLukasz Majewski /*
137010f5b9SLukasz Majewski  * This framework is an optional layer on top of the USB Gadget interface,
147010f5b9SLukasz Majewski  * making it easier to build (a) Composite devices, supporting multiple
157010f5b9SLukasz Majewski  * functions within any single configuration, and (b) Multi-configuration
167010f5b9SLukasz Majewski  * devices, also supporting multiple functions but without necessarily
177010f5b9SLukasz Majewski  * having more than one function per configuration.
187010f5b9SLukasz Majewski  *
197010f5b9SLukasz Majewski  * Example:  a device with a single configuration supporting both network
207010f5b9SLukasz Majewski  * link and mass storage functions is a composite device.  Those functions
217010f5b9SLukasz Majewski  * might alternatively be packaged in individual configurations, but in
227010f5b9SLukasz Majewski  * the composite model the host can use both functions at the same time.
237010f5b9SLukasz Majewski  */
247010f5b9SLukasz Majewski 
257010f5b9SLukasz Majewski #include <common.h>
267010f5b9SLukasz Majewski #include <linux/usb/ch9.h>
277010f5b9SLukasz Majewski #include <linux/usb/gadget.h>
287010f5b9SLukasz Majewski #include <usb/lin_gadget_compat.h>
297010f5b9SLukasz Majewski 
307010f5b9SLukasz Majewski struct usb_configuration;
317010f5b9SLukasz Majewski 
327010f5b9SLukasz Majewski /**
337010f5b9SLukasz Majewski  * struct usb_function - describes one function of a configuration
347010f5b9SLukasz Majewski  * @name: For diagnostics, identifies the function.
357010f5b9SLukasz Majewski  * @strings: tables of strings, keyed by identifiers assigned during bind()
367010f5b9SLukasz Majewski  *	and by language IDs provided in control requests
377010f5b9SLukasz Majewski  * @descriptors: Table of full (or low) speed descriptors, using interface and
387010f5b9SLukasz Majewski  *	string identifiers assigned during @bind().  If this pointer is null,
397010f5b9SLukasz Majewski  *	the function will not be available at full speed (or at low speed).
407010f5b9SLukasz Majewski  * @hs_descriptors: Table of high speed descriptors, using interface and
417010f5b9SLukasz Majewski  *	string identifiers assigned during @bind().  If this pointer is null,
427010f5b9SLukasz Majewski  *	the function will not be available at high speed.
437010f5b9SLukasz Majewski  * @config: assigned when @usb_add_function() is called; this is the
447010f5b9SLukasz Majewski  *	configuration with which this function is associated.
457010f5b9SLukasz Majewski  * @bind: Before the gadget can register, all of its functions bind() to the
467010f5b9SLukasz Majewski  *	available resources including string and interface identifiers used
477010f5b9SLukasz Majewski  *	in interface or class descriptors; endpoints; I/O buffers; and so on.
487010f5b9SLukasz Majewski  * @unbind: Reverses @bind; called as a side effect of unregistering the
497010f5b9SLukasz Majewski  *	driver which added this function.
507010f5b9SLukasz Majewski  * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
517010f5b9SLukasz Majewski  *	initialize usb_ep.driver data at this time (when it is used).
527010f5b9SLukasz Majewski  *	Note that setting an interface to its current altsetting resets
537010f5b9SLukasz Majewski  *	interface state, and that all interfaces have a disabled state.
547010f5b9SLukasz Majewski  * @get_alt: Returns the active altsetting.  If this is not provided,
557010f5b9SLukasz Majewski  *	then only altsetting zero is supported.
567010f5b9SLukasz Majewski  * @disable: (REQUIRED) Indicates the function should be disabled.  Reasons
577010f5b9SLukasz Majewski  *	include host resetting or reconfiguring the gadget, and disconnection.
587010f5b9SLukasz Majewski  * @setup: Used for interface-specific control requests.
597010f5b9SLukasz Majewski  * @suspend: Notifies functions when the host stops sending USB traffic.
607010f5b9SLukasz Majewski  * @resume: Notifies functions when the host restarts USB traffic.
617010f5b9SLukasz Majewski  *
627010f5b9SLukasz Majewski  * A single USB function uses one or more interfaces, and should in most
637010f5b9SLukasz Majewski  * cases support operation at both full and high speeds.  Each function is
647010f5b9SLukasz Majewski  * associated by @usb_add_function() with a one configuration; that function
657010f5b9SLukasz Majewski  * causes @bind() to be called so resources can be allocated as part of
667010f5b9SLukasz Majewski  * setting up a gadget driver.  Those resources include endpoints, which
677010f5b9SLukasz Majewski  * should be allocated using @usb_ep_autoconfig().
687010f5b9SLukasz Majewski  *
697010f5b9SLukasz Majewski  * To support dual speed operation, a function driver provides descriptors
707010f5b9SLukasz Majewski  * for both high and full speed operation.  Except in rare cases that don't
717010f5b9SLukasz Majewski  * involve bulk endpoints, each speed needs different endpoint descriptors.
727010f5b9SLukasz Majewski  *
737010f5b9SLukasz Majewski  * Function drivers choose their own strategies for managing instance data.
747010f5b9SLukasz Majewski  * The simplest strategy just declares it "static', which means the function
757010f5b9SLukasz Majewski  * can only be activated once.  If the function needs to be exposed in more
767010f5b9SLukasz Majewski  * than one configuration at a given speed, it needs to support multiple
777010f5b9SLukasz Majewski  * usb_function structures (one for each configuration).
787010f5b9SLukasz Majewski  *
797010f5b9SLukasz Majewski  * A more complex strategy might encapsulate a @usb_function structure inside
807010f5b9SLukasz Majewski  * a driver-specific instance structure to allows multiple activations.  An
817010f5b9SLukasz Majewski  * example of multiple activations might be a CDC ACM function that supports
827010f5b9SLukasz Majewski  * two or more distinct instances within the same configuration, providing
837010f5b9SLukasz Majewski  * several independent logical data links to a USB host.
847010f5b9SLukasz Majewski  */
857010f5b9SLukasz Majewski struct usb_function {
867010f5b9SLukasz Majewski 	const char			*name;
877010f5b9SLukasz Majewski 	struct usb_gadget_strings	**strings;
887010f5b9SLukasz Majewski 	struct usb_descriptor_header	**descriptors;
897010f5b9SLukasz Majewski 	struct usb_descriptor_header	**hs_descriptors;
907010f5b9SLukasz Majewski 
917010f5b9SLukasz Majewski 	struct usb_configuration	*config;
927010f5b9SLukasz Majewski 
937010f5b9SLukasz Majewski 	/* REVISIT:  bind() functions can be marked __init, which
947010f5b9SLukasz Majewski 	 * makes trouble for section mismatch analysis.  See if
957010f5b9SLukasz Majewski 	 * we can't restructure things to avoid mismatching.
967010f5b9SLukasz Majewski 	 * Related:  unbind() may kfree() but bind() won't...
977010f5b9SLukasz Majewski 	 */
987010f5b9SLukasz Majewski 
997010f5b9SLukasz Majewski 	/* configuration management:  bind/unbind */
1007010f5b9SLukasz Majewski 	int			(*bind)(struct usb_configuration *,
1017010f5b9SLukasz Majewski 					struct usb_function *);
1027010f5b9SLukasz Majewski 	void			(*unbind)(struct usb_configuration *,
1037010f5b9SLukasz Majewski 					struct usb_function *);
1047010f5b9SLukasz Majewski 
1057010f5b9SLukasz Majewski 	/* runtime state management */
1067010f5b9SLukasz Majewski 	int			(*set_alt)(struct usb_function *,
1077010f5b9SLukasz Majewski 					unsigned interface, unsigned alt);
1087010f5b9SLukasz Majewski 	int			(*get_alt)(struct usb_function *,
1097010f5b9SLukasz Majewski 					unsigned interface);
1107010f5b9SLukasz Majewski 	void			(*disable)(struct usb_function *);
1117010f5b9SLukasz Majewski 	int			(*setup)(struct usb_function *,
1127010f5b9SLukasz Majewski 					const struct usb_ctrlrequest *);
1137010f5b9SLukasz Majewski 	void			(*suspend)(struct usb_function *);
1147010f5b9SLukasz Majewski 	void			(*resume)(struct usb_function *);
1157010f5b9SLukasz Majewski 
1167010f5b9SLukasz Majewski 	/* private: */
1177010f5b9SLukasz Majewski 	/* internals */
1187010f5b9SLukasz Majewski 	struct list_head		list;
1197010f5b9SLukasz Majewski 	DECLARE_BITMAP(endpoints, 32);
1207010f5b9SLukasz Majewski };
1217010f5b9SLukasz Majewski 
1227010f5b9SLukasz Majewski int usb_add_function(struct usb_configuration *, struct usb_function *);
1237010f5b9SLukasz Majewski 
1247010f5b9SLukasz Majewski int usb_function_deactivate(struct usb_function *);
1257010f5b9SLukasz Majewski int usb_function_activate(struct usb_function *);
1267010f5b9SLukasz Majewski 
1277010f5b9SLukasz Majewski int usb_interface_id(struct usb_configuration *, struct usb_function *);
1287010f5b9SLukasz Majewski 
1297010f5b9SLukasz Majewski /**
1307010f5b9SLukasz Majewski  * ep_choose - select descriptor endpoint at current device speed
1317010f5b9SLukasz Majewski  * @g: gadget, connected and running at some speed
1327010f5b9SLukasz Majewski  * @hs: descriptor to use for high speed operation
1337010f5b9SLukasz Majewski  * @fs: descriptor to use for full or low speed operation
1347010f5b9SLukasz Majewski  */
1357010f5b9SLukasz Majewski static inline struct usb_endpoint_descriptor *
1367010f5b9SLukasz Majewski ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
1377010f5b9SLukasz Majewski 		struct usb_endpoint_descriptor *fs)
1387010f5b9SLukasz Majewski {
1397010f5b9SLukasz Majewski 	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
1407010f5b9SLukasz Majewski 		return hs;
1417010f5b9SLukasz Majewski 	return fs;
1427010f5b9SLukasz Majewski }
1437010f5b9SLukasz Majewski 
1447010f5b9SLukasz Majewski #define	MAX_CONFIG_INTERFACES		16	/* arbitrary; max 255 */
1457010f5b9SLukasz Majewski 
1467010f5b9SLukasz Majewski /**
1477010f5b9SLukasz Majewski  * struct usb_configuration - represents one gadget configuration
1487010f5b9SLukasz Majewski  * @label: For diagnostics, describes the configuration.
1497010f5b9SLukasz Majewski  * @strings: Tables of strings, keyed by identifiers assigned during @bind()
1507010f5b9SLukasz Majewski  *	and by language IDs provided in control requests.
1517010f5b9SLukasz Majewski  * @descriptors: Table of descriptors preceding all function descriptors.
1527010f5b9SLukasz Majewski  *	Examples include OTG and vendor-specific descriptors.
1537010f5b9SLukasz Majewski  * @bind: Called from @usb_add_config() to allocate resources unique to this
1547010f5b9SLukasz Majewski  *	configuration and to call @usb_add_function() for each function used.
1557010f5b9SLukasz Majewski  * @unbind: Reverses @bind; called as a side effect of unregistering the
1567010f5b9SLukasz Majewski  *	driver which added this configuration.
1577010f5b9SLukasz Majewski  * @setup: Used to delegate control requests that aren't handled by standard
1587010f5b9SLukasz Majewski  *	device infrastructure or directed at a specific interface.
1597010f5b9SLukasz Majewski  * @bConfigurationValue: Copied into configuration descriptor.
1607010f5b9SLukasz Majewski  * @iConfiguration: Copied into configuration descriptor.
1617010f5b9SLukasz Majewski  * @bmAttributes: Copied into configuration descriptor.
1627010f5b9SLukasz Majewski  * @bMaxPower: Copied into configuration descriptor.
1637010f5b9SLukasz Majewski  * @cdev: assigned by @usb_add_config() before calling @bind(); this is
1647010f5b9SLukasz Majewski  *	the device associated with this configuration.
1657010f5b9SLukasz Majewski  *
1667010f5b9SLukasz Majewski  * Configurations are building blocks for gadget drivers structured around
1677010f5b9SLukasz Majewski  * function drivers.  Simple USB gadgets require only one function and one
1687010f5b9SLukasz Majewski  * configuration, and handle dual-speed hardware by always providing the same
1697010f5b9SLukasz Majewski  * functionality.  Slightly more complex gadgets may have more than one
1707010f5b9SLukasz Majewski  * single-function configuration at a given speed; or have configurations
1717010f5b9SLukasz Majewski  * that only work at one speed.
1727010f5b9SLukasz Majewski  *
1737010f5b9SLukasz Majewski  * Composite devices are, by definition, ones with configurations which
1747010f5b9SLukasz Majewski  * include more than one function.
1757010f5b9SLukasz Majewski  *
1767010f5b9SLukasz Majewski  * The lifecycle of a usb_configuration includes allocation, initialization
1777010f5b9SLukasz Majewski  * of the fields described above, and calling @usb_add_config() to set up
1787010f5b9SLukasz Majewski  * internal data and bind it to a specific device.  The configuration's
1797010f5b9SLukasz Majewski  * @bind() method is then used to initialize all the functions and then
1807010f5b9SLukasz Majewski  * call @usb_add_function() for them.
1817010f5b9SLukasz Majewski  *
1827010f5b9SLukasz Majewski  * Those functions would normally be independant of each other, but that's
1837010f5b9SLukasz Majewski  * not mandatory.  CDC WMC devices are an example where functions often
1847010f5b9SLukasz Majewski  * depend on other functions, with some functions subsidiary to others.
1857010f5b9SLukasz Majewski  * Such interdependency may be managed in any way, so long as all of the
1867010f5b9SLukasz Majewski  * descriptors complete by the time the composite driver returns from
1877010f5b9SLukasz Majewski  * its bind() routine.
1887010f5b9SLukasz Majewski  */
1897010f5b9SLukasz Majewski struct usb_configuration {
1907010f5b9SLukasz Majewski 	const char			*label;
1917010f5b9SLukasz Majewski 	struct usb_gadget_strings	**strings;
1927010f5b9SLukasz Majewski 	const struct usb_descriptor_header **descriptors;
1937010f5b9SLukasz Majewski 
1947010f5b9SLukasz Majewski 	/* REVISIT:  bind() functions can be marked __init, which
1957010f5b9SLukasz Majewski 	 * makes trouble for section mismatch analysis.  See if
1967010f5b9SLukasz Majewski 	 * we can't restructure things to avoid mismatching...
1977010f5b9SLukasz Majewski 	 */
1987010f5b9SLukasz Majewski 
1997010f5b9SLukasz Majewski 	/* configuration management:  bind/unbind */
2007010f5b9SLukasz Majewski 	int			(*bind)(struct usb_configuration *);
2017010f5b9SLukasz Majewski 	void			(*unbind)(struct usb_configuration *);
2027010f5b9SLukasz Majewski 	int			(*setup)(struct usb_configuration *,
2037010f5b9SLukasz Majewski 					const struct usb_ctrlrequest *);
2047010f5b9SLukasz Majewski 
2057010f5b9SLukasz Majewski 	/* fields in the config descriptor */
2067010f5b9SLukasz Majewski 	u8			bConfigurationValue;
2077010f5b9SLukasz Majewski 	u8			iConfiguration;
2087010f5b9SLukasz Majewski 	u8			bmAttributes;
2097010f5b9SLukasz Majewski 	u8			bMaxPower;
2107010f5b9SLukasz Majewski 
2117010f5b9SLukasz Majewski 	struct usb_composite_dev	*cdev;
2127010f5b9SLukasz Majewski 
2137010f5b9SLukasz Majewski 	/* private: */
2147010f5b9SLukasz Majewski 	/* internals */
2157010f5b9SLukasz Majewski 	struct list_head	list;
2167010f5b9SLukasz Majewski 	struct list_head	functions;
2177010f5b9SLukasz Majewski 	u8			next_interface_id;
2187010f5b9SLukasz Majewski 	unsigned		highspeed:1;
2197010f5b9SLukasz Majewski 	unsigned		fullspeed:1;
2207010f5b9SLukasz Majewski 	struct usb_function	*interface[MAX_CONFIG_INTERFACES];
2217010f5b9SLukasz Majewski };
2227010f5b9SLukasz Majewski 
2237010f5b9SLukasz Majewski int usb_add_config(struct usb_composite_dev *,
2247010f5b9SLukasz Majewski 		struct usb_configuration *);
2257010f5b9SLukasz Majewski 
2267010f5b9SLukasz Majewski /**
2277010f5b9SLukasz Majewski  * struct usb_composite_driver - groups configurations into a gadget
2287010f5b9SLukasz Majewski  * @name: For diagnostics, identifies the driver.
2297010f5b9SLukasz Majewski  * @dev: Template descriptor for the device, including default device
2307010f5b9SLukasz Majewski  *	identifiers.
2317010f5b9SLukasz Majewski  * @strings: tables of strings, keyed by identifiers assigned during bind()
2327010f5b9SLukasz Majewski  *	and language IDs provided in control requests
2337010f5b9SLukasz Majewski  * @bind: (REQUIRED) Used to allocate resources that are shared across the
2347010f5b9SLukasz Majewski  *	whole device, such as string IDs, and add its configurations using
2357010f5b9SLukasz Majewski  *	@usb_add_config().  This may fail by returning a negative errno
2367010f5b9SLukasz Majewski  *	value; it should return zero on successful initialization.
2377010f5b9SLukasz Majewski  * @unbind: Reverses @bind(); called as a side effect of unregistering
2387010f5b9SLukasz Majewski  *	this driver.
2397010f5b9SLukasz Majewski  * @disconnect: optional driver disconnect method
2407010f5b9SLukasz Majewski  * @suspend: Notifies when the host stops sending USB traffic,
2417010f5b9SLukasz Majewski  *	after function notifications
2427010f5b9SLukasz Majewski  * @resume: Notifies configuration when the host restarts USB traffic,
2437010f5b9SLukasz Majewski  *	before function notifications
2447010f5b9SLukasz Majewski  *
2457010f5b9SLukasz Majewski  * Devices default to reporting self powered operation.  Devices which rely
2467010f5b9SLukasz Majewski  * on bus powered operation should report this in their @bind() method.
2477010f5b9SLukasz Majewski  *
2487010f5b9SLukasz Majewski  * Before returning from @bind, various fields in the template descriptor
2497010f5b9SLukasz Majewski  * may be overridden.  These include the idVendor/idProduct/bcdDevice values
2507010f5b9SLukasz Majewski  * normally to bind the appropriate host side driver, and the three strings
2517010f5b9SLukasz Majewski  * (iManufacturer, iProduct, iSerialNumber) normally used to provide user
2527010f5b9SLukasz Majewski  * meaningful device identifiers.  (The strings will not be defined unless
2537010f5b9SLukasz Majewski  * they are defined in @dev and @strings.)  The correct ep0 maxpacket size
2547010f5b9SLukasz Majewski  * is also reported, as defined by the underlying controller driver.
2557010f5b9SLukasz Majewski  */
2567010f5b9SLukasz Majewski struct usb_composite_driver {
2577010f5b9SLukasz Majewski 	const char				*name;
2587010f5b9SLukasz Majewski 	const struct usb_device_descriptor	*dev;
2597010f5b9SLukasz Majewski 	struct usb_gadget_strings		**strings;
2607010f5b9SLukasz Majewski 
2617010f5b9SLukasz Majewski 	/* REVISIT:  bind() functions can be marked __init, which
2627010f5b9SLukasz Majewski 	 * makes trouble for section mismatch analysis.  See if
2637010f5b9SLukasz Majewski 	 * we can't restructure things to avoid mismatching...
2647010f5b9SLukasz Majewski 	 */
2657010f5b9SLukasz Majewski 
2667010f5b9SLukasz Majewski 	int			(*bind)(struct usb_composite_dev *);
2677010f5b9SLukasz Majewski 	int			(*unbind)(struct usb_composite_dev *);
2687010f5b9SLukasz Majewski 
2697010f5b9SLukasz Majewski 	void			(*disconnect)(struct usb_composite_dev *);
2707010f5b9SLukasz Majewski 
2717010f5b9SLukasz Majewski 	/* global suspend hooks */
2727010f5b9SLukasz Majewski 	void			(*suspend)(struct usb_composite_dev *);
2737010f5b9SLukasz Majewski 	void			(*resume)(struct usb_composite_dev *);
2747010f5b9SLukasz Majewski };
2757010f5b9SLukasz Majewski 
2767010f5b9SLukasz Majewski extern int usb_composite_register(struct usb_composite_driver *);
2777010f5b9SLukasz Majewski extern void usb_composite_unregister(struct usb_composite_driver *);
2787010f5b9SLukasz Majewski 
2797010f5b9SLukasz Majewski 
2807010f5b9SLukasz Majewski /**
2817010f5b9SLukasz Majewski  * struct usb_composite_device - represents one composite usb gadget
2827010f5b9SLukasz Majewski  * @gadget: read-only, abstracts the gadget's usb peripheral controller
2837010f5b9SLukasz Majewski  * @req: used for control responses; buffer is pre-allocated
2847010f5b9SLukasz Majewski  * @bufsiz: size of buffer pre-allocated in @req
2857010f5b9SLukasz Majewski  * @config: the currently active configuration
2867010f5b9SLukasz Majewski  *
2877010f5b9SLukasz Majewski  * One of these devices is allocated and initialized before the
2887010f5b9SLukasz Majewski  * associated device driver's bind() is called.
2897010f5b9SLukasz Majewski  *
2907010f5b9SLukasz Majewski  * OPEN ISSUE:  it appears that some WUSB devices will need to be
2917010f5b9SLukasz Majewski  * built by combining a normal (wired) gadget with a wireless one.
2927010f5b9SLukasz Majewski  * This revision of the gadget framework should probably try to make
2937010f5b9SLukasz Majewski  * sure doing that won't hurt too much.
2947010f5b9SLukasz Majewski  *
2957010f5b9SLukasz Majewski  * One notion for how to handle Wireless USB devices involves:
2967010f5b9SLukasz Majewski  * (a) a second gadget here, discovery mechanism TBD, but likely
2977010f5b9SLukasz Majewski  *     needing separate "register/unregister WUSB gadget" calls;
2987010f5b9SLukasz Majewski  * (b) updates to usb_gadget to include flags "is it wireless",
2997010f5b9SLukasz Majewski  *     "is it wired", plus (presumably in a wrapper structure)
3007010f5b9SLukasz Majewski  *     bandgroup and PHY info;
3017010f5b9SLukasz Majewski  * (c) presumably a wireless_ep wrapping a usb_ep, and reporting
3027010f5b9SLukasz Majewski  *     wireless-specific parameters like maxburst and maxsequence;
3037010f5b9SLukasz Majewski  * (d) configurations that are specific to wireless links;
3047010f5b9SLukasz Majewski  * (e) function drivers that understand wireless configs and will
3057010f5b9SLukasz Majewski  *     support wireless for (additional) function instances;
3067010f5b9SLukasz Majewski  * (f) a function to support association setup (like CBAF), not
3077010f5b9SLukasz Majewski  *     necessarily requiring a wireless adapter;
3087010f5b9SLukasz Majewski  * (g) composite device setup that can create one or more wireless
3097010f5b9SLukasz Majewski  *     configs, including appropriate association setup support;
3107010f5b9SLukasz Majewski  * (h) more, TBD.
3117010f5b9SLukasz Majewski  */
3127010f5b9SLukasz Majewski struct usb_composite_dev {
3137010f5b9SLukasz Majewski 	struct usb_gadget		*gadget;
3147010f5b9SLukasz Majewski 	struct usb_request		*req;
3157010f5b9SLukasz Majewski 	unsigned			bufsiz;
3167010f5b9SLukasz Majewski 
3177010f5b9SLukasz Majewski 	struct usb_configuration	*config;
3187010f5b9SLukasz Majewski 
3197010f5b9SLukasz Majewski 	/* private: */
3207010f5b9SLukasz Majewski 	/* internals */
3217010f5b9SLukasz Majewski 	unsigned int			suspended:1;
322b37c4a2bSHeiko Schocher 	struct usb_device_descriptor __aligned(CONFIG_SYS_CACHELINE_SIZE) desc;
3237010f5b9SLukasz Majewski 	struct list_head		configs;
3247010f5b9SLukasz Majewski 	struct usb_composite_driver	*driver;
3257010f5b9SLukasz Majewski 	u8				next_string_id;
3267010f5b9SLukasz Majewski 
3277010f5b9SLukasz Majewski 	/* the gadget driver won't enable the data pullup
3287010f5b9SLukasz Majewski 	 * while the deactivation count is nonzero.
3297010f5b9SLukasz Majewski 	 */
3307010f5b9SLukasz Majewski 	unsigned			deactivations;
3317010f5b9SLukasz Majewski };
3327010f5b9SLukasz Majewski 
3337010f5b9SLukasz Majewski extern int usb_string_id(struct usb_composite_dev *c);
3347010f5b9SLukasz Majewski extern int usb_string_ids_tab(struct usb_composite_dev *c,
3357010f5b9SLukasz Majewski 			      struct usb_string *str);
3367010f5b9SLukasz Majewski extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
3377010f5b9SLukasz Majewski 
3387010f5b9SLukasz Majewski #endif	/* __LINUX_USB_COMPOSITE_H */
339