diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-08 18:30:22 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-08 18:30:55 -0400 |
| commit | 18fbb93fbec3cfd6acf46f60990f7ab21c4221dd (patch) | |
| tree | 19599d4a2d402422b109e720e988ad16bc6e8ab4 /drivers/usb/gadget | |
| parent | 3b87218829a4182850cc62f8c0c28abcecfdf8e6 (diff) | |
| parent | 156833dc3ca3b730127c4b3045c466cca46c2767 (diff) | |
Merge branch 'for-next' of master.kernel.org:/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-next' of master.kernel.org:/pub/scm/linux/kernel/git/balbi/usb:
usb: gadget: m66592-udc: add pullup function
usb: gadget: m66592-udc: add function for external controller
usb: gadget: r8a66597-udc: add pullup function
usb: gadget: zero: add superspeed support
usb: gadget: add SS descriptors to Ethernet gadget
usb: gadget: r8a66597-udc: add support for TEST_MODE
usb: gadget: m66592-udc: add support for TEST_MODE
usb: gadget: r8a66597-udc: Make BUSWAIT configurable through platform data
usb: gadget: r8a66597-udc: fix cannot connect after rmmod gadget driver
usb: update email address in r8a66597-udc and m66592-udc
usb: musb: restore INDEX register in resume path
usb: gadget: fix up depencies
usb: gadget: fusb300_udc: fix compile warnings
usb: gadget: ci13xx_udc.c: fix compile warning
usb: gadget: net2272: fix compile warnings
usb: gadget: langwell_udc: fix compile warnings
usb: gadget: fusb300_udc: drop dead code
Diffstat (limited to 'drivers/usb/gadget')
| -rw-r--r-- | drivers/usb/gadget/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/ci13xxx_udc.c | 12 | ||||
| -rw-r--r-- | drivers/usb/gadget/ether.c | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_ecm.c | 100 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_eem.c | 56 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_loopback.c | 55 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_rndis.c | 101 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_sourcesink.c | 55 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_subset.c | 64 | ||||
| -rw-r--r-- | drivers/usb/gadget/fusb300_udc.c | 91 | ||||
| -rw-r--r-- | drivers/usb/gadget/langwell_udc.c | 12 | ||||
| -rw-r--r-- | drivers/usb/gadget/m66592-udc.c | 45 | ||||
| -rw-r--r-- | drivers/usb/gadget/m66592-udc.h | 40 | ||||
| -rw-r--r-- | drivers/usb/gadget/net2272.c | 8 | ||||
| -rw-r--r-- | drivers/usb/gadget/r8a66597-udc.c | 57 | ||||
| -rw-r--r-- | drivers/usb/gadget/r8a66597-udc.h | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/u_ether.c | 12 | ||||
| -rw-r--r-- | drivers/usb/gadget/zero.c | 2 |
18 files changed, 574 insertions, 142 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index b5b8d67f6568..44b6b40aafb4 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
| @@ -157,6 +157,7 @@ config USB_FSL_USB2 | |||
| 157 | 157 | ||
| 158 | config USB_FUSB300 | 158 | config USB_FUSB300 |
| 159 | tristate "Faraday FUSB300 USB Peripheral Controller" | 159 | tristate "Faraday FUSB300 USB Peripheral Controller" |
| 160 | depends on !PHYS_ADDR_T_64BIT | ||
| 160 | select USB_GADGET_DUALSPEED | 161 | select USB_GADGET_DUALSPEED |
| 161 | help | 162 | help |
| 162 | Faraday usb device controller FUSB300 driver | 163 | Faraday usb device controller FUSB300 driver |
| @@ -427,6 +428,7 @@ config USB_GOKU | |||
| 427 | config USB_LANGWELL | 428 | config USB_LANGWELL |
| 428 | tristate "Intel Langwell USB Device Controller" | 429 | tristate "Intel Langwell USB Device Controller" |
| 429 | depends on PCI | 430 | depends on PCI |
| 431 | depends on !PHYS_ADDR_T_64BIT | ||
| 430 | select USB_GADGET_DUALSPEED | 432 | select USB_GADGET_DUALSPEED |
| 431 | help | 433 | help |
| 432 | Intel Langwell USB Device Controller is a High-Speed USB | 434 | Intel Langwell USB Device Controller is a High-Speed USB |
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 082471650fbc..1265a8502ea0 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
| @@ -1214,12 +1214,13 @@ static DEVICE_ATTR(qheads, S_IRUSR, show_qheads, NULL); | |||
| 1214 | * | 1214 | * |
| 1215 | * Check "device.h" for details | 1215 | * Check "device.h" for details |
| 1216 | */ | 1216 | */ |
| 1217 | #define DUMP_ENTRIES 512 | ||
| 1217 | static ssize_t show_registers(struct device *dev, | 1218 | static ssize_t show_registers(struct device *dev, |
| 1218 | struct device_attribute *attr, char *buf) | 1219 | struct device_attribute *attr, char *buf) |
| 1219 | { | 1220 | { |
| 1220 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 1221 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); |
| 1221 | unsigned long flags; | 1222 | unsigned long flags; |
| 1222 | u32 dump[512]; | 1223 | u32 *dump; |
| 1223 | unsigned i, k, n = 0; | 1224 | unsigned i, k, n = 0; |
| 1224 | 1225 | ||
| 1225 | dbg_trace("[%s] %p\n", __func__, buf); | 1226 | dbg_trace("[%s] %p\n", __func__, buf); |
| @@ -1228,8 +1229,14 @@ static ssize_t show_registers(struct device *dev, | |||
| 1228 | return 0; | 1229 | return 0; |
| 1229 | } | 1230 | } |
| 1230 | 1231 | ||
| 1232 | dump = kmalloc(sizeof(u32) * DUMP_ENTRIES, GFP_KERNEL); | ||
| 1233 | if (!dump) { | ||
| 1234 | dev_err(dev, "%s: out of memory\n", __func__); | ||
| 1235 | return 0; | ||
| 1236 | } | ||
| 1237 | |||
| 1231 | spin_lock_irqsave(udc->lock, flags); | 1238 | spin_lock_irqsave(udc->lock, flags); |
| 1232 | k = hw_register_read(dump, sizeof(dump)/sizeof(u32)); | 1239 | k = hw_register_read(dump, DUMP_ENTRIES); |
| 1233 | spin_unlock_irqrestore(udc->lock, flags); | 1240 | spin_unlock_irqrestore(udc->lock, flags); |
| 1234 | 1241 | ||
| 1235 | for (i = 0; i < k; i++) { | 1242 | for (i = 0; i < k; i++) { |
| @@ -1237,6 +1244,7 @@ static ssize_t show_registers(struct device *dev, | |||
| 1237 | "reg[0x%04X] = 0x%08X\n", | 1244 | "reg[0x%04X] = 0x%08X\n", |
| 1238 | i * (unsigned)sizeof(u32), dump[i]); | 1245 | i * (unsigned)sizeof(u32), dump[i]); |
| 1239 | } | 1246 | } |
| 1247 | kfree(dump); | ||
| 1240 | 1248 | ||
| 1241 | return n; | 1249 | return n; |
| 1242 | } | 1250 | } |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index ac41858800a5..aafc84f33e26 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
| @@ -401,7 +401,7 @@ static struct usb_composite_driver eth_driver = { | |||
| 401 | .name = "g_ether", | 401 | .name = "g_ether", |
| 402 | .dev = &device_desc, | 402 | .dev = &device_desc, |
| 403 | .strings = dev_strings, | 403 | .strings = dev_strings, |
| 404 | .max_speed = USB_SPEED_HIGH, | 404 | .max_speed = USB_SPEED_SUPER, |
| 405 | .unbind = __exit_p(eth_unbind), | 405 | .unbind = __exit_p(eth_unbind), |
| 406 | }; | 406 | }; |
| 407 | 407 | ||
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index ddedbc83bc37..3691a0cb9465 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c | |||
| @@ -77,10 +77,12 @@ static inline struct f_ecm *func_to_ecm(struct usb_function *f) | |||
| 77 | /* peak (theoretical) bulk transfer rate in bits-per-second */ | 77 | /* peak (theoretical) bulk transfer rate in bits-per-second */ |
| 78 | static inline unsigned ecm_bitrate(struct usb_gadget *g) | 78 | static inline unsigned ecm_bitrate(struct usb_gadget *g) |
| 79 | { | 79 | { |
| 80 | if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | 80 | if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) |
| 81 | return 13 * 1024 * 8 * 1000 * 8; | ||
| 82 | else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | ||
| 81 | return 13 * 512 * 8 * 1000 * 8; | 83 | return 13 * 512 * 8 * 1000 * 8; |
| 82 | else | 84 | else |
| 83 | return 19 * 64 * 1 * 1000 * 8; | 85 | return 19 * 64 * 1 * 1000 * 8; |
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | /*-------------------------------------------------------------------------*/ | 88 | /*-------------------------------------------------------------------------*/ |
| @@ -210,8 +212,10 @@ static struct usb_descriptor_header *ecm_fs_function[] = { | |||
| 210 | (struct usb_descriptor_header *) &ecm_header_desc, | 212 | (struct usb_descriptor_header *) &ecm_header_desc, |
| 211 | (struct usb_descriptor_header *) &ecm_union_desc, | 213 | (struct usb_descriptor_header *) &ecm_union_desc, |
| 212 | (struct usb_descriptor_header *) &ecm_desc, | 214 | (struct usb_descriptor_header *) &ecm_desc, |
| 215 | |||
| 213 | /* NOTE: status endpoint might need to be removed */ | 216 | /* NOTE: status endpoint might need to be removed */ |
| 214 | (struct usb_descriptor_header *) &fs_ecm_notify_desc, | 217 | (struct usb_descriptor_header *) &fs_ecm_notify_desc, |
| 218 | |||
| 215 | /* data interface, altsettings 0 and 1 */ | 219 | /* data interface, altsettings 0 and 1 */ |
| 216 | (struct usb_descriptor_header *) &ecm_data_nop_intf, | 220 | (struct usb_descriptor_header *) &ecm_data_nop_intf, |
| 217 | (struct usb_descriptor_header *) &ecm_data_intf, | 221 | (struct usb_descriptor_header *) &ecm_data_intf, |
| @@ -231,6 +235,7 @@ static struct usb_endpoint_descriptor hs_ecm_notify_desc = { | |||
| 231 | .wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT), | 235 | .wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT), |
| 232 | .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, | 236 | .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, |
| 233 | }; | 237 | }; |
| 238 | |||
| 234 | static struct usb_endpoint_descriptor hs_ecm_in_desc = { | 239 | static struct usb_endpoint_descriptor hs_ecm_in_desc = { |
| 235 | .bLength = USB_DT_ENDPOINT_SIZE, | 240 | .bLength = USB_DT_ENDPOINT_SIZE, |
| 236 | .bDescriptorType = USB_DT_ENDPOINT, | 241 | .bDescriptorType = USB_DT_ENDPOINT, |
| @@ -255,8 +260,10 @@ static struct usb_descriptor_header *ecm_hs_function[] = { | |||
| 255 | (struct usb_descriptor_header *) &ecm_header_desc, | 260 | (struct usb_descriptor_header *) &ecm_header_desc, |
| 256 | (struct usb_descriptor_header *) &ecm_union_desc, | 261 | (struct usb_descriptor_header *) &ecm_union_desc, |
| 257 | (struct usb_descriptor_header *) &ecm_desc, | 262 | (struct usb_descriptor_header *) &ecm_desc, |
| 263 | |||
| 258 | /* NOTE: status endpoint might need to be removed */ | 264 | /* NOTE: status endpoint might need to be removed */ |
| 259 | (struct usb_descriptor_header *) &hs_ecm_notify_desc, | 265 | (struct usb_descriptor_header *) &hs_ecm_notify_desc, |
| 266 | |||
| 260 | /* data interface, altsettings 0 and 1 */ | 267 | /* data interface, altsettings 0 and 1 */ |
| 261 | (struct usb_descriptor_header *) &ecm_data_nop_intf, | 268 | (struct usb_descriptor_header *) &ecm_data_nop_intf, |
| 262 | (struct usb_descriptor_header *) &ecm_data_intf, | 269 | (struct usb_descriptor_header *) &ecm_data_intf, |
| @@ -265,6 +272,76 @@ static struct usb_descriptor_header *ecm_hs_function[] = { | |||
| 265 | NULL, | 272 | NULL, |
| 266 | }; | 273 | }; |
| 267 | 274 | ||
| 275 | /* super speed support: */ | ||
| 276 | |||
| 277 | static struct usb_endpoint_descriptor ss_ecm_notify_desc = { | ||
| 278 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 279 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 280 | |||
| 281 | .bEndpointAddress = USB_DIR_IN, | ||
| 282 | .bmAttributes = USB_ENDPOINT_XFER_INT, | ||
| 283 | .wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT), | ||
| 284 | .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, | ||
| 285 | }; | ||
| 286 | |||
| 287 | static struct usb_ss_ep_comp_descriptor ss_ecm_intr_comp_desc = { | ||
| 288 | .bLength = sizeof ss_ecm_intr_comp_desc, | ||
| 289 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 290 | |||
| 291 | /* the following 3 values can be tweaked if necessary */ | ||
| 292 | /* .bMaxBurst = 0, */ | ||
| 293 | /* .bmAttributes = 0, */ | ||
| 294 | .wBytesPerInterval = cpu_to_le16(ECM_STATUS_BYTECOUNT), | ||
| 295 | }; | ||
| 296 | |||
| 297 | static struct usb_endpoint_descriptor ss_ecm_in_desc = { | ||
| 298 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 299 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 300 | |||
| 301 | .bEndpointAddress = USB_DIR_IN, | ||
| 302 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 303 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 304 | }; | ||
| 305 | |||
| 306 | static struct usb_endpoint_descriptor ss_ecm_out_desc = { | ||
| 307 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 308 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 309 | |||
| 310 | .bEndpointAddress = USB_DIR_OUT, | ||
| 311 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 312 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 313 | }; | ||
| 314 | |||
| 315 | static struct usb_ss_ep_comp_descriptor ss_ecm_bulk_comp_desc = { | ||
| 316 | .bLength = sizeof ss_ecm_bulk_comp_desc, | ||
| 317 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 318 | |||
| 319 | /* the following 2 values can be tweaked if necessary */ | ||
| 320 | /* .bMaxBurst = 0, */ | ||
| 321 | /* .bmAttributes = 0, */ | ||
| 322 | }; | ||
| 323 | |||
| 324 | static struct usb_descriptor_header *ecm_ss_function[] = { | ||
| 325 | /* CDC ECM control descriptors */ | ||
| 326 | (struct usb_descriptor_header *) &ecm_control_intf, | ||
| 327 | (struct usb_descriptor_header *) &ecm_header_desc, | ||
| 328 | (struct usb_descriptor_header *) &ecm_union_desc, | ||
| 329 | (struct usb_descriptor_header *) &ecm_desc, | ||
| 330 | |||
| 331 | /* NOTE: status endpoint might need to be removed */ | ||
| 332 | (struct usb_descriptor_header *) &ss_ecm_notify_desc, | ||
| 333 | (struct usb_descriptor_header *) &ss_ecm_intr_comp_desc, | ||
| 334 | |||
| 335 | /* data interface, altsettings 0 and 1 */ | ||
| 336 | (struct usb_descriptor_header *) &ecm_data_nop_intf, | ||
| 337 | (struct usb_descriptor_header *) &ecm_data_intf, | ||
| 338 | (struct usb_descriptor_header *) &ss_ecm_in_desc, | ||
| 339 | (struct usb_descriptor_header *) &ss_ecm_bulk_comp_desc, | ||
| 340 | (struct usb_descriptor_header *) &ss_ecm_out_desc, | ||
| 341 | (struct usb_descriptor_header *) &ss_ecm_bulk_comp_desc, | ||
| 342 | NULL, | ||
| 343 | }; | ||
| 344 | |||
| 268 | /* string descriptors: */ | 345 | /* string descriptors: */ |
| 269 | 346 | ||
| 270 | static struct usb_string ecm_string_defs[] = { | 347 | static struct usb_string ecm_string_defs[] = { |
| @@ -679,6 +756,20 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 679 | goto fail; | 756 | goto fail; |
| 680 | } | 757 | } |
| 681 | 758 | ||
| 759 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
| 760 | ss_ecm_in_desc.bEndpointAddress = | ||
| 761 | fs_ecm_in_desc.bEndpointAddress; | ||
| 762 | ss_ecm_out_desc.bEndpointAddress = | ||
| 763 | fs_ecm_out_desc.bEndpointAddress; | ||
| 764 | ss_ecm_notify_desc.bEndpointAddress = | ||
| 765 | fs_ecm_notify_desc.bEndpointAddress; | ||
| 766 | |||
| 767 | /* copy descriptors, and track endpoint copies */ | ||
| 768 | f->ss_descriptors = usb_copy_descriptors(ecm_ss_function); | ||
| 769 | if (!f->ss_descriptors) | ||
| 770 | goto fail; | ||
| 771 | } | ||
| 772 | |||
| 682 | /* NOTE: all that is done without knowing or caring about | 773 | /* NOTE: all that is done without knowing or caring about |
| 683 | * the network link ... which is unavailable to this code | 774 | * the network link ... which is unavailable to this code |
| 684 | * until we're activated via set_alt(). | 775 | * until we're activated via set_alt(). |
| @@ -688,6 +779,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 688 | ecm->port.close = ecm_close; | 779 | ecm->port.close = ecm_close; |
| 689 | 780 | ||
| 690 | DBG(cdev, "CDC Ethernet: %s speed IN/%s OUT/%s NOTIFY/%s\n", | 781 | DBG(cdev, "CDC Ethernet: %s speed IN/%s OUT/%s NOTIFY/%s\n", |
| 782 | gadget_is_superspeed(c->cdev->gadget) ? "super" : | ||
| 691 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 783 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", |
| 692 | ecm->port.in_ep->name, ecm->port.out_ep->name, | 784 | ecm->port.in_ep->name, ecm->port.out_ep->name, |
| 693 | ecm->notify->name); | 785 | ecm->notify->name); |
| @@ -696,6 +788,8 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 696 | fail: | 788 | fail: |
| 697 | if (f->descriptors) | 789 | if (f->descriptors) |
| 698 | usb_free_descriptors(f->descriptors); | 790 | usb_free_descriptors(f->descriptors); |
| 791 | if (f->hs_descriptors) | ||
| 792 | usb_free_descriptors(f->hs_descriptors); | ||
| 699 | 793 | ||
| 700 | if (ecm->notify_req) { | 794 | if (ecm->notify_req) { |
| 701 | kfree(ecm->notify_req->buf); | 795 | kfree(ecm->notify_req->buf); |
| @@ -722,6 +816,8 @@ ecm_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 722 | 816 | ||
| 723 | DBG(c->cdev, "ecm unbind\n"); | 817 | DBG(c->cdev, "ecm unbind\n"); |
| 724 | 818 | ||
| 819 | if (gadget_is_superspeed(c->cdev->gadget)) | ||
| 820 | usb_free_descriptors(f->ss_descriptors); | ||
| 725 | if (gadget_is_dualspeed(c->cdev->gadget)) | 821 | if (gadget_is_dualspeed(c->cdev->gadget)) |
| 726 | usb_free_descriptors(f->hs_descriptors); | 822 | usb_free_descriptors(f->hs_descriptors); |
| 727 | usb_free_descriptors(f->descriptors); | 823 | usb_free_descriptors(f->descriptors); |
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 3e412740e2ef..046c6d0e6960 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
| @@ -115,6 +115,45 @@ static struct usb_descriptor_header *eem_hs_function[] __initdata = { | |||
| 115 | NULL, | 115 | NULL, |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | /* super speed support: */ | ||
| 119 | |||
| 120 | static struct usb_endpoint_descriptor eem_ss_in_desc __initdata = { | ||
| 121 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 122 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 123 | |||
| 124 | .bEndpointAddress = USB_DIR_IN, | ||
| 125 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 126 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 127 | }; | ||
| 128 | |||
| 129 | static struct usb_endpoint_descriptor eem_ss_out_desc __initdata = { | ||
| 130 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 131 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 132 | |||
| 133 | .bEndpointAddress = USB_DIR_OUT, | ||
| 134 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 135 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 136 | }; | ||
| 137 | |||
| 138 | static struct usb_ss_ep_comp_descriptor eem_ss_bulk_comp_desc __initdata = { | ||
| 139 | .bLength = sizeof eem_ss_bulk_comp_desc, | ||
| 140 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 141 | |||
| 142 | /* the following 2 values can be tweaked if necessary */ | ||
| 143 | /* .bMaxBurst = 0, */ | ||
| 144 | /* .bmAttributes = 0, */ | ||
| 145 | }; | ||
| 146 | |||
| 147 | static struct usb_descriptor_header *eem_ss_function[] __initdata = { | ||
| 148 | /* CDC EEM control descriptors */ | ||
| 149 | (struct usb_descriptor_header *) &eem_intf, | ||
| 150 | (struct usb_descriptor_header *) &eem_ss_in_desc, | ||
| 151 | (struct usb_descriptor_header *) &eem_ss_bulk_comp_desc, | ||
| 152 | (struct usb_descriptor_header *) &eem_ss_out_desc, | ||
| 153 | (struct usb_descriptor_header *) &eem_ss_bulk_comp_desc, | ||
| 154 | NULL, | ||
| 155 | }; | ||
| 156 | |||
| 118 | /* string descriptors: */ | 157 | /* string descriptors: */ |
| 119 | 158 | ||
| 120 | static struct usb_string eem_string_defs[] = { | 159 | static struct usb_string eem_string_defs[] = { |
| @@ -265,7 +304,20 @@ eem_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 265 | goto fail; | 304 | goto fail; |
| 266 | } | 305 | } |
| 267 | 306 | ||
| 307 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
| 308 | eem_ss_in_desc.bEndpointAddress = | ||
| 309 | eem_fs_in_desc.bEndpointAddress; | ||
| 310 | eem_ss_out_desc.bEndpointAddress = | ||
| 311 | eem_fs_out_desc.bEndpointAddress; | ||
| 312 | |||
| 313 | /* copy descriptors, and track endpoint copies */ | ||
| 314 | f->ss_descriptors = usb_copy_descriptors(eem_ss_function); | ||
| 315 | if (!f->ss_descriptors) | ||
| 316 | goto fail; | ||
| 317 | } | ||
| 318 | |||
| 268 | DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n", | 319 | DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n", |
| 320 | gadget_is_superspeed(c->cdev->gadget) ? "super" : | ||
| 269 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 321 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", |
| 270 | eem->port.in_ep->name, eem->port.out_ep->name); | 322 | eem->port.in_ep->name, eem->port.out_ep->name); |
| 271 | return 0; | 323 | return 0; |
| @@ -273,6 +325,8 @@ eem_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 273 | fail: | 325 | fail: |
| 274 | if (f->descriptors) | 326 | if (f->descriptors) |
| 275 | usb_free_descriptors(f->descriptors); | 327 | usb_free_descriptors(f->descriptors); |
| 328 | if (f->hs_descriptors) | ||
| 329 | usb_free_descriptors(f->hs_descriptors); | ||
| 276 | 330 | ||
| 277 | /* we might as well release our claims on endpoints */ | 331 | /* we might as well release our claims on endpoints */ |
| 278 | if (eem->port.out_ep->desc) | 332 | if (eem->port.out_ep->desc) |
| @@ -292,6 +346,8 @@ eem_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 292 | 346 | ||
| 293 | DBG(c->cdev, "eem unbind\n"); | 347 | DBG(c->cdev, "eem unbind\n"); |
| 294 | 348 | ||
| 349 | if (gadget_is_superspeed(c->cdev->gadget)) | ||
| 350 | usb_free_descriptors(f->ss_descriptors); | ||
| 295 | if (gadget_is_dualspeed(c->cdev->gadget)) | 351 | if (gadget_is_dualspeed(c->cdev->gadget)) |
| 296 | usb_free_descriptors(f->hs_descriptors); | 352 | usb_free_descriptors(f->hs_descriptors); |
| 297 | usb_free_descriptors(f->descriptors); | 353 | usb_free_descriptors(f->descriptors); |
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c index 375632659a03..ca660d40b11a 100644 --- a/drivers/usb/gadget/f_loopback.c +++ b/drivers/usb/gadget/f_loopback.c | |||
| @@ -118,6 +118,49 @@ static struct usb_descriptor_header *hs_loopback_descs[] = { | |||
| 118 | NULL, | 118 | NULL, |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
| 121 | /* super speed support: */ | ||
| 122 | |||
| 123 | static struct usb_endpoint_descriptor ss_loop_source_desc = { | ||
| 124 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 125 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 126 | |||
| 127 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 128 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 129 | }; | ||
| 130 | |||
| 131 | struct usb_ss_ep_comp_descriptor ss_loop_source_comp_desc = { | ||
| 132 | .bLength = USB_DT_SS_EP_COMP_SIZE, | ||
| 133 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 134 | .bMaxBurst = 0, | ||
| 135 | .bmAttributes = 0, | ||
| 136 | .wBytesPerInterval = 0, | ||
| 137 | }; | ||
| 138 | |||
| 139 | static struct usb_endpoint_descriptor ss_loop_sink_desc = { | ||
| 140 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 141 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 142 | |||
| 143 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 144 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 145 | }; | ||
| 146 | |||
| 147 | struct usb_ss_ep_comp_descriptor ss_loop_sink_comp_desc = { | ||
| 148 | .bLength = USB_DT_SS_EP_COMP_SIZE, | ||
| 149 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 150 | .bMaxBurst = 0, | ||
| 151 | .bmAttributes = 0, | ||
| 152 | .wBytesPerInterval = 0, | ||
| 153 | }; | ||
| 154 | |||
| 155 | static struct usb_descriptor_header *ss_loopback_descs[] = { | ||
| 156 | (struct usb_descriptor_header *) &loopback_intf, | ||
| 157 | (struct usb_descriptor_header *) &ss_loop_source_desc, | ||
| 158 | (struct usb_descriptor_header *) &ss_loop_source_comp_desc, | ||
| 159 | (struct usb_descriptor_header *) &ss_loop_sink_desc, | ||
| 160 | (struct usb_descriptor_header *) &ss_loop_sink_comp_desc, | ||
| 161 | NULL, | ||
| 162 | }; | ||
| 163 | |||
| 121 | /* function-specific strings: */ | 164 | /* function-specific strings: */ |
| 122 | 165 | ||
| 123 | static struct usb_string strings_loopback[] = { | 166 | static struct usb_string strings_loopback[] = { |
| @@ -175,8 +218,18 @@ autoconf_fail: | |||
| 175 | f->hs_descriptors = hs_loopback_descs; | 218 | f->hs_descriptors = hs_loopback_descs; |
| 176 | } | 219 | } |
| 177 | 220 | ||
| 221 | /* support super speed hardware */ | ||
| 222 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
| 223 | ss_loop_source_desc.bEndpointAddress = | ||
| 224 | fs_loop_source_desc.bEndpointAddress; | ||
| 225 | ss_loop_sink_desc.bEndpointAddress = | ||
| 226 | fs_loop_sink_desc.bEndpointAddress; | ||
| 227 | f->ss_descriptors = ss_loopback_descs; | ||
| 228 | } | ||
| 229 | |||
| 178 | DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", | 230 | DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", |
| 179 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 231 | (gadget_is_superspeed(c->cdev->gadget) ? "super" : |
| 232 | (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), | ||
| 180 | f->name, loop->in_ep->name, loop->out_ep->name); | 233 | f->name, loop->in_ep->name, loop->out_ep->name); |
| 181 | return 0; | 234 | return 0; |
| 182 | } | 235 | } |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index b324efa07733..8f3eae90919f 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
| @@ -95,10 +95,12 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f) | |||
| 95 | /* peak (theoretical) bulk transfer rate in bits-per-second */ | 95 | /* peak (theoretical) bulk transfer rate in bits-per-second */ |
| 96 | static unsigned int bitrate(struct usb_gadget *g) | 96 | static unsigned int bitrate(struct usb_gadget *g) |
| 97 | { | 97 | { |
| 98 | if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | 98 | if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) |
| 99 | return 13 * 1024 * 8 * 1000 * 8; | ||
| 100 | else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | ||
| 99 | return 13 * 512 * 8 * 1000 * 8; | 101 | return 13 * 512 * 8 * 1000 * 8; |
| 100 | else | 102 | else |
| 101 | return 19 * 64 * 1 * 1000 * 8; | 103 | return 19 * 64 * 1 * 1000 * 8; |
| 102 | } | 104 | } |
| 103 | 105 | ||
| 104 | /*-------------------------------------------------------------------------*/ | 106 | /*-------------------------------------------------------------------------*/ |
| @@ -216,6 +218,7 @@ static struct usb_endpoint_descriptor fs_out_desc = { | |||
| 216 | 218 | ||
| 217 | static struct usb_descriptor_header *eth_fs_function[] = { | 219 | static struct usb_descriptor_header *eth_fs_function[] = { |
| 218 | (struct usb_descriptor_header *) &rndis_iad_descriptor, | 220 | (struct usb_descriptor_header *) &rndis_iad_descriptor, |
| 221 | |||
| 219 | /* control interface matches ACM, not Ethernet */ | 222 | /* control interface matches ACM, not Ethernet */ |
| 220 | (struct usb_descriptor_header *) &rndis_control_intf, | 223 | (struct usb_descriptor_header *) &rndis_control_intf, |
| 221 | (struct usb_descriptor_header *) &header_desc, | 224 | (struct usb_descriptor_header *) &header_desc, |
| @@ -223,6 +226,7 @@ static struct usb_descriptor_header *eth_fs_function[] = { | |||
| 223 | (struct usb_descriptor_header *) &rndis_acm_descriptor, | 226 | (struct usb_descriptor_header *) &rndis_acm_descriptor, |
| 224 | (struct usb_descriptor_header *) &rndis_union_desc, | 227 | (struct usb_descriptor_header *) &rndis_union_desc, |
| 225 | (struct usb_descriptor_header *) &fs_notify_desc, | 228 | (struct usb_descriptor_header *) &fs_notify_desc, |
| 229 | |||
| 226 | /* data interface has no altsetting */ | 230 | /* data interface has no altsetting */ |
| 227 | (struct usb_descriptor_header *) &rndis_data_intf, | 231 | (struct usb_descriptor_header *) &rndis_data_intf, |
| 228 | (struct usb_descriptor_header *) &fs_in_desc, | 232 | (struct usb_descriptor_header *) &fs_in_desc, |
| @@ -241,6 +245,7 @@ static struct usb_endpoint_descriptor hs_notify_desc = { | |||
| 241 | .wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT), | 245 | .wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT), |
| 242 | .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, | 246 | .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, |
| 243 | }; | 247 | }; |
| 248 | |||
| 244 | static struct usb_endpoint_descriptor hs_in_desc = { | 249 | static struct usb_endpoint_descriptor hs_in_desc = { |
| 245 | .bLength = USB_DT_ENDPOINT_SIZE, | 250 | .bLength = USB_DT_ENDPOINT_SIZE, |
| 246 | .bDescriptorType = USB_DT_ENDPOINT, | 251 | .bDescriptorType = USB_DT_ENDPOINT, |
| @@ -261,6 +266,7 @@ static struct usb_endpoint_descriptor hs_out_desc = { | |||
| 261 | 266 | ||
| 262 | static struct usb_descriptor_header *eth_hs_function[] = { | 267 | static struct usb_descriptor_header *eth_hs_function[] = { |
| 263 | (struct usb_descriptor_header *) &rndis_iad_descriptor, | 268 | (struct usb_descriptor_header *) &rndis_iad_descriptor, |
| 269 | |||
| 264 | /* control interface matches ACM, not Ethernet */ | 270 | /* control interface matches ACM, not Ethernet */ |
| 265 | (struct usb_descriptor_header *) &rndis_control_intf, | 271 | (struct usb_descriptor_header *) &rndis_control_intf, |
| 266 | (struct usb_descriptor_header *) &header_desc, | 272 | (struct usb_descriptor_header *) &header_desc, |
| @@ -268,6 +274,7 @@ static struct usb_descriptor_header *eth_hs_function[] = { | |||
| 268 | (struct usb_descriptor_header *) &rndis_acm_descriptor, | 274 | (struct usb_descriptor_header *) &rndis_acm_descriptor, |
| 269 | (struct usb_descriptor_header *) &rndis_union_desc, | 275 | (struct usb_descriptor_header *) &rndis_union_desc, |
| 270 | (struct usb_descriptor_header *) &hs_notify_desc, | 276 | (struct usb_descriptor_header *) &hs_notify_desc, |
| 277 | |||
| 271 | /* data interface has no altsetting */ | 278 | /* data interface has no altsetting */ |
| 272 | (struct usb_descriptor_header *) &rndis_data_intf, | 279 | (struct usb_descriptor_header *) &rndis_data_intf, |
| 273 | (struct usb_descriptor_header *) &hs_in_desc, | 280 | (struct usb_descriptor_header *) &hs_in_desc, |
| @@ -275,6 +282,76 @@ static struct usb_descriptor_header *eth_hs_function[] = { | |||
| 275 | NULL, | 282 | NULL, |
| 276 | }; | 283 | }; |
| 277 | 284 | ||
| 285 | /* super speed support: */ | ||
| 286 | |||
| 287 | static struct usb_endpoint_descriptor ss_notify_desc = { | ||
| 288 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 289 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 290 | |||
| 291 | .bEndpointAddress = USB_DIR_IN, | ||
| 292 | .bmAttributes = USB_ENDPOINT_XFER_INT, | ||
| 293 | .wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT), | ||
| 294 | .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, | ||
| 295 | }; | ||
| 296 | |||
| 297 | static struct usb_ss_ep_comp_descriptor ss_intr_comp_desc = { | ||
| 298 | .bLength = sizeof ss_intr_comp_desc, | ||
| 299 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 300 | |||
| 301 | /* the following 3 values can be tweaked if necessary */ | ||
| 302 | /* .bMaxBurst = 0, */ | ||
| 303 | /* .bmAttributes = 0, */ | ||
| 304 | .wBytesPerInterval = cpu_to_le16(STATUS_BYTECOUNT), | ||
| 305 | }; | ||
| 306 | |||
| 307 | static struct usb_endpoint_descriptor ss_in_desc = { | ||
| 308 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 309 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 310 | |||
| 311 | .bEndpointAddress = USB_DIR_IN, | ||
| 312 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 313 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 314 | }; | ||
| 315 | |||
| 316 | static struct usb_endpoint_descriptor ss_out_desc = { | ||
| 317 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 318 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 319 | |||
| 320 | .bEndpointAddress = USB_DIR_OUT, | ||
| 321 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 322 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 323 | }; | ||
| 324 | |||
| 325 | static struct usb_ss_ep_comp_descriptor ss_bulk_comp_desc = { | ||
| 326 | .bLength = sizeof ss_bulk_comp_desc, | ||
| 327 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 328 | |||
| 329 | /* the following 2 values can be tweaked if necessary */ | ||
| 330 | /* .bMaxBurst = 0, */ | ||
| 331 | /* .bmAttributes = 0, */ | ||
| 332 | }; | ||
| 333 | |||
| 334 | static struct usb_descriptor_header *eth_ss_function[] = { | ||
| 335 | (struct usb_descriptor_header *) &rndis_iad_descriptor, | ||
| 336 | |||
| 337 | /* control interface matches ACM, not Ethernet */ | ||
| 338 | (struct usb_descriptor_header *) &rndis_control_intf, | ||
| 339 | (struct usb_descriptor_header *) &header_desc, | ||
| 340 | (struct usb_descriptor_header *) &call_mgmt_descriptor, | ||
| 341 | (struct usb_descriptor_header *) &rndis_acm_descriptor, | ||
| 342 | (struct usb_descriptor_header *) &rndis_union_desc, | ||
| 343 | (struct usb_descriptor_header *) &ss_notify_desc, | ||
| 344 | (struct usb_descriptor_header *) &ss_intr_comp_desc, | ||
| 345 | |||
| 346 | /* data interface has no altsetting */ | ||
| 347 | (struct usb_descriptor_header *) &rndis_data_intf, | ||
| 348 | (struct usb_descriptor_header *) &ss_in_desc, | ||
| 349 | (struct usb_descriptor_header *) &ss_bulk_comp_desc, | ||
| 350 | (struct usb_descriptor_header *) &ss_out_desc, | ||
| 351 | (struct usb_descriptor_header *) &ss_bulk_comp_desc, | ||
| 352 | NULL, | ||
| 353 | }; | ||
| 354 | |||
| 278 | /* string descriptors: */ | 355 | /* string descriptors: */ |
| 279 | 356 | ||
| 280 | static struct usb_string rndis_string_defs[] = { | 357 | static struct usb_string rndis_string_defs[] = { |
| @@ -670,11 +747,24 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 670 | 747 | ||
| 671 | /* copy descriptors, and track endpoint copies */ | 748 | /* copy descriptors, and track endpoint copies */ |
| 672 | f->hs_descriptors = usb_copy_descriptors(eth_hs_function); | 749 | f->hs_descriptors = usb_copy_descriptors(eth_hs_function); |
| 673 | |||
| 674 | if (!f->hs_descriptors) | 750 | if (!f->hs_descriptors) |
| 675 | goto fail; | 751 | goto fail; |
| 676 | } | 752 | } |
| 677 | 753 | ||
| 754 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
| 755 | ss_in_desc.bEndpointAddress = | ||
| 756 | fs_in_desc.bEndpointAddress; | ||
| 757 | ss_out_desc.bEndpointAddress = | ||
| 758 | fs_out_desc.bEndpointAddress; | ||
| 759 | ss_notify_desc.bEndpointAddress = | ||
| 760 | fs_notify_desc.bEndpointAddress; | ||
| 761 | |||
| 762 | /* copy descriptors, and track endpoint copies */ | ||
| 763 | f->ss_descriptors = usb_copy_descriptors(eth_ss_function); | ||
| 764 | if (!f->ss_descriptors) | ||
| 765 | goto fail; | ||
| 766 | } | ||
| 767 | |||
| 678 | rndis->port.open = rndis_open; | 768 | rndis->port.open = rndis_open; |
| 679 | rndis->port.close = rndis_close; | 769 | rndis->port.close = rndis_close; |
| 680 | 770 | ||
| @@ -699,12 +789,15 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 699 | */ | 789 | */ |
| 700 | 790 | ||
| 701 | DBG(cdev, "RNDIS: %s speed IN/%s OUT/%s NOTIFY/%s\n", | 791 | DBG(cdev, "RNDIS: %s speed IN/%s OUT/%s NOTIFY/%s\n", |
| 792 | gadget_is_superspeed(c->cdev->gadget) ? "super" : | ||
| 702 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 793 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", |
| 703 | rndis->port.in_ep->name, rndis->port.out_ep->name, | 794 | rndis->port.in_ep->name, rndis->port.out_ep->name, |
| 704 | rndis->notify->name); | 795 | rndis->notify->name); |
| 705 | return 0; | 796 | return 0; |
| 706 | 797 | ||
| 707 | fail: | 798 | fail: |
| 799 | if (gadget_is_superspeed(c->cdev->gadget) && f->ss_descriptors) | ||
| 800 | usb_free_descriptors(f->ss_descriptors); | ||
| 708 | if (gadget_is_dualspeed(c->cdev->gadget) && f->hs_descriptors) | 801 | if (gadget_is_dualspeed(c->cdev->gadget) && f->hs_descriptors) |
| 709 | usb_free_descriptors(f->hs_descriptors); | 802 | usb_free_descriptors(f->hs_descriptors); |
| 710 | if (f->descriptors) | 803 | if (f->descriptors) |
| @@ -736,6 +829,8 @@ rndis_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 736 | rndis_deregister(rndis->config); | 829 | rndis_deregister(rndis->config); |
| 737 | rndis_exit(); | 830 | rndis_exit(); |
| 738 | 831 | ||
| 832 | if (gadget_is_superspeed(c->cdev->gadget)) | ||
| 833 | usb_free_descriptors(f->ss_descriptors); | ||
| 739 | if (gadget_is_dualspeed(c->cdev->gadget)) | 834 | if (gadget_is_dualspeed(c->cdev->gadget)) |
| 740 | usb_free_descriptors(f->hs_descriptors); | 835 | usb_free_descriptors(f->hs_descriptors); |
| 741 | usb_free_descriptors(f->descriptors); | 836 | usb_free_descriptors(f->descriptors); |
diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c index 5a92883f4c8c..e18b4f520951 100644 --- a/drivers/usb/gadget/f_sourcesink.c +++ b/drivers/usb/gadget/f_sourcesink.c | |||
| @@ -131,6 +131,49 @@ static struct usb_descriptor_header *hs_source_sink_descs[] = { | |||
| 131 | NULL, | 131 | NULL, |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | /* super speed support: */ | ||
| 135 | |||
| 136 | static struct usb_endpoint_descriptor ss_source_desc = { | ||
| 137 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 138 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 139 | |||
| 140 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 141 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 142 | }; | ||
| 143 | |||
| 144 | struct usb_ss_ep_comp_descriptor ss_source_comp_desc = { | ||
| 145 | .bLength = USB_DT_SS_EP_COMP_SIZE, | ||
| 146 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 147 | .bMaxBurst = 0, | ||
| 148 | .bmAttributes = 0, | ||
| 149 | .wBytesPerInterval = 0, | ||
| 150 | }; | ||
| 151 | |||
| 152 | static struct usb_endpoint_descriptor ss_sink_desc = { | ||
| 153 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 154 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 155 | |||
| 156 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 157 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 158 | }; | ||
| 159 | |||
| 160 | struct usb_ss_ep_comp_descriptor ss_sink_comp_desc = { | ||
| 161 | .bLength = USB_DT_SS_EP_COMP_SIZE, | ||
| 162 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 163 | .bMaxBurst = 0, | ||
| 164 | .bmAttributes = 0, | ||
| 165 | .wBytesPerInterval = 0, | ||
| 166 | }; | ||
| 167 | |||
| 168 | static struct usb_descriptor_header *ss_source_sink_descs[] = { | ||
| 169 | (struct usb_descriptor_header *) &source_sink_intf, | ||
| 170 | (struct usb_descriptor_header *) &ss_source_desc, | ||
| 171 | (struct usb_descriptor_header *) &ss_source_comp_desc, | ||
| 172 | (struct usb_descriptor_header *) &ss_sink_desc, | ||
| 173 | (struct usb_descriptor_header *) &ss_sink_comp_desc, | ||
| 174 | NULL, | ||
| 175 | }; | ||
| 176 | |||
| 134 | /* function-specific strings: */ | 177 | /* function-specific strings: */ |
| 135 | 178 | ||
| 136 | static struct usb_string strings_sourcesink[] = { | 179 | static struct usb_string strings_sourcesink[] = { |
| @@ -187,8 +230,18 @@ autoconf_fail: | |||
| 187 | f->hs_descriptors = hs_source_sink_descs; | 230 | f->hs_descriptors = hs_source_sink_descs; |
| 188 | } | 231 | } |
| 189 | 232 | ||
| 233 | /* support super speed hardware */ | ||
| 234 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
| 235 | ss_source_desc.bEndpointAddress = | ||
| 236 | fs_source_desc.bEndpointAddress; | ||
| 237 | ss_sink_desc.bEndpointAddress = | ||
| 238 | fs_sink_desc.bEndpointAddress; | ||
| 239 | f->ss_descriptors = ss_source_sink_descs; | ||
| 240 | } | ||
| 241 | |||
| 190 | DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", | 242 | DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", |
| 191 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 243 | (gadget_is_superspeed(c->cdev->gadget) ? "super" : |
| 244 | (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), | ||
| 192 | f->name, ss->in_ep->name, ss->out_ep->name); | 245 | f->name, ss->in_ep->name, ss->out_ep->name); |
| 193 | return 0; | 246 | return 0; |
| 194 | } | 247 | } |
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c index 93bf676ef507..3dc53754ab60 100644 --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c | |||
| @@ -201,6 +201,46 @@ static struct usb_descriptor_header *hs_eth_function[] __initdata = { | |||
| 201 | NULL, | 201 | NULL, |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
| 204 | /* super speed support: */ | ||
| 205 | |||
| 206 | static struct usb_endpoint_descriptor ss_subset_in_desc __initdata = { | ||
| 207 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 208 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 209 | |||
| 210 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 211 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 212 | }; | ||
| 213 | |||
| 214 | static struct usb_endpoint_descriptor ss_subset_out_desc __initdata = { | ||
| 215 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
| 216 | .bDescriptorType = USB_DT_ENDPOINT, | ||
| 217 | |||
| 218 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
| 219 | .wMaxPacketSize = cpu_to_le16(1024), | ||
| 220 | }; | ||
| 221 | |||
| 222 | static struct usb_ss_ep_comp_descriptor ss_subset_bulk_comp_desc __initdata = { | ||
| 223 | .bLength = sizeof ss_subset_bulk_comp_desc, | ||
| 224 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
| 225 | |||
| 226 | /* the following 2 values can be tweaked if necessary */ | ||
| 227 | /* .bMaxBurst = 0, */ | ||
| 228 | /* .bmAttributes = 0, */ | ||
| 229 | }; | ||
| 230 | |||
| 231 | static struct usb_descriptor_header *ss_eth_function[] __initdata = { | ||
| 232 | (struct usb_descriptor_header *) &subset_data_intf, | ||
| 233 | (struct usb_descriptor_header *) &mdlm_header_desc, | ||
| 234 | (struct usb_descriptor_header *) &mdlm_desc, | ||
| 235 | (struct usb_descriptor_header *) &mdlm_detail_desc, | ||
| 236 | (struct usb_descriptor_header *) ðer_desc, | ||
| 237 | (struct usb_descriptor_header *) &ss_subset_in_desc, | ||
| 238 | (struct usb_descriptor_header *) &ss_subset_bulk_comp_desc, | ||
| 239 | (struct usb_descriptor_header *) &ss_subset_out_desc, | ||
| 240 | (struct usb_descriptor_header *) &ss_subset_bulk_comp_desc, | ||
| 241 | NULL, | ||
| 242 | }; | ||
| 243 | |||
| 204 | /* string descriptors: */ | 244 | /* string descriptors: */ |
| 205 | 245 | ||
| 206 | static struct usb_string geth_string_defs[] = { | 246 | static struct usb_string geth_string_defs[] = { |
| @@ -290,6 +330,8 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 290 | 330 | ||
| 291 | /* copy descriptors, and track endpoint copies */ | 331 | /* copy descriptors, and track endpoint copies */ |
| 292 | f->descriptors = usb_copy_descriptors(fs_eth_function); | 332 | f->descriptors = usb_copy_descriptors(fs_eth_function); |
| 333 | if (!f->descriptors) | ||
| 334 | goto fail; | ||
| 293 | 335 | ||
| 294 | /* support all relevant hardware speeds... we expect that when | 336 | /* support all relevant hardware speeds... we expect that when |
| 295 | * hardware is dual speed, all bulk-capable endpoints work at | 337 | * hardware is dual speed, all bulk-capable endpoints work at |
| @@ -303,6 +345,20 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 303 | 345 | ||
| 304 | /* copy descriptors, and track endpoint copies */ | 346 | /* copy descriptors, and track endpoint copies */ |
| 305 | f->hs_descriptors = usb_copy_descriptors(hs_eth_function); | 347 | f->hs_descriptors = usb_copy_descriptors(hs_eth_function); |
| 348 | if (!f->hs_descriptors) | ||
| 349 | goto fail; | ||
| 350 | } | ||
| 351 | |||
| 352 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
| 353 | ss_subset_in_desc.bEndpointAddress = | ||
| 354 | fs_subset_in_desc.bEndpointAddress; | ||
| 355 | ss_subset_out_desc.bEndpointAddress = | ||
| 356 | fs_subset_out_desc.bEndpointAddress; | ||
| 357 | |||
| 358 | /* copy descriptors, and track endpoint copies */ | ||
| 359 | f->ss_descriptors = usb_copy_descriptors(ss_eth_function); | ||
| 360 | if (!f->ss_descriptors) | ||
| 361 | goto fail; | ||
| 306 | } | 362 | } |
| 307 | 363 | ||
| 308 | /* NOTE: all that is done without knowing or caring about | 364 | /* NOTE: all that is done without knowing or caring about |
| @@ -311,11 +367,17 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 311 | */ | 367 | */ |
| 312 | 368 | ||
| 313 | DBG(cdev, "CDC Subset: %s speed IN/%s OUT/%s\n", | 369 | DBG(cdev, "CDC Subset: %s speed IN/%s OUT/%s\n", |
| 370 | gadget_is_superspeed(c->cdev->gadget) ? "super" : | ||
| 314 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 371 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", |
| 315 | geth->port.in_ep->name, geth->port.out_ep->name); | 372 | geth->port.in_ep->name, geth->port.out_ep->name); |
| 316 | return 0; | 373 | return 0; |
| 317 | 374 | ||
| 318 | fail: | 375 | fail: |
| 376 | if (f->descriptors) | ||
| 377 | usb_free_descriptors(f->descriptors); | ||
| 378 | if (f->hs_descriptors) | ||
| 379 | usb_free_descriptors(f->hs_descriptors); | ||
| 380 | |||
| 319 | /* we might as well release our claims on endpoints */ | 381 | /* we might as well release our claims on endpoints */ |
| 320 | if (geth->port.out_ep->desc) | 382 | if (geth->port.out_ep->desc) |
| 321 | geth->port.out_ep->driver_data = NULL; | 383 | geth->port.out_ep->driver_data = NULL; |
| @@ -330,6 +392,8 @@ fail: | |||
| 330 | static void | 392 | static void |
| 331 | geth_unbind(struct usb_configuration *c, struct usb_function *f) | 393 | geth_unbind(struct usb_configuration *c, struct usb_function *f) |
| 332 | { | 394 | { |
| 395 | if (gadget_is_superspeed(c->cdev->gadget)) | ||
| 396 | usb_free_descriptors(f->ss_descriptors); | ||
| 333 | if (gadget_is_dualspeed(c->cdev->gadget)) | 397 | if (gadget_is_dualspeed(c->cdev->gadget)) |
| 334 | usb_free_descriptors(f->hs_descriptors); | 398 | usb_free_descriptors(f->hs_descriptors); |
| 335 | usb_free_descriptors(f->descriptors); | 399 | usb_free_descriptors(f->descriptors); |
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c index 06353e7ba1fb..24a924330c81 100644 --- a/drivers/usb/gadget/fusb300_udc.c +++ b/drivers/usb/gadget/fusb300_udc.c | |||
| @@ -767,56 +767,6 @@ static void fusb300_rdfifo(struct fusb300_ep *ep, | |||
| 767 | } while (!reg); | 767 | } while (!reg); |
| 768 | } | 768 | } |
| 769 | 769 | ||
| 770 | /* write data to fifo */ | ||
| 771 | static void fusb300_wrfifo(struct fusb300_ep *ep, | ||
| 772 | struct fusb300_request *req) | ||
| 773 | { | ||
| 774 | int i = 0; | ||
| 775 | u8 *tmp; | ||
| 776 | u32 data, reg; | ||
| 777 | struct fusb300 *fusb300 = ep->fusb300; | ||
| 778 | |||
| 779 | tmp = req->req.buf; | ||
| 780 | req->req.actual = req->req.length; | ||
| 781 | |||
| 782 | for (i = (req->req.length >> 2); i > 0; i--) { | ||
| 783 | data = *tmp | *(tmp + 1) << 8 | | ||
| 784 | *(tmp + 2) << 16 | *(tmp + 3) << 24; | ||
| 785 | |||
| 786 | iowrite32(data, fusb300->reg + | ||
| 787 | FUSB300_OFFSET_EPPORT(ep->epnum)); | ||
| 788 | tmp += 4; | ||
| 789 | } | ||
| 790 | |||
| 791 | switch (req->req.length % 4) { | ||
| 792 | case 1: | ||
| 793 | data = *tmp; | ||
| 794 | iowrite32(data, fusb300->reg + | ||
| 795 | FUSB300_OFFSET_EPPORT(ep->epnum)); | ||
| 796 | break; | ||
| 797 | case 2: | ||
| 798 | data = *tmp | *(tmp + 1) << 8; | ||
| 799 | iowrite32(data, fusb300->reg + | ||
| 800 | FUSB300_OFFSET_EPPORT(ep->epnum)); | ||
| 801 | break; | ||
| 802 | case 3: | ||
| 803 | data = *tmp | *(tmp + 1) << 8 | *(tmp + 2) << 16; | ||
| 804 | iowrite32(data, fusb300->reg + | ||
| 805 | FUSB300_OFFSET_EPPORT(ep->epnum)); | ||
| 806 | break; | ||
| 807 | default: | ||
| 808 | break; | ||
| 809 | } | ||
| 810 | |||
| 811 | do { | ||
| 812 | reg = ioread32(fusb300->reg + FUSB300_OFFSET_IGR1); | ||
| 813 | reg &= FUSB300_IGR1_SYNF0_EMPTY_INT; | ||
| 814 | if (i) | ||
| 815 | printk(KERN_INFO"sync fifo is not empty!\n"); | ||
| 816 | i++; | ||
| 817 | } while (!reg); | ||
| 818 | } | ||
| 819 | |||
| 820 | static u8 fusb300_get_epnstall(struct fusb300 *fusb300, u8 ep) | 770 | static u8 fusb300_get_epnstall(struct fusb300 *fusb300, u8 ep) |
| 821 | { | 771 | { |
| 822 | u8 value; | 772 | u8 value; |
| @@ -1024,17 +974,6 @@ static int setup_packet(struct fusb300 *fusb300, struct usb_ctrlrequest *ctrl) | |||
| 1024 | return ret; | 974 | return ret; |
| 1025 | } | 975 | } |
| 1026 | 976 | ||
| 1027 | static void fusb300_set_ep_bycnt(struct fusb300_ep *ep, u32 bycnt) | ||
| 1028 | { | ||
| 1029 | struct fusb300 *fusb300 = ep->fusb300; | ||
| 1030 | u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPFFR(ep->epnum)); | ||
| 1031 | |||
| 1032 | reg &= ~FUSB300_FFR_BYCNT; | ||
| 1033 | reg |= bycnt & FUSB300_FFR_BYCNT; | ||
| 1034 | |||
| 1035 | iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPFFR(ep->epnum)); | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | static void done(struct fusb300_ep *ep, struct fusb300_request *req, | 977 | static void done(struct fusb300_ep *ep, struct fusb300_request *req, |
| 1039 | int status) | 978 | int status) |
| 1040 | { | 979 | { |
| @@ -1058,8 +997,8 @@ static void done(struct fusb300_ep *ep, struct fusb300_request *req, | |||
| 1058 | fusb300_set_cxdone(ep->fusb300); | 997 | fusb300_set_cxdone(ep->fusb300); |
| 1059 | } | 998 | } |
| 1060 | 999 | ||
| 1061 | void fusb300_fill_idma_prdtbl(struct fusb300_ep *ep, | 1000 | static void fusb300_fill_idma_prdtbl(struct fusb300_ep *ep, dma_addr_t d, |
| 1062 | struct fusb300_request *req) | 1001 | u32 len) |
| 1063 | { | 1002 | { |
| 1064 | u32 value; | 1003 | u32 value; |
| 1065 | u32 reg; | 1004 | u32 reg; |
| @@ -1071,10 +1010,9 @@ void fusb300_fill_idma_prdtbl(struct fusb300_ep *ep, | |||
| 1071 | reg &= FUSB300_EPPRD0_H; | 1010 | reg &= FUSB300_EPPRD0_H; |
| 1072 | } while (reg); | 1011 | } while (reg); |
| 1073 | 1012 | ||
| 1074 | iowrite32((u32) req->req.buf, ep->fusb300->reg + | 1013 | iowrite32(d, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W1(ep->epnum)); |
| 1075 | FUSB300_OFFSET_EPPRD_W1(ep->epnum)); | ||
| 1076 | 1014 | ||
| 1077 | value = FUSB300_EPPRD0_BTC(req->req.length) | FUSB300_EPPRD0_H | | 1015 | value = FUSB300_EPPRD0_BTC(len) | FUSB300_EPPRD0_H | |
| 1078 | FUSB300_EPPRD0_F | FUSB300_EPPRD0_L | FUSB300_EPPRD0_I; | 1016 | FUSB300_EPPRD0_F | FUSB300_EPPRD0_L | FUSB300_EPPRD0_I; |
| 1079 | iowrite32(value, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W0(ep->epnum)); | 1017 | iowrite32(value, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W0(ep->epnum)); |
| 1080 | 1018 | ||
| @@ -1111,13 +1049,12 @@ static void fusb300_set_idma(struct fusb300_ep *ep, | |||
| 1111 | struct fusb300_request *req) | 1049 | struct fusb300_request *req) |
| 1112 | { | 1050 | { |
| 1113 | dma_addr_t d; | 1051 | dma_addr_t d; |
| 1114 | u8 *tmp = NULL; | ||
| 1115 | 1052 | ||
| 1116 | d = dma_map_single(NULL, req->req.buf, req->req.length, DMA_TO_DEVICE); | 1053 | d = dma_map_single(NULL, req->req.buf, req->req.length, DMA_TO_DEVICE); |
| 1117 | 1054 | ||
| 1118 | if (dma_mapping_error(NULL, d)) { | 1055 | if (dma_mapping_error(NULL, d)) { |
| 1119 | kfree(req->req.buf); | ||
| 1120 | printk(KERN_DEBUG "dma_mapping_error\n"); | 1056 | printk(KERN_DEBUG "dma_mapping_error\n"); |
| 1057 | return; | ||
| 1121 | } | 1058 | } |
| 1122 | 1059 | ||
| 1123 | dma_sync_single_for_device(NULL, d, req->req.length, DMA_TO_DEVICE); | 1060 | dma_sync_single_for_device(NULL, d, req->req.length, DMA_TO_DEVICE); |
| @@ -1125,17 +1062,11 @@ static void fusb300_set_idma(struct fusb300_ep *ep, | |||
| 1125 | fusb300_enable_bit(ep->fusb300, FUSB300_OFFSET_IGER0, | 1062 | fusb300_enable_bit(ep->fusb300, FUSB300_OFFSET_IGER0, |
| 1126 | FUSB300_IGER0_EEPn_PRD_INT(ep->epnum)); | 1063 | FUSB300_IGER0_EEPn_PRD_INT(ep->epnum)); |
| 1127 | 1064 | ||
| 1128 | tmp = req->req.buf; | 1065 | fusb300_fill_idma_prdtbl(ep, d, req->req.length); |
| 1129 | req->req.buf = (u8 *)d; | ||
| 1130 | |||
| 1131 | fusb300_fill_idma_prdtbl(ep, req); | ||
| 1132 | /* check idma is done */ | 1066 | /* check idma is done */ |
| 1133 | fusb300_wait_idma_finished(ep); | 1067 | fusb300_wait_idma_finished(ep); |
| 1134 | 1068 | ||
| 1135 | req->req.buf = tmp; | 1069 | dma_unmap_single(NULL, d, req->req.length, DMA_TO_DEVICE); |
| 1136 | |||
| 1137 | if (d) | ||
| 1138 | dma_unmap_single(NULL, d, req->req.length, DMA_TO_DEVICE); | ||
| 1139 | } | 1070 | } |
| 1140 | 1071 | ||
| 1141 | static void in_ep_fifo_handler(struct fusb300_ep *ep) | 1072 | static void in_ep_fifo_handler(struct fusb300_ep *ep) |
| @@ -1143,14 +1074,8 @@ static void in_ep_fifo_handler(struct fusb300_ep *ep) | |||
| 1143 | struct fusb300_request *req = list_entry(ep->queue.next, | 1074 | struct fusb300_request *req = list_entry(ep->queue.next, |
| 1144 | struct fusb300_request, queue); | 1075 | struct fusb300_request, queue); |
| 1145 | 1076 | ||
| 1146 | if (req->req.length) { | 1077 | if (req->req.length) |
| 1147 | #if 0 | ||
| 1148 | fusb300_set_ep_bycnt(ep, req->req.length); | ||
| 1149 | fusb300_wrfifo(ep, req); | ||
| 1150 | #else | ||
| 1151 | fusb300_set_idma(ep, req); | 1078 | fusb300_set_idma(ep, req); |
| 1152 | #endif | ||
| 1153 | } | ||
| 1154 | done(ep, req, 0); | 1079 | done(ep, req, 0); |
| 1155 | } | 1080 | } |
| 1156 | 1081 | ||
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index d8403ae3c2b3..a06e2c27b435 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c | |||
| @@ -593,8 +593,8 @@ static int queue_dtd(struct langwell_ep *ep, struct langwell_request *req) | |||
| 593 | /* ep0 */ | 593 | /* ep0 */ |
| 594 | dev_vdbg(&dev->pdev->dev, "%s-%s\n", ep->name, DIR_STRING(ep)); | 594 | dev_vdbg(&dev->pdev->dev, "%s-%s\n", ep->name, DIR_STRING(ep)); |
| 595 | 595 | ||
| 596 | dev_vdbg(&dev->pdev->dev, "ep_dqh[%d] addr: 0x%08x\n", | 596 | dev_vdbg(&dev->pdev->dev, "ep_dqh[%d] addr: 0x%p\n", |
| 597 | i, (u32)&(dev->ep_dqh[i])); | 597 | i, &(dev->ep_dqh[i])); |
| 598 | 598 | ||
| 599 | bit_mask = is_in(ep) ? | 599 | bit_mask = is_in(ep) ? |
| 600 | (1 << (ep->ep_num + 16)) : (1 << (ep->ep_num)); | 600 | (1 << (ep->ep_num + 16)) : (1 << (ep->ep_num)); |
| @@ -3271,7 +3271,7 @@ static int langwell_udc_probe(struct pci_dev *pdev, | |||
| 3271 | 3271 | ||
| 3272 | /* allocate device dQH memory */ | 3272 | /* allocate device dQH memory */ |
| 3273 | size = dev->ep_max * sizeof(struct langwell_dqh); | 3273 | size = dev->ep_max * sizeof(struct langwell_dqh); |
| 3274 | dev_vdbg(&dev->pdev->dev, "orig size = %d\n", size); | 3274 | dev_vdbg(&dev->pdev->dev, "orig size = %zd\n", size); |
| 3275 | if (size < DQH_ALIGNMENT) | 3275 | if (size < DQH_ALIGNMENT) |
| 3276 | size = DQH_ALIGNMENT; | 3276 | size = DQH_ALIGNMENT; |
| 3277 | else if ((size % DQH_ALIGNMENT) != 0) { | 3277 | else if ((size % DQH_ALIGNMENT) != 0) { |
| @@ -3286,7 +3286,7 @@ static int langwell_udc_probe(struct pci_dev *pdev, | |||
| 3286 | goto error; | 3286 | goto error; |
| 3287 | } | 3287 | } |
| 3288 | dev->ep_dqh_size = size; | 3288 | dev->ep_dqh_size = size; |
| 3289 | dev_vdbg(&dev->pdev->dev, "ep_dqh_size = %d\n", dev->ep_dqh_size); | 3289 | dev_vdbg(&dev->pdev->dev, "ep_dqh_size = %zd\n", dev->ep_dqh_size); |
| 3290 | 3290 | ||
| 3291 | /* initialize ep0 status request structure */ | 3291 | /* initialize ep0 status request structure */ |
| 3292 | dev->status_req = kzalloc(sizeof(struct langwell_request), GFP_KERNEL); | 3292 | dev->status_req = kzalloc(sizeof(struct langwell_request), GFP_KERNEL); |
| @@ -3470,7 +3470,7 @@ static int langwell_udc_resume(struct pci_dev *pdev) | |||
| 3470 | 3470 | ||
| 3471 | /* allocate device dQH memory */ | 3471 | /* allocate device dQH memory */ |
| 3472 | size = dev->ep_max * sizeof(struct langwell_dqh); | 3472 | size = dev->ep_max * sizeof(struct langwell_dqh); |
| 3473 | dev_vdbg(&dev->pdev->dev, "orig size = %d\n", size); | 3473 | dev_vdbg(&dev->pdev->dev, "orig size = %zd\n", size); |
| 3474 | if (size < DQH_ALIGNMENT) | 3474 | if (size < DQH_ALIGNMENT) |
| 3475 | size = DQH_ALIGNMENT; | 3475 | size = DQH_ALIGNMENT; |
| 3476 | else if ((size % DQH_ALIGNMENT) != 0) { | 3476 | else if ((size % DQH_ALIGNMENT) != 0) { |
| @@ -3484,7 +3484,7 @@ static int langwell_udc_resume(struct pci_dev *pdev) | |||
| 3484 | return -ENOMEM; | 3484 | return -ENOMEM; |
| 3485 | } | 3485 | } |
| 3486 | dev->ep_dqh_size = size; | 3486 | dev->ep_dqh_size = size; |
| 3487 | dev_vdbg(&dev->pdev->dev, "ep_dqh_size = %d\n", dev->ep_dqh_size); | 3487 | dev_vdbg(&dev->pdev->dev, "ep_dqh_size = %zd\n", dev->ep_dqh_size); |
| 3488 | 3488 | ||
| 3489 | /* create dTD dma_pool resource */ | 3489 | /* create dTD dma_pool resource */ |
| 3490 | dev->dtd_pool = dma_pool_create("langwell_dtd", | 3490 | dev->dtd_pool = dma_pool_create("langwell_dtd", |
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 11d37821ce7a..491f825ed5c9 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006-2007 Renesas Solutions Corp. | 4 | * Copyright (C) 2006-2007 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 |
| @@ -691,6 +691,7 @@ static void init_controller(struct m66592 *m66592) | |||
| 691 | 691 | ||
| 692 | static void disable_controller(struct m66592 *m66592) | 692 | static void disable_controller(struct m66592 *m66592) |
| 693 | { | 693 | { |
| 694 | m66592_bclr(m66592, M66592_UTST, M66592_TESTMODE); | ||
| 694 | if (!m66592->pdata->on_chip) { | 695 | if (!m66592->pdata->on_chip) { |
| 695 | m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); | 696 | m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); |
| 696 | udelay(1); | 697 | udelay(1); |
| @@ -780,7 +781,7 @@ static void irq_ep0_write(struct m66592_ep *ep, struct m66592_request *req) | |||
| 780 | /* write fifo */ | 781 | /* write fifo */ |
| 781 | if (req->req.buf) { | 782 | if (req->req.buf) { |
| 782 | if (size > 0) | 783 | if (size > 0) |
| 783 | m66592_write_fifo(m66592, ep->fifoaddr, buf, size); | 784 | m66592_write_fifo(m66592, ep, buf, size); |
| 784 | if ((size == 0) || ((size % ep->ep.maxpacket) != 0)) | 785 | if ((size == 0) || ((size % ep->ep.maxpacket) != 0)) |
| 785 | m66592_bset(m66592, M66592_BVAL, ep->fifoctr); | 786 | m66592_bset(m66592, M66592_BVAL, ep->fifoctr); |
| 786 | } | 787 | } |
| @@ -826,7 +827,7 @@ static void irq_packet_write(struct m66592_ep *ep, struct m66592_request *req) | |||
| 826 | 827 | ||
| 827 | /* write fifo */ | 828 | /* write fifo */ |
| 828 | if (req->req.buf) { | 829 | if (req->req.buf) { |
| 829 | m66592_write_fifo(m66592, ep->fifoaddr, buf, size); | 830 | m66592_write_fifo(m66592, ep, buf, size); |
| 830 | if ((size == 0) | 831 | if ((size == 0) |
| 831 | || ((size % ep->ep.maxpacket) != 0) | 832 | || ((size % ep->ep.maxpacket) != 0) |
| 832 | || ((bufsize != ep->ep.maxpacket) | 833 | || ((bufsize != ep->ep.maxpacket) |
| @@ -1048,10 +1049,30 @@ static void clear_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl) | |||
| 1048 | 1049 | ||
| 1049 | static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl) | 1050 | static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl) |
| 1050 | { | 1051 | { |
| 1052 | u16 tmp; | ||
| 1053 | int timeout = 3000; | ||
| 1051 | 1054 | ||
| 1052 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 1055 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
| 1053 | case USB_RECIP_DEVICE: | 1056 | case USB_RECIP_DEVICE: |
| 1054 | control_end(m66592, 1); | 1057 | switch (le16_to_cpu(ctrl->wValue)) { |
| 1058 | case USB_DEVICE_TEST_MODE: | ||
| 1059 | control_end(m66592, 1); | ||
| 1060 | /* Wait for the completion of status stage */ | ||
| 1061 | do { | ||
| 1062 | tmp = m66592_read(m66592, M66592_INTSTS0) & | ||
| 1063 | M66592_CTSQ; | ||
| 1064 | udelay(1); | ||
| 1065 | } while (tmp != M66592_CS_IDST || timeout-- > 0); | ||
| 1066 | |||
| 1067 | if (tmp == M66592_CS_IDST) | ||
| 1068 | m66592_bset(m66592, | ||
| 1069 | le16_to_cpu(ctrl->wIndex >> 8), | ||
| 1070 | M66592_TESTMODE); | ||
| 1071 | break; | ||
| 1072 | default: | ||
| 1073 | pipe_stall(m66592, 0); | ||
| 1074 | break; | ||
| 1075 | } | ||
| 1055 | break; | 1076 | break; |
| 1056 | case USB_RECIP_INTERFACE: | 1077 | case USB_RECIP_INTERFACE: |
| 1057 | control_end(m66592, 1); | 1078 | control_end(m66592, 1); |
| @@ -1540,10 +1561,26 @@ static int m66592_get_frame(struct usb_gadget *_gadget) | |||
| 1540 | return m66592_read(m66592, M66592_FRMNUM) & 0x03FF; | 1561 | return m66592_read(m66592, M66592_FRMNUM) & 0x03FF; |
| 1541 | } | 1562 | } |
| 1542 | 1563 | ||
| 1564 | static int m66592_pullup(struct usb_gadget *gadget, int is_on) | ||
| 1565 | { | ||
| 1566 | struct m66592 *m66592 = gadget_to_m66592(gadget); | ||
| 1567 | unsigned long flags; | ||
| 1568 | |||
| 1569 | spin_lock_irqsave(&m66592->lock, flags); | ||
| 1570 | if (is_on) | ||
| 1571 | m66592_bset(m66592, M66592_DPRPU, M66592_SYSCFG); | ||
| 1572 | else | ||
| 1573 | m66592_bclr(m66592, M66592_DPRPU, M66592_SYSCFG); | ||
| 1574 | spin_unlock_irqrestore(&m66592->lock, flags); | ||
| 1575 | |||
| 1576 | return 0; | ||
| 1577 | } | ||
| 1578 | |||
| 1543 | static struct usb_gadget_ops m66592_gadget_ops = { | 1579 | static struct usb_gadget_ops m66592_gadget_ops = { |
| 1544 | .get_frame = m66592_get_frame, | 1580 | .get_frame = m66592_get_frame, |
| 1545 | .start = m66592_start, | 1581 | .start = m66592_start, |
| 1546 | .stop = m66592_stop, | 1582 | .stop = m66592_stop, |
| 1583 | .pullup = m66592_pullup, | ||
| 1547 | }; | 1584 | }; |
| 1548 | 1585 | ||
| 1549 | static int __exit m66592_remove(struct platform_device *pdev) | 1586 | static int __exit m66592_remove(struct platform_device *pdev) |
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h index c3caf1ac73ce..7b93d579af37 100644 --- a/drivers/usb/gadget/m66592-udc.h +++ b/drivers/usb/gadget/m66592-udc.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006-2007 Renesas Solutions Corp. | 4 | * Copyright (C) 2006-2007 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 |
| @@ -561,11 +561,26 @@ static inline void m66592_write(struct m66592 *m66592, u16 val, | |||
| 561 | iowrite16(val, m66592->reg + offset); | 561 | iowrite16(val, m66592->reg + offset); |
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | static inline void m66592_mdfy(struct m66592 *m66592, u16 val, u16 pat, | ||
| 565 | unsigned long offset) | ||
| 566 | { | ||
| 567 | u16 tmp; | ||
| 568 | tmp = m66592_read(m66592, offset); | ||
| 569 | tmp = tmp & (~pat); | ||
| 570 | tmp = tmp | val; | ||
| 571 | m66592_write(m66592, tmp, offset); | ||
| 572 | } | ||
| 573 | |||
| 574 | #define m66592_bclr(m66592, val, offset) \ | ||
| 575 | m66592_mdfy(m66592, 0, val, offset) | ||
| 576 | #define m66592_bset(m66592, val, offset) \ | ||
| 577 | m66592_mdfy(m66592, val, 0, offset) | ||
| 578 | |||
| 564 | static inline void m66592_write_fifo(struct m66592 *m66592, | 579 | static inline void m66592_write_fifo(struct m66592 *m66592, |
| 565 | unsigned long offset, | 580 | struct m66592_ep *ep, |
| 566 | void *buf, unsigned long len) | 581 | void *buf, unsigned long len) |
| 567 | { | 582 | { |
| 568 | void __iomem *fifoaddr = m66592->reg + offset; | 583 | void __iomem *fifoaddr = m66592->reg + ep->fifoaddr; |
| 569 | 584 | ||
| 570 | if (m66592->pdata->on_chip) { | 585 | if (m66592->pdata->on_chip) { |
| 571 | unsigned long count; | 586 | unsigned long count; |
| @@ -591,26 +606,15 @@ static inline void m66592_write_fifo(struct m66592 *m66592, | |||
| 591 | iowrite16_rep(fifoaddr, buf, len); | 606 | iowrite16_rep(fifoaddr, buf, len); |
| 592 | if (odd) { | 607 | if (odd) { |
| 593 | unsigned char *p = buf + len*2; | 608 | unsigned char *p = buf + len*2; |
| 609 | if (m66592->pdata->wr0_shorted_to_wr1) | ||
| 610 | m66592_bclr(m66592, M66592_MBW_16, ep->fifosel); | ||
| 594 | iowrite8(*p, fifoaddr); | 611 | iowrite8(*p, fifoaddr); |
| 612 | if (m66592->pdata->wr0_shorted_to_wr1) | ||
| 613 | m66592_bset(m66592, M66592_MBW_16, ep->fifosel); | ||
| 595 | } | 614 | } |
| 596 | } | 615 | } |
| 597 | } | 616 | } |
| 598 | 617 | ||
| 599 | static inline void m66592_mdfy(struct m66592 *m66592, u16 val, u16 pat, | ||
| 600 | unsigned long offset) | ||
| 601 | { | ||
| 602 | u16 tmp; | ||
| 603 | tmp = m66592_read(m66592, offset); | ||
| 604 | tmp = tmp & (~pat); | ||
| 605 | tmp = tmp | val; | ||
| 606 | m66592_write(m66592, tmp, offset); | ||
| 607 | } | ||
| 608 | |||
| 609 | #define m66592_bclr(m66592, val, offset) \ | ||
| 610 | m66592_mdfy(m66592, 0, val, offset) | ||
| 611 | #define m66592_bset(m66592, val, offset) \ | ||
| 612 | m66592_mdfy(m66592, val, 0, offset) | ||
| 613 | |||
| 614 | #endif /* ifndef __M66592_UDC_H__ */ | 618 | #endif /* ifndef __M66592_UDC_H__ */ |
| 615 | 619 | ||
| 616 | 620 | ||
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 6065bdfd83bb..7c7b0e120d88 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
| @@ -737,8 +737,8 @@ net2272_kick_dma(struct net2272_ep *ep, struct net2272_request *req) | |||
| 737 | if (req->req.length & 1) | 737 | if (req->req.length & 1) |
| 738 | return -EINVAL; | 738 | return -EINVAL; |
| 739 | 739 | ||
| 740 | dev_vdbg(ep->dev->dev, "kick_dma %s req %p dma %08x\n", | 740 | dev_vdbg(ep->dev->dev, "kick_dma %s req %p dma %08llx\n", |
| 741 | ep->ep.name, req, req->req.dma); | 741 | ep->ep.name, req, (unsigned long long) req->req.dma); |
| 742 | 742 | ||
| 743 | net2272_ep_write(ep, EP_RSPSET, 1 << ALT_NAK_OUT_PACKETS); | 743 | net2272_ep_write(ep, EP_RSPSET, 1 << ALT_NAK_OUT_PACKETS); |
| 744 | 744 | ||
| @@ -856,9 +856,9 @@ net2272_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
| 856 | req->mapped = 1; | 856 | req->mapped = 1; |
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | dev_vdbg(dev->dev, "%s queue req %p, len %d buf %p dma %08x %s\n", | 859 | dev_vdbg(dev->dev, "%s queue req %p, len %d buf %p dma %08llx %s\n", |
| 860 | _ep->name, _req, _req->length, _req->buf, | 860 | _ep->name, _req, _req->length, _req->buf, |
| 861 | _req->dma, _req->zero ? "zero" : "!zero"); | 861 | (unsigned long long) _req->dma, _req->zero ? "zero" : "!zero"); |
| 862 | 862 | ||
| 863 | spin_lock_irqsave(&dev->lock, flags); | 863 | spin_lock_irqsave(&dev->lock, flags); |
| 864 | 864 | ||
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index db7a6de85839..50991e5bd5e8 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006-2009 Renesas Solutions Corp. | 4 | * Copyright (C) 2006-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 |
| @@ -576,7 +576,11 @@ static void init_controller(struct r8a66597 *r8a66597) | |||
| 576 | u16 endian = r8a66597->pdata->endian ? BIGEND : 0; | 576 | u16 endian = r8a66597->pdata->endian ? BIGEND : 0; |
| 577 | 577 | ||
| 578 | if (r8a66597->pdata->on_chip) { | 578 | if (r8a66597->pdata->on_chip) { |
| 579 | r8a66597_bset(r8a66597, 0x04, SYSCFG1); | 579 | if (r8a66597->pdata->buswait) |
| 580 | r8a66597_write(r8a66597, r8a66597->pdata->buswait, | ||
| 581 | SYSCFG1); | ||
| 582 | else | ||
| 583 | r8a66597_write(r8a66597, 0x0f, SYSCFG1); | ||
| 580 | r8a66597_bset(r8a66597, HSE, SYSCFG0); | 584 | r8a66597_bset(r8a66597, HSE, SYSCFG0); |
| 581 | 585 | ||
| 582 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); | 586 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); |
| @@ -618,6 +622,7 @@ static void disable_controller(struct r8a66597 *r8a66597) | |||
| 618 | { | 622 | { |
| 619 | if (r8a66597->pdata->on_chip) { | 623 | if (r8a66597->pdata->on_chip) { |
| 620 | r8a66597_bset(r8a66597, SCKE, SYSCFG0); | 624 | r8a66597_bset(r8a66597, SCKE, SYSCFG0); |
| 625 | r8a66597_bclr(r8a66597, UTST, TESTMODE); | ||
| 621 | 626 | ||
| 622 | /* disable interrupts */ | 627 | /* disable interrupts */ |
| 623 | r8a66597_write(r8a66597, 0, INTENB0); | 628 | r8a66597_write(r8a66597, 0, INTENB0); |
| @@ -635,6 +640,7 @@ static void disable_controller(struct r8a66597 *r8a66597) | |||
| 635 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); | 640 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); |
| 636 | 641 | ||
| 637 | } else { | 642 | } else { |
| 643 | r8a66597_bclr(r8a66597, UTST, TESTMODE); | ||
| 638 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); | 644 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); |
| 639 | udelay(1); | 645 | udelay(1); |
| 640 | r8a66597_bclr(r8a66597, PLLC, SYSCFG0); | 646 | r8a66597_bclr(r8a66597, PLLC, SYSCFG0); |
| @@ -999,10 +1005,29 @@ static void clear_feature(struct r8a66597 *r8a66597, | |||
| 999 | 1005 | ||
| 1000 | static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) | 1006 | static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) |
| 1001 | { | 1007 | { |
| 1008 | u16 tmp; | ||
| 1009 | int timeout = 3000; | ||
| 1002 | 1010 | ||
| 1003 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 1011 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
| 1004 | case USB_RECIP_DEVICE: | 1012 | case USB_RECIP_DEVICE: |
| 1005 | control_end(r8a66597, 1); | 1013 | switch (le16_to_cpu(ctrl->wValue)) { |
| 1014 | case USB_DEVICE_TEST_MODE: | ||
| 1015 | control_end(r8a66597, 1); | ||
| 1016 | /* Wait for the completion of status stage */ | ||
| 1017 | do { | ||
| 1018 | tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; | ||
| 1019 | udelay(1); | ||
| 1020 | } while (tmp != CS_IDST || timeout-- > 0); | ||
| 1021 | |||
| 1022 | if (tmp == CS_IDST) | ||
| 1023 | r8a66597_bset(r8a66597, | ||
| 1024 | le16_to_cpu(ctrl->wIndex >> 8), | ||
| 1025 | TESTMODE); | ||
| 1026 | break; | ||
| 1027 | default: | ||
| 1028 | pipe_stall(r8a66597, 0); | ||
| 1029 | break; | ||
| 1030 | } | ||
| 1006 | break; | 1031 | break; |
| 1007 | case USB_RECIP_INTERFACE: | 1032 | case USB_RECIP_INTERFACE: |
| 1008 | control_end(r8a66597, 1); | 1033 | control_end(r8a66597, 1); |
| @@ -1444,6 +1469,7 @@ static int r8a66597_start(struct usb_gadget_driver *driver, | |||
| 1444 | goto error; | 1469 | goto error; |
| 1445 | } | 1470 | } |
| 1446 | 1471 | ||
| 1472 | init_controller(r8a66597); | ||
| 1447 | r8a66597_bset(r8a66597, VBSE, INTENB0); | 1473 | r8a66597_bset(r8a66597, VBSE, INTENB0); |
| 1448 | if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { | 1474 | if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { |
| 1449 | r8a66597_start_xclock(r8a66597); | 1475 | r8a66597_start_xclock(r8a66597); |
| @@ -1474,15 +1500,12 @@ static int r8a66597_stop(struct usb_gadget_driver *driver) | |||
| 1474 | spin_lock_irqsave(&r8a66597->lock, flags); | 1500 | spin_lock_irqsave(&r8a66597->lock, flags); |
| 1475 | if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN) | 1501 | if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN) |
| 1476 | r8a66597_usb_disconnect(r8a66597); | 1502 | r8a66597_usb_disconnect(r8a66597); |
| 1477 | spin_unlock_irqrestore(&r8a66597->lock, flags); | ||
| 1478 | |||
| 1479 | r8a66597_bclr(r8a66597, VBSE, INTENB0); | 1503 | r8a66597_bclr(r8a66597, VBSE, INTENB0); |
| 1504 | disable_controller(r8a66597); | ||
| 1505 | spin_unlock_irqrestore(&r8a66597->lock, flags); | ||
| 1480 | 1506 | ||
| 1481 | driver->unbind(&r8a66597->gadget); | 1507 | driver->unbind(&r8a66597->gadget); |
| 1482 | 1508 | ||
| 1483 | init_controller(r8a66597); | ||
| 1484 | disable_controller(r8a66597); | ||
| 1485 | |||
| 1486 | device_del(&r8a66597->gadget.dev); | 1509 | device_del(&r8a66597->gadget.dev); |
| 1487 | r8a66597->driver = NULL; | 1510 | r8a66597->driver = NULL; |
| 1488 | return 0; | 1511 | return 0; |
| @@ -1495,10 +1518,26 @@ static int r8a66597_get_frame(struct usb_gadget *_gadget) | |||
| 1495 | return r8a66597_read(r8a66597, FRMNUM) & 0x03FF; | 1518 | return r8a66597_read(r8a66597, FRMNUM) & 0x03FF; |
| 1496 | } | 1519 | } |
| 1497 | 1520 | ||
| 1521 | static int r8a66597_pullup(struct usb_gadget *gadget, int is_on) | ||
| 1522 | { | ||
| 1523 | struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); | ||
| 1524 | unsigned long flags; | ||
| 1525 | |||
| 1526 | spin_lock_irqsave(&r8a66597->lock, flags); | ||
| 1527 | if (is_on) | ||
| 1528 | r8a66597_bset(r8a66597, DPRPU, SYSCFG0); | ||
| 1529 | else | ||
| 1530 | r8a66597_bclr(r8a66597, DPRPU, SYSCFG0); | ||
| 1531 | spin_unlock_irqrestore(&r8a66597->lock, flags); | ||
| 1532 | |||
| 1533 | return 0; | ||
| 1534 | } | ||
| 1535 | |||
| 1498 | static struct usb_gadget_ops r8a66597_gadget_ops = { | 1536 | static struct usb_gadget_ops r8a66597_gadget_ops = { |
| 1499 | .get_frame = r8a66597_get_frame, | 1537 | .get_frame = r8a66597_get_frame, |
| 1500 | .start = r8a66597_start, | 1538 | .start = r8a66597_start, |
| 1501 | .stop = r8a66597_stop, | 1539 | .stop = r8a66597_stop, |
| 1540 | .pullup = r8a66597_pullup, | ||
| 1502 | }; | 1541 | }; |
| 1503 | 1542 | ||
| 1504 | static int __exit r8a66597_remove(struct platform_device *pdev) | 1543 | static int __exit r8a66597_remove(struct platform_device *pdev) |
| @@ -1646,8 +1685,6 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
| 1646 | goto clean_up3; | 1685 | goto clean_up3; |
| 1647 | r8a66597->ep0_req->complete = nop_completion; | 1686 | r8a66597->ep0_req->complete = nop_completion; |
| 1648 | 1687 | ||
| 1649 | init_controller(r8a66597); | ||
| 1650 | |||
| 1651 | ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); | 1688 | ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); |
| 1652 | if (ret) | 1689 | if (ret) |
| 1653 | goto err_add_udc; | 1690 | goto err_add_udc; |
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h index 5fc22e09a0f1..503f766c23a7 100644 --- a/drivers/usb/gadget/r8a66597-udc.h +++ b/drivers/usb/gadget/r8a66597-udc.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007-2009 Renesas Solutions Corp. | 4 | * Copyright (C) 2007-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 |
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index b91363e88db7..dfed4c1d96c0 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
| @@ -97,16 +97,17 @@ struct eth_dev { | |||
| 97 | 97 | ||
| 98 | static unsigned qmult = 5; | 98 | static unsigned qmult = 5; |
| 99 | module_param(qmult, uint, S_IRUGO|S_IWUSR); | 99 | module_param(qmult, uint, S_IRUGO|S_IWUSR); |
| 100 | MODULE_PARM_DESC(qmult, "queue length multiplier at high speed"); | 100 | MODULE_PARM_DESC(qmult, "queue length multiplier at high/super speed"); |
| 101 | 101 | ||
| 102 | #else /* full speed (low speed doesn't do bulk) */ | 102 | #else /* full speed (low speed doesn't do bulk) */ |
| 103 | #define qmult 1 | 103 | #define qmult 1 |
| 104 | #endif | 104 | #endif |
| 105 | 105 | ||
| 106 | /* for dual-speed hardware, use deeper queues at highspeed */ | 106 | /* for dual-speed hardware, use deeper queues at high/super speed */ |
| 107 | static inline int qlen(struct usb_gadget *gadget) | 107 | static inline int qlen(struct usb_gadget *gadget) |
| 108 | { | 108 | { |
| 109 | if (gadget_is_dualspeed(gadget) && gadget->speed == USB_SPEED_HIGH) | 109 | if (gadget_is_dualspeed(gadget) && (gadget->speed == USB_SPEED_HIGH || |
| 110 | gadget->speed == USB_SPEED_SUPER)) | ||
| 110 | return qmult * DEFAULT_QLEN; | 111 | return qmult * DEFAULT_QLEN; |
| 111 | else | 112 | else |
| 112 | return DEFAULT_QLEN; | 113 | return DEFAULT_QLEN; |
| @@ -598,9 +599,10 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, | |||
| 598 | 599 | ||
| 599 | req->length = length; | 600 | req->length = length; |
| 600 | 601 | ||
| 601 | /* throttle highspeed IRQ rate back slightly */ | 602 | /* throttle high/super speed IRQ rate back slightly */ |
| 602 | if (gadget_is_dualspeed(dev->gadget)) | 603 | if (gadget_is_dualspeed(dev->gadget)) |
| 603 | req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH) | 604 | req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH || |
| 605 | dev->gadget->speed == USB_SPEED_SUPER) | ||
| 604 | ? ((atomic_read(&dev->tx_qlen) % qmult) != 0) | 606 | ? ((atomic_read(&dev->tx_qlen) % qmult) != 0) |
| 605 | : 0; | 607 | : 0; |
| 606 | 608 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index af7e7c3818d8..00e2fd2d4791 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
| @@ -340,7 +340,7 @@ static struct usb_composite_driver zero_driver = { | |||
| 340 | .name = "zero", | 340 | .name = "zero", |
| 341 | .dev = &device_desc, | 341 | .dev = &device_desc, |
| 342 | .strings = dev_strings, | 342 | .strings = dev_strings, |
| 343 | .max_speed = USB_SPEED_HIGH, | 343 | .max_speed = USB_SPEED_SUPER, |
| 344 | .unbind = zero_unbind, | 344 | .unbind = zero_unbind, |
| 345 | .suspend = zero_suspend, | 345 | .suspend = zero_suspend, |
| 346 | .resume = zero_resume, | 346 | .resume = zero_resume, |
