Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+580 -142
+2
drivers/usb/gadget/Kconfig
··· 157 157 158 158 config USB_FUSB300 159 159 tristate "Faraday FUSB300 USB Peripheral Controller" 160 + depends on !PHYS_ADDR_T_64BIT 160 161 select USB_GADGET_DUALSPEED 161 162 help 162 163 Faraday usb device controller FUSB300 driver ··· 428 427 config USB_LANGWELL 429 428 tristate "Intel Langwell USB Device Controller" 430 429 depends on PCI 430 + depends on !PHYS_ADDR_T_64BIT 431 431 select USB_GADGET_DUALSPEED 432 432 help 433 433 Intel Langwell USB Device Controller is a High-Speed USB
+10 -2
drivers/usb/gadget/ci13xxx_udc.c
··· 1214 1214 * 1215 1215 * Check "device.h" for details 1216 1216 */ 1217 + #define DUMP_ENTRIES 512 1217 1218 static ssize_t show_registers(struct device *dev, 1218 1219 struct device_attribute *attr, char *buf) 1219 1220 { 1220 1221 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); 1221 1222 unsigned long flags; 1222 - u32 dump[512]; 1223 + u32 *dump; 1223 1224 unsigned i, k, n = 0; 1224 1225 1225 1226 dbg_trace("[%s] %p\n", __func__, buf); ··· 1229 1228 return 0; 1230 1229 } 1231 1230 1231 + dump = kmalloc(sizeof(u32) * DUMP_ENTRIES, GFP_KERNEL); 1232 + if (!dump) { 1233 + dev_err(dev, "%s: out of memory\n", __func__); 1234 + return 0; 1235 + } 1236 + 1232 1237 spin_lock_irqsave(udc->lock, flags); 1233 - k = hw_register_read(dump, sizeof(dump)/sizeof(u32)); 1238 + k = hw_register_read(dump, DUMP_ENTRIES); 1234 1239 spin_unlock_irqrestore(udc->lock, flags); 1235 1240 1236 1241 for (i = 0; i < k; i++) { ··· 1244 1237 "reg[0x%04X] = 0x%08X\n", 1245 1238 i * (unsigned)sizeof(u32), dump[i]); 1246 1239 } 1240 + kfree(dump); 1247 1241 1248 1242 return n; 1249 1243 }
+1 -1
drivers/usb/gadget/ether.c
··· 401 401 .name = "g_ether", 402 402 .dev = &device_desc, 403 403 .strings = dev_strings, 404 - .max_speed = USB_SPEED_HIGH, 404 + .max_speed = USB_SPEED_SUPER, 405 405 .unbind = __exit_p(eth_unbind), 406 406 }; 407 407
+98 -2
drivers/usb/gadget/f_ecm.c
··· 77 77 /* peak (theoretical) bulk transfer rate in bits-per-second */ 78 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 83 return 13 * 512 * 8 * 1000 * 8; 82 84 else 83 - return 19 * 64 * 1 * 1000 * 8; 85 + return 19 * 64 * 1 * 1000 * 8; 84 86 } 85 87 86 88 /*-------------------------------------------------------------------------*/ ··· 212 210 (struct usb_descriptor_header *) &ecm_header_desc, 213 211 (struct usb_descriptor_header *) &ecm_union_desc, 214 212 (struct usb_descriptor_header *) &ecm_desc, 213 + 215 214 /* NOTE: status endpoint might need to be removed */ 216 215 (struct usb_descriptor_header *) &fs_ecm_notify_desc, 216 + 217 217 /* data interface, altsettings 0 and 1 */ 218 218 (struct usb_descriptor_header *) &ecm_data_nop_intf, 219 219 (struct usb_descriptor_header *) &ecm_data_intf, ··· 235 231 .wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT), 236 232 .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, 237 233 }; 234 + 238 235 static struct usb_endpoint_descriptor hs_ecm_in_desc = { 239 236 .bLength = USB_DT_ENDPOINT_SIZE, 240 237 .bDescriptorType = USB_DT_ENDPOINT, ··· 260 255 (struct usb_descriptor_header *) &ecm_header_desc, 261 256 (struct usb_descriptor_header *) &ecm_union_desc, 262 257 (struct usb_descriptor_header *) &ecm_desc, 258 + 263 259 /* NOTE: status endpoint might need to be removed */ 264 260 (struct usb_descriptor_header *) &hs_ecm_notify_desc, 261 + 265 262 /* data interface, altsettings 0 and 1 */ 266 263 (struct usb_descriptor_header *) &ecm_data_nop_intf, 267 264 (struct usb_descriptor_header *) &ecm_data_intf, 268 265 (struct usb_descriptor_header *) &hs_ecm_in_desc, 269 266 (struct usb_descriptor_header *) &hs_ecm_out_desc, 267 + NULL, 268 + }; 269 + 270 + /* super speed support: */ 271 + 272 + static struct usb_endpoint_descriptor ss_ecm_notify_desc = { 273 + .bLength = USB_DT_ENDPOINT_SIZE, 274 + .bDescriptorType = USB_DT_ENDPOINT, 275 + 276 + .bEndpointAddress = USB_DIR_IN, 277 + .bmAttributes = USB_ENDPOINT_XFER_INT, 278 + .wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT), 279 + .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, 280 + }; 281 + 282 + static struct usb_ss_ep_comp_descriptor ss_ecm_intr_comp_desc = { 283 + .bLength = sizeof ss_ecm_intr_comp_desc, 284 + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 285 + 286 + /* the following 3 values can be tweaked if necessary */ 287 + /* .bMaxBurst = 0, */ 288 + /* .bmAttributes = 0, */ 289 + .wBytesPerInterval = cpu_to_le16(ECM_STATUS_BYTECOUNT), 290 + }; 291 + 292 + static struct usb_endpoint_descriptor ss_ecm_in_desc = { 293 + .bLength = USB_DT_ENDPOINT_SIZE, 294 + .bDescriptorType = USB_DT_ENDPOINT, 295 + 296 + .bEndpointAddress = USB_DIR_IN, 297 + .bmAttributes = USB_ENDPOINT_XFER_BULK, 298 + .wMaxPacketSize = cpu_to_le16(1024), 299 + }; 300 + 301 + static struct usb_endpoint_descriptor ss_ecm_out_desc = { 302 + .bLength = USB_DT_ENDPOINT_SIZE, 303 + .bDescriptorType = USB_DT_ENDPOINT, 304 + 305 + .bEndpointAddress = USB_DIR_OUT, 306 + .bmAttributes = USB_ENDPOINT_XFER_BULK, 307 + .wMaxPacketSize = cpu_to_le16(1024), 308 + }; 309 + 310 + static struct usb_ss_ep_comp_descriptor ss_ecm_bulk_comp_desc = { 311 + .bLength = sizeof ss_ecm_bulk_comp_desc, 312 + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 313 + 314 + /* the following 2 values can be tweaked if necessary */ 315 + /* .bMaxBurst = 0, */ 316 + /* .bmAttributes = 0, */ 317 + }; 318 + 319 + static struct usb_descriptor_header *ecm_ss_function[] = { 320 + /* CDC ECM control descriptors */ 321 + (struct usb_descriptor_header *) &ecm_control_intf, 322 + (struct usb_descriptor_header *) &ecm_header_desc, 323 + (struct usb_descriptor_header *) &ecm_union_desc, 324 + (struct usb_descriptor_header *) &ecm_desc, 325 + 326 + /* NOTE: status endpoint might need to be removed */ 327 + (struct usb_descriptor_header *) &ss_ecm_notify_desc, 328 + (struct usb_descriptor_header *) &ss_ecm_intr_comp_desc, 329 + 330 + /* data interface, altsettings 0 and 1 */ 331 + (struct usb_descriptor_header *) &ecm_data_nop_intf, 332 + (struct usb_descriptor_header *) &ecm_data_intf, 333 + (struct usb_descriptor_header *) &ss_ecm_in_desc, 334 + (struct usb_descriptor_header *) &ss_ecm_bulk_comp_desc, 335 + (struct usb_descriptor_header *) &ss_ecm_out_desc, 336 + (struct usb_descriptor_header *) &ss_ecm_bulk_comp_desc, 270 337 NULL, 271 338 }; 272 339 ··· 756 679 goto fail; 757 680 } 758 681 682 + if (gadget_is_superspeed(c->cdev->gadget)) { 683 + ss_ecm_in_desc.bEndpointAddress = 684 + fs_ecm_in_desc.bEndpointAddress; 685 + ss_ecm_out_desc.bEndpointAddress = 686 + fs_ecm_out_desc.bEndpointAddress; 687 + ss_ecm_notify_desc.bEndpointAddress = 688 + fs_ecm_notify_desc.bEndpointAddress; 689 + 690 + /* copy descriptors, and track endpoint copies */ 691 + f->ss_descriptors = usb_copy_descriptors(ecm_ss_function); 692 + if (!f->ss_descriptors) 693 + goto fail; 694 + } 695 + 759 696 /* NOTE: all that is done without knowing or caring about 760 697 * the network link ... which is unavailable to this code 761 698 * until we're activated via set_alt(). ··· 779 688 ecm->port.close = ecm_close; 780 689 781 690 DBG(cdev, "CDC Ethernet: %s speed IN/%s OUT/%s NOTIFY/%s\n", 691 + gadget_is_superspeed(c->cdev->gadget) ? "super" : 782 692 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 783 693 ecm->port.in_ep->name, ecm->port.out_ep->name, 784 694 ecm->notify->name); ··· 788 696 fail: 789 697 if (f->descriptors) 790 698 usb_free_descriptors(f->descriptors); 699 + if (f->hs_descriptors) 700 + usb_free_descriptors(f->hs_descriptors); 791 701 792 702 if (ecm->notify_req) { 793 703 kfree(ecm->notify_req->buf); ··· 816 722 817 723 DBG(c->cdev, "ecm unbind\n"); 818 724 725 + if (gadget_is_superspeed(c->cdev->gadget)) 726 + usb_free_descriptors(f->ss_descriptors); 819 727 if (gadget_is_dualspeed(c->cdev->gadget)) 820 728 usb_free_descriptors(f->hs_descriptors); 821 729 usb_free_descriptors(f->descriptors);
+56
drivers/usb/gadget/f_eem.c
··· 115 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 157 /* string descriptors: */ 119 158 120 159 static struct usb_string eem_string_defs[] = { ··· 304 265 goto fail; 305 266 } 306 267 268 + if (gadget_is_superspeed(c->cdev->gadget)) { 269 + eem_ss_in_desc.bEndpointAddress = 270 + eem_fs_in_desc.bEndpointAddress; 271 + eem_ss_out_desc.bEndpointAddress = 272 + eem_fs_out_desc.bEndpointAddress; 273 + 274 + /* copy descriptors, and track endpoint copies */ 275 + f->ss_descriptors = usb_copy_descriptors(eem_ss_function); 276 + if (!f->ss_descriptors) 277 + goto fail; 278 + } 279 + 307 280 DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n", 281 + gadget_is_superspeed(c->cdev->gadget) ? "super" : 308 282 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 309 283 eem->port.in_ep->name, eem->port.out_ep->name); 310 284 return 0; ··· 325 273 fail: 326 274 if (f->descriptors) 327 275 usb_free_descriptors(f->descriptors); 276 + if (f->hs_descriptors) 277 + usb_free_descriptors(f->hs_descriptors); 328 278 329 279 /* we might as well release our claims on endpoints */ 330 280 if (eem->port.out_ep->desc) ··· 346 292 347 293 DBG(c->cdev, "eem unbind\n"); 348 294 295 + if (gadget_is_superspeed(c->cdev->gadget)) 296 + usb_free_descriptors(f->ss_descriptors); 349 297 if (gadget_is_dualspeed(c->cdev->gadget)) 350 298 usb_free_descriptors(f->hs_descriptors); 351 299 usb_free_descriptors(f->descriptors);
+54 -1
drivers/usb/gadget/f_loopback.c
··· 118 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 164 /* function-specific strings: */ 122 165 123 166 static struct usb_string strings_loopback[] = { ··· 218 175 f->hs_descriptors = hs_loopback_descs; 219 176 } 220 177 178 + /* support super speed hardware */ 179 + if (gadget_is_superspeed(c->cdev->gadget)) { 180 + ss_loop_source_desc.bEndpointAddress = 181 + fs_loop_source_desc.bEndpointAddress; 182 + ss_loop_sink_desc.bEndpointAddress = 183 + fs_loop_sink_desc.bEndpointAddress; 184 + f->ss_descriptors = ss_loopback_descs; 185 + } 186 + 221 187 DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", 222 - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 188 + (gadget_is_superspeed(c->cdev->gadget) ? "super" : 189 + (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), 223 190 f->name, loop->in_ep->name, loop->out_ep->name); 224 191 return 0; 225 192 }
+98 -3
drivers/usb/gadget/f_rndis.c
··· 95 95 /* peak (theoretical) bulk transfer rate in bits-per-second */ 96 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 101 return 13 * 512 * 8 * 1000 * 8; 100 102 else 101 - return 19 * 64 * 1 * 1000 * 8; 103 + return 19 * 64 * 1 * 1000 * 8; 102 104 } 103 105 104 106 /*-------------------------------------------------------------------------*/ ··· 218 216 219 217 static struct usb_descriptor_header *eth_fs_function[] = { 220 218 (struct usb_descriptor_header *) &rndis_iad_descriptor, 219 + 221 220 /* control interface matches ACM, not Ethernet */ 222 221 (struct usb_descriptor_header *) &rndis_control_intf, 223 222 (struct usb_descriptor_header *) &header_desc, ··· 226 223 (struct usb_descriptor_header *) &rndis_acm_descriptor, 227 224 (struct usb_descriptor_header *) &rndis_union_desc, 228 225 (struct usb_descriptor_header *) &fs_notify_desc, 226 + 229 227 /* data interface has no altsetting */ 230 228 (struct usb_descriptor_header *) &rndis_data_intf, 231 229 (struct usb_descriptor_header *) &fs_in_desc, ··· 245 241 .wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT), 246 242 .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, 247 243 }; 244 + 248 245 static struct usb_endpoint_descriptor hs_in_desc = { 249 246 .bLength = USB_DT_ENDPOINT_SIZE, 250 247 .bDescriptorType = USB_DT_ENDPOINT, ··· 266 261 267 262 static struct usb_descriptor_header *eth_hs_function[] = { 268 263 (struct usb_descriptor_header *) &rndis_iad_descriptor, 264 + 269 265 /* control interface matches ACM, not Ethernet */ 270 266 (struct usb_descriptor_header *) &rndis_control_intf, 271 267 (struct usb_descriptor_header *) &header_desc, ··· 274 268 (struct usb_descriptor_header *) &rndis_acm_descriptor, 275 269 (struct usb_descriptor_header *) &rndis_union_desc, 276 270 (struct usb_descriptor_header *) &hs_notify_desc, 271 + 277 272 /* data interface has no altsetting */ 278 273 (struct usb_descriptor_header *) &rndis_data_intf, 279 274 (struct usb_descriptor_header *) &hs_in_desc, 280 275 (struct usb_descriptor_header *) &hs_out_desc, 276 + NULL, 277 + }; 278 + 279 + /* super speed support: */ 280 + 281 + static struct usb_endpoint_descriptor ss_notify_desc = { 282 + .bLength = USB_DT_ENDPOINT_SIZE, 283 + .bDescriptorType = USB_DT_ENDPOINT, 284 + 285 + .bEndpointAddress = USB_DIR_IN, 286 + .bmAttributes = USB_ENDPOINT_XFER_INT, 287 + .wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT), 288 + .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, 289 + }; 290 + 291 + static struct usb_ss_ep_comp_descriptor ss_intr_comp_desc = { 292 + .bLength = sizeof ss_intr_comp_desc, 293 + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 294 + 295 + /* the following 3 values can be tweaked if necessary */ 296 + /* .bMaxBurst = 0, */ 297 + /* .bmAttributes = 0, */ 298 + .wBytesPerInterval = cpu_to_le16(STATUS_BYTECOUNT), 299 + }; 300 + 301 + static struct usb_endpoint_descriptor ss_in_desc = { 302 + .bLength = USB_DT_ENDPOINT_SIZE, 303 + .bDescriptorType = USB_DT_ENDPOINT, 304 + 305 + .bEndpointAddress = USB_DIR_IN, 306 + .bmAttributes = USB_ENDPOINT_XFER_BULK, 307 + .wMaxPacketSize = cpu_to_le16(1024), 308 + }; 309 + 310 + static struct usb_endpoint_descriptor ss_out_desc = { 311 + .bLength = USB_DT_ENDPOINT_SIZE, 312 + .bDescriptorType = USB_DT_ENDPOINT, 313 + 314 + .bEndpointAddress = USB_DIR_OUT, 315 + .bmAttributes = USB_ENDPOINT_XFER_BULK, 316 + .wMaxPacketSize = cpu_to_le16(1024), 317 + }; 318 + 319 + static struct usb_ss_ep_comp_descriptor ss_bulk_comp_desc = { 320 + .bLength = sizeof ss_bulk_comp_desc, 321 + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 322 + 323 + /* the following 2 values can be tweaked if necessary */ 324 + /* .bMaxBurst = 0, */ 325 + /* .bmAttributes = 0, */ 326 + }; 327 + 328 + static struct usb_descriptor_header *eth_ss_function[] = { 329 + (struct usb_descriptor_header *) &rndis_iad_descriptor, 330 + 331 + /* control interface matches ACM, not Ethernet */ 332 + (struct usb_descriptor_header *) &rndis_control_intf, 333 + (struct usb_descriptor_header *) &header_desc, 334 + (struct usb_descriptor_header *) &call_mgmt_descriptor, 335 + (struct usb_descriptor_header *) &rndis_acm_descriptor, 336 + (struct usb_descriptor_header *) &rndis_union_desc, 337 + (struct usb_descriptor_header *) &ss_notify_desc, 338 + (struct usb_descriptor_header *) &ss_intr_comp_desc, 339 + 340 + /* data interface has no altsetting */ 341 + (struct usb_descriptor_header *) &rndis_data_intf, 342 + (struct usb_descriptor_header *) &ss_in_desc, 343 + (struct usb_descriptor_header *) &ss_bulk_comp_desc, 344 + (struct usb_descriptor_header *) &ss_out_desc, 345 + (struct usb_descriptor_header *) &ss_bulk_comp_desc, 281 346 NULL, 282 347 }; 283 348 ··· 747 670 748 671 /* copy descriptors, and track endpoint copies */ 749 672 f->hs_descriptors = usb_copy_descriptors(eth_hs_function); 750 - 751 673 if (!f->hs_descriptors) 674 + goto fail; 675 + } 676 + 677 + if (gadget_is_superspeed(c->cdev->gadget)) { 678 + ss_in_desc.bEndpointAddress = 679 + fs_in_desc.bEndpointAddress; 680 + ss_out_desc.bEndpointAddress = 681 + fs_out_desc.bEndpointAddress; 682 + ss_notify_desc.bEndpointAddress = 683 + fs_notify_desc.bEndpointAddress; 684 + 685 + /* copy descriptors, and track endpoint copies */ 686 + f->ss_descriptors = usb_copy_descriptors(eth_ss_function); 687 + if (!f->ss_descriptors) 752 688 goto fail; 753 689 } 754 690 ··· 789 699 */ 790 700 791 701 DBG(cdev, "RNDIS: %s speed IN/%s OUT/%s NOTIFY/%s\n", 702 + gadget_is_superspeed(c->cdev->gadget) ? "super" : 792 703 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 793 704 rndis->port.in_ep->name, rndis->port.out_ep->name, 794 705 rndis->notify->name); 795 706 return 0; 796 707 797 708 fail: 709 + if (gadget_is_superspeed(c->cdev->gadget) && f->ss_descriptors) 710 + usb_free_descriptors(f->ss_descriptors); 798 711 if (gadget_is_dualspeed(c->cdev->gadget) && f->hs_descriptors) 799 712 usb_free_descriptors(f->hs_descriptors); 800 713 if (f->descriptors) ··· 829 736 rndis_deregister(rndis->config); 830 737 rndis_exit(); 831 738 739 + if (gadget_is_superspeed(c->cdev->gadget)) 740 + usb_free_descriptors(f->ss_descriptors); 832 741 if (gadget_is_dualspeed(c->cdev->gadget)) 833 742 usb_free_descriptors(f->hs_descriptors); 834 743 usb_free_descriptors(f->descriptors);
+54 -1
drivers/usb/gadget/f_sourcesink.c
··· 131 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 177 /* function-specific strings: */ 135 178 136 179 static struct usb_string strings_sourcesink[] = { ··· 230 187 f->hs_descriptors = hs_source_sink_descs; 231 188 } 232 189 190 + /* support super speed hardware */ 191 + if (gadget_is_superspeed(c->cdev->gadget)) { 192 + ss_source_desc.bEndpointAddress = 193 + fs_source_desc.bEndpointAddress; 194 + ss_sink_desc.bEndpointAddress = 195 + fs_sink_desc.bEndpointAddress; 196 + f->ss_descriptors = ss_source_sink_descs; 197 + } 198 + 233 199 DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", 234 - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 200 + (gadget_is_superspeed(c->cdev->gadget) ? "super" : 201 + (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), 235 202 f->name, ss->in_ep->name, ss->out_ep->name); 236 203 return 0; 237 204 }
+64
drivers/usb/gadget/f_subset.c
··· 201 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 *) &ether_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 244 /* string descriptors: */ 205 245 206 246 static struct usb_string geth_string_defs[] = { ··· 330 290 331 291 /* copy descriptors, and track endpoint copies */ 332 292 f->descriptors = usb_copy_descriptors(fs_eth_function); 293 + if (!f->descriptors) 294 + goto fail; 333 295 334 296 /* support all relevant hardware speeds... we expect that when 335 297 * hardware is dual speed, all bulk-capable endpoints work at ··· 345 303 346 304 /* copy descriptors, and track endpoint copies */ 347 305 f->hs_descriptors = usb_copy_descriptors(hs_eth_function); 306 + if (!f->hs_descriptors) 307 + goto fail; 308 + } 309 + 310 + if (gadget_is_superspeed(c->cdev->gadget)) { 311 + ss_subset_in_desc.bEndpointAddress = 312 + fs_subset_in_desc.bEndpointAddress; 313 + ss_subset_out_desc.bEndpointAddress = 314 + fs_subset_out_desc.bEndpointAddress; 315 + 316 + /* copy descriptors, and track endpoint copies */ 317 + f->ss_descriptors = usb_copy_descriptors(ss_eth_function); 318 + if (!f->ss_descriptors) 319 + goto fail; 348 320 } 349 321 350 322 /* NOTE: all that is done without knowing or caring about ··· 367 311 */ 368 312 369 313 DBG(cdev, "CDC Subset: %s speed IN/%s OUT/%s\n", 314 + gadget_is_superspeed(c->cdev->gadget) ? "super" : 370 315 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 371 316 geth->port.in_ep->name, geth->port.out_ep->name); 372 317 return 0; 373 318 374 319 fail: 320 + if (f->descriptors) 321 + usb_free_descriptors(f->descriptors); 322 + if (f->hs_descriptors) 323 + usb_free_descriptors(f->hs_descriptors); 324 + 375 325 /* we might as well release our claims on endpoints */ 376 326 if (geth->port.out_ep->desc) 377 327 geth->port.out_ep->driver_data = NULL; ··· 392 330 static void 393 331 geth_unbind(struct usb_configuration *c, struct usb_function *f) 394 332 { 333 + if (gadget_is_superspeed(c->cdev->gadget)) 334 + usb_free_descriptors(f->ss_descriptors); 395 335 if (gadget_is_dualspeed(c->cdev->gadget)) 396 336 usb_free_descriptors(f->hs_descriptors); 397 337 usb_free_descriptors(f->descriptors);
+8 -83
drivers/usb/gadget/fusb300_udc.c
··· 767 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 770 static u8 fusb300_get_epnstall(struct fusb300 *fusb300, u8 ep) 821 771 { 822 772 u8 value; ··· 974 1024 return ret; 975 1025 } 976 1026 977 - static void fusb300_set_ep_bycnt(struct fusb300_ep *ep, u32 bycnt) 978 - { 979 - struct fusb300 *fusb300 = ep->fusb300; 980 - u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPFFR(ep->epnum)); 981 - 982 - reg &= ~FUSB300_FFR_BYCNT; 983 - reg |= bycnt & FUSB300_FFR_BYCNT; 984 - 985 - iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPFFR(ep->epnum)); 986 - } 987 - 988 1027 static void done(struct fusb300_ep *ep, struct fusb300_request *req, 989 1028 int status) 990 1029 { ··· 997 1058 fusb300_set_cxdone(ep->fusb300); 998 1059 } 999 1060 1000 - void fusb300_fill_idma_prdtbl(struct fusb300_ep *ep, 1001 - struct fusb300_request *req) 1061 + static void fusb300_fill_idma_prdtbl(struct fusb300_ep *ep, dma_addr_t d, 1062 + u32 len) 1002 1063 { 1003 1064 u32 value; 1004 1065 u32 reg; ··· 1010 1071 reg &= FUSB300_EPPRD0_H; 1011 1072 } while (reg); 1012 1073 1013 - iowrite32((u32) req->req.buf, ep->fusb300->reg + 1014 - FUSB300_OFFSET_EPPRD_W1(ep->epnum)); 1074 + iowrite32(d, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W1(ep->epnum)); 1015 1075 1016 - value = FUSB300_EPPRD0_BTC(req->req.length) | FUSB300_EPPRD0_H | 1076 + value = FUSB300_EPPRD0_BTC(len) | FUSB300_EPPRD0_H | 1017 1077 FUSB300_EPPRD0_F | FUSB300_EPPRD0_L | FUSB300_EPPRD0_I; 1018 1078 iowrite32(value, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W0(ep->epnum)); 1019 1079 ··· 1049 1111 struct fusb300_request *req) 1050 1112 { 1051 1113 dma_addr_t d; 1052 - u8 *tmp = NULL; 1053 1114 1054 1115 d = dma_map_single(NULL, req->req.buf, req->req.length, DMA_TO_DEVICE); 1055 1116 1056 1117 if (dma_mapping_error(NULL, d)) { 1057 - kfree(req->req.buf); 1058 1118 printk(KERN_DEBUG "dma_mapping_error\n"); 1119 + return; 1059 1120 } 1060 1121 1061 1122 dma_sync_single_for_device(NULL, d, req->req.length, DMA_TO_DEVICE); ··· 1062 1125 fusb300_enable_bit(ep->fusb300, FUSB300_OFFSET_IGER0, 1063 1126 FUSB300_IGER0_EEPn_PRD_INT(ep->epnum)); 1064 1127 1065 - tmp = req->req.buf; 1066 - req->req.buf = (u8 *)d; 1067 - 1068 - fusb300_fill_idma_prdtbl(ep, req); 1128 + fusb300_fill_idma_prdtbl(ep, d, req->req.length); 1069 1129 /* check idma is done */ 1070 1130 fusb300_wait_idma_finished(ep); 1071 1131 1072 - req->req.buf = tmp; 1073 - 1074 - if (d) 1075 - dma_unmap_single(NULL, d, req->req.length, DMA_TO_DEVICE); 1132 + dma_unmap_single(NULL, d, req->req.length, DMA_TO_DEVICE); 1076 1133 } 1077 1134 1078 1135 static void in_ep_fifo_handler(struct fusb300_ep *ep) ··· 1074 1143 struct fusb300_request *req = list_entry(ep->queue.next, 1075 1144 struct fusb300_request, queue); 1076 1145 1077 - if (req->req.length) { 1078 - #if 0 1079 - fusb300_set_ep_bycnt(ep, req->req.length); 1080 - fusb300_wrfifo(ep, req); 1081 - #else 1146 + if (req->req.length) 1082 1147 fusb300_set_idma(ep, req); 1083 - #endif 1084 - } 1085 1148 done(ep, req, 0); 1086 1149 } 1087 1150
+6 -6
drivers/usb/gadget/langwell_udc.c
··· 593 593 /* ep0 */ 594 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", 597 - i, (u32)&(dev->ep_dqh[i])); 596 + dev_vdbg(&dev->pdev->dev, "ep_dqh[%d] addr: 0x%p\n", 597 + i, &(dev->ep_dqh[i])); 598 598 599 599 bit_mask = is_in(ep) ? 600 600 (1 << (ep->ep_num + 16)) : (1 << (ep->ep_num)); ··· 3271 3271 3272 3272 /* allocate device dQH memory */ 3273 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 3275 if (size < DQH_ALIGNMENT) 3276 3276 size = DQH_ALIGNMENT; 3277 3277 else if ((size % DQH_ALIGNMENT) != 0) { ··· 3286 3286 goto error; 3287 3287 } 3288 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 3291 /* initialize ep0 status request structure */ 3292 3292 dev->status_req = kzalloc(sizeof(struct langwell_request), GFP_KERNEL); ··· 3470 3470 3471 3471 /* allocate device dQH memory */ 3472 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 3474 if (size < DQH_ALIGNMENT) 3475 3475 size = DQH_ALIGNMENT; 3476 3476 else if ((size % DQH_ALIGNMENT) != 0) { ··· 3484 3484 return -ENOMEM; 3485 3485 } 3486 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 3489 /* create dTD dma_pool resource */ 3490 3490 dev->dtd_pool = dma_pool_create("langwell_dtd",
+41 -4
drivers/usb/gadget/m66592-udc.c
··· 3 3 * 4 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 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by ··· 691 691 692 692 static void disable_controller(struct m66592 *m66592) 693 693 { 694 + m66592_bclr(m66592, M66592_UTST, M66592_TESTMODE); 694 695 if (!m66592->pdata->on_chip) { 695 696 m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); 696 697 udelay(1); ··· 781 780 /* write fifo */ 782 781 if (req->req.buf) { 783 782 if (size > 0) 784 - m66592_write_fifo(m66592, ep->fifoaddr, buf, size); 783 + m66592_write_fifo(m66592, ep, buf, size); 785 784 if ((size == 0) || ((size % ep->ep.maxpacket) != 0)) 786 785 m66592_bset(m66592, M66592_BVAL, ep->fifoctr); 787 786 } ··· 827 826 828 827 /* write fifo */ 829 828 if (req->req.buf) { 830 - m66592_write_fifo(m66592, ep->fifoaddr, buf, size); 829 + m66592_write_fifo(m66592, ep, buf, size); 831 830 if ((size == 0) 832 831 || ((size % ep->ep.maxpacket) != 0) 833 832 || ((bufsize != ep->ep.maxpacket) ··· 1049 1048 1050 1049 static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl) 1051 1050 { 1051 + u16 tmp; 1052 + int timeout = 3000; 1052 1053 1053 1054 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1054 1055 case USB_RECIP_DEVICE: 1055 - control_end(m66592, 1); 1056 + switch (le16_to_cpu(ctrl->wValue)) { 1057 + case USB_DEVICE_TEST_MODE: 1058 + control_end(m66592, 1); 1059 + /* Wait for the completion of status stage */ 1060 + do { 1061 + tmp = m66592_read(m66592, M66592_INTSTS0) & 1062 + M66592_CTSQ; 1063 + udelay(1); 1064 + } while (tmp != M66592_CS_IDST || timeout-- > 0); 1065 + 1066 + if (tmp == M66592_CS_IDST) 1067 + m66592_bset(m66592, 1068 + le16_to_cpu(ctrl->wIndex >> 8), 1069 + M66592_TESTMODE); 1070 + break; 1071 + default: 1072 + pipe_stall(m66592, 0); 1073 + break; 1074 + } 1056 1075 break; 1057 1076 case USB_RECIP_INTERFACE: 1058 1077 control_end(m66592, 1); ··· 1561 1540 return m66592_read(m66592, M66592_FRMNUM) & 0x03FF; 1562 1541 } 1563 1542 1543 + static int m66592_pullup(struct usb_gadget *gadget, int is_on) 1544 + { 1545 + struct m66592 *m66592 = gadget_to_m66592(gadget); 1546 + unsigned long flags; 1547 + 1548 + spin_lock_irqsave(&m66592->lock, flags); 1549 + if (is_on) 1550 + m66592_bset(m66592, M66592_DPRPU, M66592_SYSCFG); 1551 + else 1552 + m66592_bclr(m66592, M66592_DPRPU, M66592_SYSCFG); 1553 + spin_unlock_irqrestore(&m66592->lock, flags); 1554 + 1555 + return 0; 1556 + } 1557 + 1564 1558 static struct usb_gadget_ops m66592_gadget_ops = { 1565 1559 .get_frame = m66592_get_frame, 1566 1560 .start = m66592_start, 1567 1561 .stop = m66592_stop, 1562 + .pullup = m66592_pullup, 1568 1563 }; 1569 1564 1570 1565 static int __exit m66592_remove(struct platform_device *pdev)
+22 -18
drivers/usb/gadget/m66592-udc.h
··· 3 3 * 4 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 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by ··· 561 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 579 static inline void m66592_write_fifo(struct m66592 *m66592, 565 - unsigned long offset, 580 + struct m66592_ep *ep, 566 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 585 if (m66592->pdata->on_chip) { 571 586 unsigned long count; ··· 606 591 iowrite16_rep(fifoaddr, buf, len); 607 592 if (odd) { 608 593 unsigned char *p = buf + len*2; 594 + if (m66592->pdata->wr0_shorted_to_wr1) 595 + m66592_bclr(m66592, M66592_MBW_16, ep->fifosel); 609 596 iowrite8(*p, fifoaddr); 597 + if (m66592->pdata->wr0_shorted_to_wr1) 598 + m66592_bset(m66592, M66592_MBW_16, ep->fifosel); 610 599 } 611 600 } 612 601 } 613 - 614 - static inline void m66592_mdfy(struct m66592 *m66592, u16 val, u16 pat, 615 - unsigned long offset) 616 - { 617 - u16 tmp; 618 - tmp = m66592_read(m66592, offset); 619 - tmp = tmp & (~pat); 620 - tmp = tmp | val; 621 - m66592_write(m66592, tmp, offset); 622 - } 623 - 624 - #define m66592_bclr(m66592, val, offset) \ 625 - m66592_mdfy(m66592, 0, val, offset) 626 - #define m66592_bset(m66592, val, offset) \ 627 - m66592_mdfy(m66592, val, 0, offset) 628 602 629 603 #endif /* ifndef __M66592_UDC_H__ */ 630 604
+4 -4
drivers/usb/gadget/net2272.c
··· 737 737 if (req->req.length & 1) 738 738 return -EINVAL; 739 739 740 - dev_vdbg(ep->dev->dev, "kick_dma %s req %p dma %08x\n", 741 - ep->ep.name, req, req->req.dma); 740 + dev_vdbg(ep->dev->dev, "kick_dma %s req %p dma %08llx\n", 741 + ep->ep.name, req, (unsigned long long) req->req.dma); 742 742 743 743 net2272_ep_write(ep, EP_RSPSET, 1 << ALT_NAK_OUT_PACKETS); 744 744 ··· 856 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 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 863 spin_lock_irqsave(&dev->lock, flags); 864 864
+47 -10
drivers/usb/gadget/r8a66597-udc.c
··· 3 3 * 4 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 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by ··· 576 576 u16 endian = r8a66597->pdata->endian ? BIGEND : 0; 577 577 578 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 584 r8a66597_bset(r8a66597, HSE, SYSCFG0); 581 585 582 586 r8a66597_bclr(r8a66597, USBE, SYSCFG0); ··· 622 618 { 623 619 if (r8a66597->pdata->on_chip) { 624 620 r8a66597_bset(r8a66597, SCKE, SYSCFG0); 621 + r8a66597_bclr(r8a66597, UTST, TESTMODE); 625 622 626 623 /* disable interrupts */ 627 624 r8a66597_write(r8a66597, 0, INTENB0); ··· 640 635 r8a66597_bclr(r8a66597, SCKE, SYSCFG0); 641 636 642 637 } else { 638 + r8a66597_bclr(r8a66597, UTST, TESTMODE); 643 639 r8a66597_bclr(r8a66597, SCKE, SYSCFG0); 644 640 udelay(1); 645 641 r8a66597_bclr(r8a66597, PLLC, SYSCFG0); ··· 1005 999 1006 1000 static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) 1007 1001 { 1002 + u16 tmp; 1003 + int timeout = 3000; 1008 1004 1009 1005 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1010 1006 case USB_RECIP_DEVICE: 1011 - control_end(r8a66597, 1); 1007 + switch (le16_to_cpu(ctrl->wValue)) { 1008 + case USB_DEVICE_TEST_MODE: 1009 + control_end(r8a66597, 1); 1010 + /* Wait for the completion of status stage */ 1011 + do { 1012 + tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; 1013 + udelay(1); 1014 + } while (tmp != CS_IDST || timeout-- > 0); 1015 + 1016 + if (tmp == CS_IDST) 1017 + r8a66597_bset(r8a66597, 1018 + le16_to_cpu(ctrl->wIndex >> 8), 1019 + TESTMODE); 1020 + break; 1021 + default: 1022 + pipe_stall(r8a66597, 0); 1023 + break; 1024 + } 1012 1025 break; 1013 1026 case USB_RECIP_INTERFACE: 1014 1027 control_end(r8a66597, 1); ··· 1469 1444 goto error; 1470 1445 } 1471 1446 1447 + init_controller(r8a66597); 1472 1448 r8a66597_bset(r8a66597, VBSE, INTENB0); 1473 1449 if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { 1474 1450 r8a66597_start_xclock(r8a66597); ··· 1500 1474 spin_lock_irqsave(&r8a66597->lock, flags); 1501 1475 if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN) 1502 1476 r8a66597_usb_disconnect(r8a66597); 1477 + r8a66597_bclr(r8a66597, VBSE, INTENB0); 1478 + disable_controller(r8a66597); 1503 1479 spin_unlock_irqrestore(&r8a66597->lock, flags); 1504 1480 1505 - r8a66597_bclr(r8a66597, VBSE, INTENB0); 1506 - 1507 1481 driver->unbind(&r8a66597->gadget); 1508 - 1509 - init_controller(r8a66597); 1510 - disable_controller(r8a66597); 1511 1482 1512 1483 device_del(&r8a66597->gadget.dev); 1513 1484 r8a66597->driver = NULL; ··· 1518 1495 return r8a66597_read(r8a66597, FRMNUM) & 0x03FF; 1519 1496 } 1520 1497 1498 + static int r8a66597_pullup(struct usb_gadget *gadget, int is_on) 1499 + { 1500 + struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); 1501 + unsigned long flags; 1502 + 1503 + spin_lock_irqsave(&r8a66597->lock, flags); 1504 + if (is_on) 1505 + r8a66597_bset(r8a66597, DPRPU, SYSCFG0); 1506 + else 1507 + r8a66597_bclr(r8a66597, DPRPU, SYSCFG0); 1508 + spin_unlock_irqrestore(&r8a66597->lock, flags); 1509 + 1510 + return 0; 1511 + } 1512 + 1521 1513 static struct usb_gadget_ops r8a66597_gadget_ops = { 1522 1514 .get_frame = r8a66597_get_frame, 1523 1515 .start = r8a66597_start, 1524 1516 .stop = r8a66597_stop, 1517 + .pullup = r8a66597_pullup, 1525 1518 }; 1526 1519 1527 1520 static int __exit r8a66597_remove(struct platform_device *pdev) ··· 1684 1645 if (r8a66597->ep0_req == NULL) 1685 1646 goto clean_up3; 1686 1647 r8a66597->ep0_req->complete = nop_completion; 1687 - 1688 - init_controller(r8a66597); 1689 1648 1690 1649 ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); 1691 1650 if (ret)
+1 -1
drivers/usb/gadget/r8a66597-udc.h
··· 3 3 * 4 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 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by
+7 -5
drivers/usb/gadget/u_ether.c
··· 97 97 98 98 static unsigned qmult = 5; 99 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 102 #else /* full speed (low speed doesn't do bulk) */ 103 103 #define qmult 1 104 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 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 111 return qmult * DEFAULT_QLEN; 111 112 else 112 113 return DEFAULT_QLEN; ··· 599 598 600 599 req->length = length; 601 600 602 - /* throttle highspeed IRQ rate back slightly */ 601 + /* throttle high/super speed IRQ rate back slightly */ 603 602 if (gadget_is_dualspeed(dev->gadget)) 604 - req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH) 603 + req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH || 604 + dev->gadget->speed == USB_SPEED_SUPER) 605 605 ? ((atomic_read(&dev->tx_qlen) % qmult) != 0) 606 606 : 0; 607 607
+1 -1
drivers/usb/gadget/zero.c
··· 340 340 .name = "zero", 341 341 .dev = &device_desc, 342 342 .strings = dev_strings, 343 - .max_speed = USB_SPEED_HIGH, 343 + .max_speed = USB_SPEED_SUPER, 344 344 .unbind = zero_unbind, 345 345 .suspend = zero_suspend, 346 346 .resume = zero_resume,
+1
drivers/usb/musb/musb_core.c
··· 2282 2282 musb->context.index_regs[i].rxhubport); 2283 2283 } 2284 2284 } 2285 + musb_writeb(musb_base, MUSB_INDEX, musb->context.index); 2285 2286 } 2286 2287 2287 2288 static int musb_suspend(struct device *dev)
+2
include/linux/usb/m66592.h
··· 38 38 /* (external controller only) one = 3.3V, zero = 1.5V */ 39 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 45 #endif /* __LINUX_USB_M66592_H */
+3
include/linux/usb/r8a66597.h
··· 31 31 /* This callback can control port power instead of DVSTCTR register. */ 32 32 void (*port_power)(int port, int power); 33 33 34 + /* This parameter is for BUSWAIT */ 35 + u16 buswait; 36 + 34 37 /* set one = on chip controller, set zero = external controller */ 35 38 unsigned on_chip:1; 36 39