aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/composite.h32
-rw-r--r--include/linux/usb/gadget.h88
-rw-r--r--include/linux/usb/m66592.h2
-rw-r--r--include/linux/usb/r8a66597.h8
-rw-r--r--include/linux/usb/renesas_usbhs.h17
5 files changed, 117 insertions, 30 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b78cba466d3d..a316fba73518 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -59,6 +59,10 @@ struct usb_configuration;
59 * @hs_descriptors: Table of high speed descriptors, using interface and 59 * @hs_descriptors: Table of high speed descriptors, using interface and
60 * string identifiers assigned during @bind(). If this pointer is null, 60 * string identifiers assigned during @bind(). If this pointer is null,
61 * the function will not be available at high speed. 61 * the function will not be available at high speed.
62 * @ss_descriptors: Table of super speed descriptors, using interface and
63 * string identifiers assigned during @bind(). If this
64 * pointer is null after initiation, the function will not
65 * be available at super speed.
62 * @config: assigned when @usb_add_function() is called; this is the 66 * @config: assigned when @usb_add_function() is called; this is the
63 * configuration with which this function is associated. 67 * configuration with which this function is associated.
64 * @bind: Before the gadget can register, all of its functions bind() to the 68 * @bind: Before the gadget can register, all of its functions bind() to the
@@ -77,6 +81,10 @@ struct usb_configuration;
77 * @setup: Used for interface-specific control requests. 81 * @setup: Used for interface-specific control requests.
78 * @suspend: Notifies functions when the host stops sending USB traffic. 82 * @suspend: Notifies functions when the host stops sending USB traffic.
79 * @resume: Notifies functions when the host restarts USB traffic. 83 * @resume: Notifies functions when the host restarts USB traffic.
84 * @get_status: Returns function status as a reply to
85 * GetStatus() request when the recepient is Interface.
86 * @func_suspend: callback to be called when
87 * SetFeature(FUNCTION_SUSPEND) is reseived
80 * 88 *
81 * A single USB function uses one or more interfaces, and should in most 89 * A single USB function uses one or more interfaces, and should in most
82 * cases support operation at both full and high speeds. Each function is 90 * cases support operation at both full and high speeds. Each function is
@@ -106,6 +114,7 @@ struct usb_function {
106 struct usb_gadget_strings **strings; 114 struct usb_gadget_strings **strings;
107 struct usb_descriptor_header **descriptors; 115 struct usb_descriptor_header **descriptors;
108 struct usb_descriptor_header **hs_descriptors; 116 struct usb_descriptor_header **hs_descriptors;
117 struct usb_descriptor_header **ss_descriptors;
109 118
110 struct usb_configuration *config; 119 struct usb_configuration *config;
111 120
@@ -132,6 +141,10 @@ struct usb_function {
132 void (*suspend)(struct usb_function *); 141 void (*suspend)(struct usb_function *);
133 void (*resume)(struct usb_function *); 142 void (*resume)(struct usb_function *);
134 143
144 /* USB 3.0 additions */
145 int (*get_status)(struct usb_function *);
146 int (*func_suspend)(struct usb_function *,
147 u8 suspend_opt);
135 /* private: */ 148 /* private: */
136 /* internals */ 149 /* internals */
137 struct list_head list; 150 struct list_head list;
@@ -145,20 +158,8 @@ int usb_function_activate(struct usb_function *);
145 158
146int usb_interface_id(struct usb_configuration *, struct usb_function *); 159int usb_interface_id(struct usb_configuration *, struct usb_function *);
147 160
148/** 161int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f,
149 * ep_choose - select descriptor endpoint at current device speed 162 struct usb_ep *_ep);
150 * @g: gadget, connected and running at some speed
151 * @hs: descriptor to use for high speed operation
152 * @fs: descriptor to use for full or low speed operation
153 */
154static inline struct usb_endpoint_descriptor *
155ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
156 struct usb_endpoint_descriptor *fs)
157{
158 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
159 return hs;
160 return fs;
161}
162 163
163#define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ 164#define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */
164 165
@@ -231,6 +232,7 @@ struct usb_configuration {
231 struct list_head list; 232 struct list_head list;
232 struct list_head functions; 233 struct list_head functions;
233 u8 next_interface_id; 234 u8 next_interface_id;
235 unsigned superspeed:1;
234 unsigned highspeed:1; 236 unsigned highspeed:1;
235 unsigned fullspeed:1; 237 unsigned fullspeed:1;
236 struct usb_function *interface[MAX_CONFIG_INTERFACES]; 238 struct usb_function *interface[MAX_CONFIG_INTERFACES];
@@ -252,6 +254,7 @@ int usb_add_config(struct usb_composite_dev *,
252 * identifiers. 254 * identifiers.
253 * @strings: tables of strings, keyed by identifiers assigned during bind() 255 * @strings: tables of strings, keyed by identifiers assigned during bind()
254 * and language IDs provided in control requests 256 * and language IDs provided in control requests
257 * @max_speed: Highest speed the driver supports.
255 * @needs_serial: set to 1 if the gadget needs userspace to provide 258 * @needs_serial: set to 1 if the gadget needs userspace to provide
256 * a serial number. If one is not provided, warning will be printed. 259 * a serial number. If one is not provided, warning will be printed.
257 * @unbind: Reverses bind; called as a side effect of unregistering 260 * @unbind: Reverses bind; called as a side effect of unregistering
@@ -279,6 +282,7 @@ struct usb_composite_driver {
279 const char *iManufacturer; 282 const char *iManufacturer;
280 const struct usb_device_descriptor *dev; 283 const struct usb_device_descriptor *dev;
281 struct usb_gadget_strings **strings; 284 struct usb_gadget_strings **strings;
285 enum usb_device_speed max_speed;
282 unsigned needs_serial:1; 286 unsigned needs_serial:1;
283 287
284 int (*unbind)(struct usb_composite_dev *); 288 int (*unbind)(struct usb_composite_dev *);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index dd1571db55e7..087f4b931833 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -15,7 +15,13 @@
15#ifndef __LINUX_USB_GADGET_H 15#ifndef __LINUX_USB_GADGET_H
16#define __LINUX_USB_GADGET_H 16#define __LINUX_USB_GADGET_H
17 17
18#include <linux/device.h>
19#include <linux/errno.h>
20#include <linux/init.h>
21#include <linux/list.h>
18#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/types.h>
24#include <linux/usb/ch9.h>
19 25
20struct usb_ep; 26struct usb_ep;
21 27
@@ -27,6 +33,7 @@ struct usb_ep;
27 * field, and the usb controller needs one, it is responsible 33 * field, and the usb controller needs one, it is responsible
28 * for mapping and unmapping the buffer. 34 * for mapping and unmapping the buffer.
29 * @length: Length of that data 35 * @length: Length of that data
36 * @stream_id: The stream id, when USB3.0 bulk streams are being used
30 * @no_interrupt: If true, hints that no completion irq is needed. 37 * @no_interrupt: If true, hints that no completion irq is needed.
31 * Helpful sometimes with deep request queues that are handled 38 * Helpful sometimes with deep request queues that are handled
32 * directly by DMA controllers. 39 * directly by DMA controllers.
@@ -81,6 +88,7 @@ struct usb_request {
81 unsigned length; 88 unsigned length;
82 dma_addr_t dma; 89 dma_addr_t dma;
83 90
91 unsigned stream_id:16;
84 unsigned no_interrupt:1; 92 unsigned no_interrupt:1;
85 unsigned zero:1; 93 unsigned zero:1;
86 unsigned short_not_ok:1; 94 unsigned short_not_ok:1;
@@ -131,8 +139,17 @@ struct usb_ep_ops {
131 * @maxpacket:The maximum packet size used on this endpoint. The initial 139 * @maxpacket:The maximum packet size used on this endpoint. The initial
132 * value can sometimes be reduced (hardware allowing), according to 140 * value can sometimes be reduced (hardware allowing), according to
133 * the endpoint descriptor used to configure the endpoint. 141 * the endpoint descriptor used to configure the endpoint.
134 * @driver_data:for use by the gadget driver. all other fields are 142 * @max_streams: The maximum number of streams supported
135 * read-only to gadget drivers. 143 * by this EP (0 - 16, actual number is 2^n)
144 * @mult: multiplier, 'mult' value for SS Isoc EPs
145 * @maxburst: the maximum number of bursts supported by this EP (for usb3)
146 * @driver_data:for use by the gadget driver.
147 * @address: used to identify the endpoint when finding descriptor that
148 * matches connection speed
149 * @desc: endpoint descriptor. This pointer is set before the endpoint is
150 * enabled and remains valid until the endpoint is disabled.
151 * @comp_desc: In case of SuperSpeed support, this is the endpoint companion
152 * descriptor that is used to configure the endpoint
136 * 153 *
137 * the bus controller driver lists all the general purpose endpoints in 154 * the bus controller driver lists all the general purpose endpoints in
138 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, 155 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
@@ -145,6 +162,12 @@ struct usb_ep {
145 const struct usb_ep_ops *ops; 162 const struct usb_ep_ops *ops;
146 struct list_head ep_list; 163 struct list_head ep_list;
147 unsigned maxpacket:16; 164 unsigned maxpacket:16;
165 unsigned max_streams:16;
166 unsigned mult:2;
167 unsigned maxburst:4;
168 u8 address;
169 const struct usb_endpoint_descriptor *desc;
170 const struct usb_ss_ep_comp_descriptor *comp_desc;
148}; 171};
149 172
150/*-------------------------------------------------------------------------*/ 173/*-------------------------------------------------------------------------*/
@@ -153,11 +176,8 @@ struct usb_ep {
153 * usb_ep_enable - configure endpoint, making it usable 176 * usb_ep_enable - configure endpoint, making it usable
154 * @ep:the endpoint being configured. may not be the endpoint named "ep0". 177 * @ep:the endpoint being configured. may not be the endpoint named "ep0".
155 * drivers discover endpoints through the ep_list of a usb_gadget. 178 * drivers discover endpoints through the ep_list of a usb_gadget.
156 * @desc:descriptor for desired behavior. caller guarantees this pointer
157 * remains valid until the endpoint is disabled; the data byte order
158 * is little-endian (usb-standard).
159 * 179 *
160 * when configurations are set, or when interface settings change, the driver 180 * When configurations are set, or when interface settings change, the driver
161 * will enable or disable the relevant endpoints. while it is enabled, an 181 * will enable or disable the relevant endpoints. while it is enabled, an
162 * endpoint may be used for i/o until the driver receives a disconnect() from 182 * endpoint may be used for i/o until the driver receives a disconnect() from
163 * the host or until the endpoint is disabled. 183 * the host or until the endpoint is disabled.
@@ -172,10 +192,9 @@ struct usb_ep {
172 * 192 *
173 * returns zero, or a negative error code. 193 * returns zero, or a negative error code.
174 */ 194 */
175static inline int usb_ep_enable(struct usb_ep *ep, 195static inline int usb_ep_enable(struct usb_ep *ep)
176 const struct usb_endpoint_descriptor *desc)
177{ 196{
178 return ep->ops->enable(ep, desc); 197 return ep->ops->enable(ep, ep->desc);
179} 198}
180 199
181/** 200/**
@@ -416,7 +435,16 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
416 435
417/*-------------------------------------------------------------------------*/ 436/*-------------------------------------------------------------------------*/
418 437
438struct usb_dcd_config_params {
439 __u8 bU1devExitLat; /* U1 Device exit Latency */
440#define USB_DEFULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */
441 __le16 bU2DevExitLat; /* U2 Device exit Latency */
442#define USB_DEFULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */
443};
444
445
419struct usb_gadget; 446struct usb_gadget;
447struct usb_gadget_driver;
420 448
421/* the rest of the api to the controller hardware: device operations, 449/* the rest of the api to the controller hardware: device operations,
422 * which don't involve endpoints (or i/o). 450 * which don't involve endpoints (or i/o).
@@ -430,6 +458,16 @@ struct usb_gadget_ops {
430 int (*pullup) (struct usb_gadget *, int is_on); 458 int (*pullup) (struct usb_gadget *, int is_on);
431 int (*ioctl)(struct usb_gadget *, 459 int (*ioctl)(struct usb_gadget *,
432 unsigned code, unsigned long param); 460 unsigned code, unsigned long param);
461 void (*get_config_params)(struct usb_dcd_config_params *);
462 int (*udc_start)(struct usb_gadget *,
463 struct usb_gadget_driver *);
464 int (*udc_stop)(struct usb_gadget *,
465 struct usb_gadget_driver *);
466
467 /* Those two are deprecated */
468 int (*start)(struct usb_gadget_driver *,
469 int (*bind)(struct usb_gadget *));
470 int (*stop)(struct usb_gadget_driver *);
433}; 471};
434 472
435/** 473/**
@@ -521,6 +559,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
521} 559}
522 560
523/** 561/**
562 * gadget_is_superspeed() - return true if the hardware handles
563 * supperspeed
564 * @g: controller that might support supper speed
565 */
566static inline int gadget_is_superspeed(struct usb_gadget *g)
567{
568#ifdef CONFIG_USB_GADGET_SUPERSPEED
569 /*
570 * runtime test would check "g->is_superspeed" ... that might be
571 * useful to work around hardware bugs, but is mostly pointless
572 */
573 return 1;
574#else
575 return 0;
576#endif
577}
578
579/**
524 * gadget_is_otg - return true iff the hardware is OTG-ready 580 * gadget_is_otg - return true iff the hardware is OTG-ready
525 * @g: controller that might have a Mini-AB connector 581 * @g: controller that might have a Mini-AB connector
526 * 582 *
@@ -821,6 +877,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
821 */ 877 */
822int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 878int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
823 879
880extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
881extern void usb_del_gadget_udc(struct usb_gadget *gadget);
882
824/*-------------------------------------------------------------------------*/ 883/*-------------------------------------------------------------------------*/
825 884
826/* utility to simplify dealing with string descriptors */ 885/* utility to simplify dealing with string descriptors */
@@ -870,12 +929,6 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
870struct usb_descriptor_header **usb_copy_descriptors( 929struct usb_descriptor_header **usb_copy_descriptors(
871 struct usb_descriptor_header **); 930 struct usb_descriptor_header **);
872 931
873/* return copy of endpoint descriptor given original descriptor set */
874struct usb_endpoint_descriptor *usb_find_endpoint(
875 struct usb_descriptor_header **src,
876 struct usb_descriptor_header **copy,
877 struct usb_endpoint_descriptor *match);
878
879/** 932/**
880 * usb_free_descriptors - free descriptors returned by usb_copy_descriptors() 933 * usb_free_descriptors - free descriptors returned by usb_copy_descriptors()
881 * @v: vector of descriptors 934 * @v: vector of descriptors
@@ -892,6 +945,11 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
892extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 945extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
893 struct usb_endpoint_descriptor *); 946 struct usb_endpoint_descriptor *);
894 947
948
949extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *,
950 struct usb_endpoint_descriptor *,
951 struct usb_ss_ep_comp_descriptor *);
952
895extern void usb_ep_autoconfig_reset(struct usb_gadget *); 953extern void usb_ep_autoconfig_reset(struct usb_gadget *);
896 954
897#endif /* __LINUX_USB_GADGET_H */ 955#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h
index cda9625e7df0..a4ba31ab2fed 100644
--- a/include/linux/usb/m66592.h
+++ b/include/linux/usb/m66592.h
@@ -38,6 +38,8 @@ struct m66592_platdata {
38 /* (external controller only) one = 3.3V, zero = 1.5V */ 38 /* (external controller only) one = 3.3V, zero = 1.5V */
39 unsigned vif:1; 39 unsigned vif:1;
40 40
41 /* (external controller only) set one = WR0_N shorted to WR1_N */
42 unsigned wr0_shorted_to_wr1:1;
41}; 43};
42 44
43#endif /* __LINUX_USB_M66592_H */ 45#endif /* __LINUX_USB_M66592_H */
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
index 26d216734057..b6b8660d0c68 100644
--- a/include/linux/usb/r8a66597.h
+++ b/include/linux/usb/r8a66597.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009 Renesas Solutions Corp. 4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * 5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> 6 * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -31,6 +31,9 @@ struct r8a66597_platdata {
31 /* This callback can control port power instead of DVSTCTR register. */ 31 /* This callback can control port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power); 32 void (*port_power)(int port, int power);
33 33
34 /* This parameter is for BUSWAIT */
35 u16 buswait;
36
34 /* set one = on chip controller, set zero = external controller */ 37 /* set one = on chip controller, set zero = external controller */
35 unsigned on_chip:1; 38 unsigned on_chip:1;
36 39
@@ -42,6 +45,9 @@ struct r8a66597_platdata {
42 45
43 /* set one = big endian, set zero = little endian */ 46 /* set one = big endian, set zero = little endian */
44 unsigned endian:1; 47 unsigned endian:1;
48
49 /* (external controller only) set one = WR0_N shorted to WR1_N */
50 unsigned wr0_shorted_to_wr1:1;
45}; 51};
46 52
47/* Register definitions */ 53/* Register definitions */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 3a7f1d982dd6..8977431259c6 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -110,6 +110,23 @@ struct renesas_usbhs_driver_param {
110 * delay time from notify_hotplug callback 110 * delay time from notify_hotplug callback
111 */ 111 */
112 int detection_delay; 112 int detection_delay;
113
114 /*
115 * option:
116 *
117 * dma id for dmaengine
118 */
119 int d0_tx_id;
120 int d0_rx_id;
121 int d1_tx_id;
122 int d1_rx_id;
123
124 /*
125 * option:
126 *
127 * pio <--> dma border.
128 */
129 int pio_dma_border; /* default is 64byte */
113}; 130};
114 131
115/* 132/*