diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-15 01:33:11 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-15 01:33:11 -0500 |
commit | 1bb95834bbcdc969e477a9284cf96c17a4c2616f (patch) | |
tree | 9cf66b22a611bb6bc78778c05dac72263bb45a23 /drivers/usb | |
parent | 85345517fe6d4de27b0d6ca19fef9d28ac947c4a (diff) | |
parent | a41c73e04673b47730df682446f0d52f95e32a5b (diff) |
Merge remote branch 'airlied/drm-fixes' into drm-intel-fixes
Diffstat (limited to 'drivers/usb')
30 files changed, 853 insertions, 123 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index f1aaff6202a5..045bb4b823e1 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -965,10 +965,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg) | |||
965 | 965 | ||
966 | static int proc_connectinfo(struct dev_state *ps, void __user *arg) | 966 | static int proc_connectinfo(struct dev_state *ps, void __user *arg) |
967 | { | 967 | { |
968 | struct usbdevfs_connectinfo ci; | 968 | struct usbdevfs_connectinfo ci = { |
969 | .devnum = ps->dev->devnum, | ||
970 | .slow = ps->dev->speed == USB_SPEED_LOW | ||
971 | }; | ||
969 | 972 | ||
970 | ci.devnum = ps->dev->devnum; | ||
971 | ci.slow = ps->dev->speed == USB_SPEED_LOW; | ||
972 | if (copy_to_user(arg, &ci, sizeof(ci))) | 973 | if (copy_to_user(arg, &ci, sizeof(ci))) |
973 | return -EFAULT; | 974 | return -EFAULT; |
974 | return 0; | 975 | return 0; |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index e2f63c0ea09d..9819a4cc3b26 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -574,16 +574,16 @@ static void fs_remove_file (struct dentry *dentry) | |||
574 | 574 | ||
575 | /* --------------------------------------------------------------------- */ | 575 | /* --------------------------------------------------------------------- */ |
576 | 576 | ||
577 | static int usb_get_sb(struct file_system_type *fs_type, | 577 | static struct dentry *usb_mount(struct file_system_type *fs_type, |
578 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 578 | int flags, const char *dev_name, void *data) |
579 | { | 579 | { |
580 | return get_sb_single(fs_type, flags, data, usbfs_fill_super, mnt); | 580 | return mount_single(fs_type, flags, data, usbfs_fill_super); |
581 | } | 581 | } |
582 | 582 | ||
583 | static struct file_system_type usb_fs_type = { | 583 | static struct file_system_type usb_fs_type = { |
584 | .owner = THIS_MODULE, | 584 | .owner = THIS_MODULE, |
585 | .name = "usbfs", | 585 | .name = "usbfs", |
586 | .get_sb = usb_get_sb, | 586 | .mount = usb_mount, |
587 | .kill_sb = kill_litter_super, | 587 | .kill_sb = kill_litter_super, |
588 | }; | 588 | }; |
589 | 589 | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index b739ca814651..607d0db4a988 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -158,7 +158,7 @@ config USB_GADGET_FSL_USB2 | |||
158 | boolean "Freescale Highspeed USB DR Peripheral Controller" | 158 | boolean "Freescale Highspeed USB DR Peripheral Controller" |
159 | depends on FSL_SOC || ARCH_MXC | 159 | depends on FSL_SOC || ARCH_MXC |
160 | select USB_GADGET_DUALSPEED | 160 | select USB_GADGET_DUALSPEED |
161 | select USB_FSL_MPH_DR_OF | 161 | select USB_FSL_MPH_DR_OF if OF |
162 | help | 162 | help |
163 | Some of Freescale PowerPC processors have a High Speed | 163 | Some of Freescale PowerPC processors have a High Speed |
164 | Dual-Role(DR) USB controller, which supports device mode. | 164 | Dual-Role(DR) USB controller, which supports device mode. |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index f276e9594f00..4a830df4fc31 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -1176,9 +1176,9 @@ invalid: | |||
1176 | 1176 | ||
1177 | /* "mount -t functionfs dev_name /dev/function" ends up here */ | 1177 | /* "mount -t functionfs dev_name /dev/function" ends up here */ |
1178 | 1178 | ||
1179 | static int | 1179 | static struct dentry * |
1180 | ffs_fs_get_sb(struct file_system_type *t, int flags, | 1180 | ffs_fs_mount(struct file_system_type *t, int flags, |
1181 | const char *dev_name, void *opts, struct vfsmount *mnt) | 1181 | const char *dev_name, void *opts) |
1182 | { | 1182 | { |
1183 | struct ffs_sb_fill_data data = { | 1183 | struct ffs_sb_fill_data data = { |
1184 | .perms = { | 1184 | .perms = { |
@@ -1194,14 +1194,14 @@ ffs_fs_get_sb(struct file_system_type *t, int flags, | |||
1194 | 1194 | ||
1195 | ret = functionfs_check_dev_callback(dev_name); | 1195 | ret = functionfs_check_dev_callback(dev_name); |
1196 | if (unlikely(ret < 0)) | 1196 | if (unlikely(ret < 0)) |
1197 | return ret; | 1197 | return ERR_PTR(ret); |
1198 | 1198 | ||
1199 | ret = ffs_fs_parse_opts(&data, opts); | 1199 | ret = ffs_fs_parse_opts(&data, opts); |
1200 | if (unlikely(ret < 0)) | 1200 | if (unlikely(ret < 0)) |
1201 | return ret; | 1201 | return ERR_PTR(ret); |
1202 | 1202 | ||
1203 | data.dev_name = dev_name; | 1203 | data.dev_name = dev_name; |
1204 | return get_sb_single(t, flags, &data, ffs_sb_fill, mnt); | 1204 | return mount_single(t, flags, &data, ffs_sb_fill); |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | static void | 1207 | static void |
@@ -1220,7 +1220,7 @@ ffs_fs_kill_sb(struct super_block *sb) | |||
1220 | static struct file_system_type ffs_fs_type = { | 1220 | static struct file_system_type ffs_fs_type = { |
1221 | .owner = THIS_MODULE, | 1221 | .owner = THIS_MODULE, |
1222 | .name = "functionfs", | 1222 | .name = "functionfs", |
1223 | .get_sb = ffs_fs_get_sb, | 1223 | .mount = ffs_fs_mount, |
1224 | .kill_sb = ffs_fs_kill_sb, | 1224 | .kill_sb = ffs_fs_kill_sb, |
1225 | }; | 1225 | }; |
1226 | 1226 | ||
diff --git a/drivers/usb/gadget/goku_udc.h b/drivers/usb/gadget/goku_udc.h index 566cb2319056..e7e0c69d3b1f 100644 --- a/drivers/usb/gadget/goku_udc.h +++ b/drivers/usb/gadget/goku_udc.h | |||
@@ -251,7 +251,8 @@ struct goku_udc { | |||
251 | got_region:1, | 251 | got_region:1, |
252 | req_config:1, | 252 | req_config:1, |
253 | configured:1, | 253 | configured:1, |
254 | enabled:1; | 254 | enabled:1, |
255 | registered:1; | ||
255 | 256 | ||
256 | /* pci state used to access those endpoints */ | 257 | /* pci state used to access those endpoints */ |
257 | struct pci_dev *pdev; | 258 | struct pci_dev *pdev; |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index ba145e7fbe03..3ed73f49cf18 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -2097,11 +2097,11 @@ enomem0: | |||
2097 | } | 2097 | } |
2098 | 2098 | ||
2099 | /* "mount -t gadgetfs path /dev/gadget" ends up here */ | 2099 | /* "mount -t gadgetfs path /dev/gadget" ends up here */ |
2100 | static int | 2100 | static struct dentry * |
2101 | gadgetfs_get_sb (struct file_system_type *t, int flags, | 2101 | gadgetfs_mount (struct file_system_type *t, int flags, |
2102 | const char *path, void *opts, struct vfsmount *mnt) | 2102 | const char *path, void *opts) |
2103 | { | 2103 | { |
2104 | return get_sb_single (t, flags, opts, gadgetfs_fill_super, mnt); | 2104 | return mount_single (t, flags, opts, gadgetfs_fill_super); |
2105 | } | 2105 | } |
2106 | 2106 | ||
2107 | static void | 2107 | static void |
@@ -2119,7 +2119,7 @@ gadgetfs_kill_sb (struct super_block *sb) | |||
2119 | static struct file_system_type gadgetfs_type = { | 2119 | static struct file_system_type gadgetfs_type = { |
2120 | .owner = THIS_MODULE, | 2120 | .owner = THIS_MODULE, |
2121 | .name = shortname, | 2121 | .name = shortname, |
2122 | .get_sb = gadgetfs_get_sb, | 2122 | .mount = gadgetfs_mount, |
2123 | .kill_sb = gadgetfs_kill_sb, | 2123 | .kill_sb = gadgetfs_kill_sb, |
2124 | }; | 2124 | }; |
2125 | 2125 | ||
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 6bb876d65252..fbe86ca95802 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -797,7 +797,6 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
797 | * - iff DATA transfer is active, carrier is "on" | 797 | * - iff DATA transfer is active, carrier is "on" |
798 | * - tx queueing enabled if open *and* carrier is "on" | 798 | * - tx queueing enabled if open *and* carrier is "on" |
799 | */ | 799 | */ |
800 | netif_stop_queue(net); | ||
801 | netif_carrier_off(net); | 800 | netif_carrier_off(net); |
802 | 801 | ||
803 | dev->gadget = g; | 802 | dev->gadget = g; |
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 01e5354a4c20..40f7716b31fc 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
@@ -105,11 +105,15 @@ struct gs_port { | |||
105 | wait_queue_head_t close_wait; /* wait for last close */ | 105 | wait_queue_head_t close_wait; /* wait for last close */ |
106 | 106 | ||
107 | struct list_head read_pool; | 107 | struct list_head read_pool; |
108 | int read_started; | ||
109 | int read_allocated; | ||
108 | struct list_head read_queue; | 110 | struct list_head read_queue; |
109 | unsigned n_read; | 111 | unsigned n_read; |
110 | struct tasklet_struct push; | 112 | struct tasklet_struct push; |
111 | 113 | ||
112 | struct list_head write_pool; | 114 | struct list_head write_pool; |
115 | int write_started; | ||
116 | int write_allocated; | ||
113 | struct gs_buf port_write_buf; | 117 | struct gs_buf port_write_buf; |
114 | wait_queue_head_t drain_wait; /* wait while writes drain */ | 118 | wait_queue_head_t drain_wait; /* wait while writes drain */ |
115 | 119 | ||
@@ -363,6 +367,9 @@ __acquires(&port->port_lock) | |||
363 | struct usb_request *req; | 367 | struct usb_request *req; |
364 | int len; | 368 | int len; |
365 | 369 | ||
370 | if (port->write_started >= QUEUE_SIZE) | ||
371 | break; | ||
372 | |||
366 | req = list_entry(pool->next, struct usb_request, list); | 373 | req = list_entry(pool->next, struct usb_request, list); |
367 | len = gs_send_packet(port, req->buf, in->maxpacket); | 374 | len = gs_send_packet(port, req->buf, in->maxpacket); |
368 | if (len == 0) { | 375 | if (len == 0) { |
@@ -397,6 +404,8 @@ __acquires(&port->port_lock) | |||
397 | break; | 404 | break; |
398 | } | 405 | } |
399 | 406 | ||
407 | port->write_started++; | ||
408 | |||
400 | /* abort immediately after disconnect */ | 409 | /* abort immediately after disconnect */ |
401 | if (!port->port_usb) | 410 | if (!port->port_usb) |
402 | break; | 411 | break; |
@@ -418,7 +427,6 @@ __acquires(&port->port_lock) | |||
418 | { | 427 | { |
419 | struct list_head *pool = &port->read_pool; | 428 | struct list_head *pool = &port->read_pool; |
420 | struct usb_ep *out = port->port_usb->out; | 429 | struct usb_ep *out = port->port_usb->out; |
421 | unsigned started = 0; | ||
422 | 430 | ||
423 | while (!list_empty(pool)) { | 431 | while (!list_empty(pool)) { |
424 | struct usb_request *req; | 432 | struct usb_request *req; |
@@ -430,6 +438,9 @@ __acquires(&port->port_lock) | |||
430 | if (!tty) | 438 | if (!tty) |
431 | break; | 439 | break; |
432 | 440 | ||
441 | if (port->read_started >= QUEUE_SIZE) | ||
442 | break; | ||
443 | |||
433 | req = list_entry(pool->next, struct usb_request, list); | 444 | req = list_entry(pool->next, struct usb_request, list); |
434 | list_del(&req->list); | 445 | list_del(&req->list); |
435 | req->length = out->maxpacket; | 446 | req->length = out->maxpacket; |
@@ -447,13 +458,13 @@ __acquires(&port->port_lock) | |||
447 | list_add(&req->list, pool); | 458 | list_add(&req->list, pool); |
448 | break; | 459 | break; |
449 | } | 460 | } |
450 | started++; | 461 | port->read_started++; |
451 | 462 | ||
452 | /* abort immediately after disconnect */ | 463 | /* abort immediately after disconnect */ |
453 | if (!port->port_usb) | 464 | if (!port->port_usb) |
454 | break; | 465 | break; |
455 | } | 466 | } |
456 | return started; | 467 | return port->read_started; |
457 | } | 468 | } |
458 | 469 | ||
459 | /* | 470 | /* |
@@ -535,6 +546,7 @@ static void gs_rx_push(unsigned long _port) | |||
535 | } | 546 | } |
536 | recycle: | 547 | recycle: |
537 | list_move(&req->list, &port->read_pool); | 548 | list_move(&req->list, &port->read_pool); |
549 | port->read_started--; | ||
538 | } | 550 | } |
539 | 551 | ||
540 | /* Push from tty to ldisc; without low_latency set this is handled by | 552 | /* Push from tty to ldisc; without low_latency set this is handled by |
@@ -587,6 +599,7 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req) | |||
587 | 599 | ||
588 | spin_lock(&port->port_lock); | 600 | spin_lock(&port->port_lock); |
589 | list_add(&req->list, &port->write_pool); | 601 | list_add(&req->list, &port->write_pool); |
602 | port->write_started--; | ||
590 | 603 | ||
591 | switch (req->status) { | 604 | switch (req->status) { |
592 | default: | 605 | default: |
@@ -608,7 +621,8 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req) | |||
608 | spin_unlock(&port->port_lock); | 621 | spin_unlock(&port->port_lock); |
609 | } | 622 | } |
610 | 623 | ||
611 | static void gs_free_requests(struct usb_ep *ep, struct list_head *head) | 624 | static void gs_free_requests(struct usb_ep *ep, struct list_head *head, |
625 | int *allocated) | ||
612 | { | 626 | { |
613 | struct usb_request *req; | 627 | struct usb_request *req; |
614 | 628 | ||
@@ -616,25 +630,31 @@ static void gs_free_requests(struct usb_ep *ep, struct list_head *head) | |||
616 | req = list_entry(head->next, struct usb_request, list); | 630 | req = list_entry(head->next, struct usb_request, list); |
617 | list_del(&req->list); | 631 | list_del(&req->list); |
618 | gs_free_req(ep, req); | 632 | gs_free_req(ep, req); |
633 | if (allocated) | ||
634 | (*allocated)--; | ||
619 | } | 635 | } |
620 | } | 636 | } |
621 | 637 | ||
622 | static int gs_alloc_requests(struct usb_ep *ep, struct list_head *head, | 638 | static int gs_alloc_requests(struct usb_ep *ep, struct list_head *head, |
623 | void (*fn)(struct usb_ep *, struct usb_request *)) | 639 | void (*fn)(struct usb_ep *, struct usb_request *), |
640 | int *allocated) | ||
624 | { | 641 | { |
625 | int i; | 642 | int i; |
626 | struct usb_request *req; | 643 | struct usb_request *req; |
644 | int n = allocated ? QUEUE_SIZE - *allocated : QUEUE_SIZE; | ||
627 | 645 | ||
628 | /* Pre-allocate up to QUEUE_SIZE transfers, but if we can't | 646 | /* Pre-allocate up to QUEUE_SIZE transfers, but if we can't |
629 | * do quite that many this time, don't fail ... we just won't | 647 | * do quite that many this time, don't fail ... we just won't |
630 | * be as speedy as we might otherwise be. | 648 | * be as speedy as we might otherwise be. |
631 | */ | 649 | */ |
632 | for (i = 0; i < QUEUE_SIZE; i++) { | 650 | for (i = 0; i < n; i++) { |
633 | req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC); | 651 | req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC); |
634 | if (!req) | 652 | if (!req) |
635 | return list_empty(head) ? -ENOMEM : 0; | 653 | return list_empty(head) ? -ENOMEM : 0; |
636 | req->complete = fn; | 654 | req->complete = fn; |
637 | list_add_tail(&req->list, head); | 655 | list_add_tail(&req->list, head); |
656 | if (allocated) | ||
657 | (*allocated)++; | ||
638 | } | 658 | } |
639 | return 0; | 659 | return 0; |
640 | } | 660 | } |
@@ -661,14 +681,15 @@ static int gs_start_io(struct gs_port *port) | |||
661 | * configurations may use different endpoints with a given port; | 681 | * configurations may use different endpoints with a given port; |
662 | * and high speed vs full speed changes packet sizes too. | 682 | * and high speed vs full speed changes packet sizes too. |
663 | */ | 683 | */ |
664 | status = gs_alloc_requests(ep, head, gs_read_complete); | 684 | status = gs_alloc_requests(ep, head, gs_read_complete, |
685 | &port->read_allocated); | ||
665 | if (status) | 686 | if (status) |
666 | return status; | 687 | return status; |
667 | 688 | ||
668 | status = gs_alloc_requests(port->port_usb->in, &port->write_pool, | 689 | status = gs_alloc_requests(port->port_usb->in, &port->write_pool, |
669 | gs_write_complete); | 690 | gs_write_complete, &port->write_allocated); |
670 | if (status) { | 691 | if (status) { |
671 | gs_free_requests(ep, head); | 692 | gs_free_requests(ep, head, &port->read_allocated); |
672 | return status; | 693 | return status; |
673 | } | 694 | } |
674 | 695 | ||
@@ -680,8 +701,9 @@ static int gs_start_io(struct gs_port *port) | |||
680 | if (started) { | 701 | if (started) { |
681 | tty_wakeup(port->port_tty); | 702 | tty_wakeup(port->port_tty); |
682 | } else { | 703 | } else { |
683 | gs_free_requests(ep, head); | 704 | gs_free_requests(ep, head, &port->read_allocated); |
684 | gs_free_requests(port->port_usb->in, &port->write_pool); | 705 | gs_free_requests(port->port_usb->in, &port->write_pool, |
706 | &port->write_allocated); | ||
685 | status = -EIO; | 707 | status = -EIO; |
686 | } | 708 | } |
687 | 709 | ||
@@ -1315,8 +1337,12 @@ void gserial_disconnect(struct gserial *gser) | |||
1315 | spin_lock_irqsave(&port->port_lock, flags); | 1337 | spin_lock_irqsave(&port->port_lock, flags); |
1316 | if (port->open_count == 0 && !port->openclose) | 1338 | if (port->open_count == 0 && !port->openclose) |
1317 | gs_buf_free(&port->port_write_buf); | 1339 | gs_buf_free(&port->port_write_buf); |
1318 | gs_free_requests(gser->out, &port->read_pool); | 1340 | gs_free_requests(gser->out, &port->read_pool, NULL); |
1319 | gs_free_requests(gser->out, &port->read_queue); | 1341 | gs_free_requests(gser->out, &port->read_queue, NULL); |
1320 | gs_free_requests(gser->in, &port->write_pool); | 1342 | gs_free_requests(gser->in, &port->write_pool, NULL); |
1343 | |||
1344 | port->read_allocated = port->read_started = | ||
1345 | port->write_allocated = port->write_started = 0; | ||
1346 | |||
1321 | spin_unlock_irqrestore(&port->port_lock, flags); | 1347 | spin_unlock_irqrestore(&port->port_lock, flags); |
1322 | } | 1348 | } |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index bf2e7d234533..6f4f8e6a40c7 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -93,8 +93,9 @@ config USB_EHCI_TT_NEWSCHED | |||
93 | 93 | ||
94 | config USB_EHCI_BIG_ENDIAN_MMIO | 94 | config USB_EHCI_BIG_ENDIAN_MMIO |
95 | bool | 95 | bool |
96 | depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || ARCH_IXP4XX || \ | 96 | depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ |
97 | XPS_USB_HCD_XILINX || PPC_MPC512x) | 97 | ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ |
98 | PPC_MPC512x || CPU_CAVIUM_OCTEON) | ||
98 | default y | 99 | default y |
99 | 100 | ||
100 | config USB_EHCI_BIG_ENDIAN_DESC | 101 | config USB_EHCI_BIG_ENDIAN_DESC |
@@ -121,7 +122,7 @@ config USB_EHCI_FSL | |||
121 | bool "Support for Freescale on-chip EHCI USB controller" | 122 | bool "Support for Freescale on-chip EHCI USB controller" |
122 | depends on USB_EHCI_HCD && FSL_SOC | 123 | depends on USB_EHCI_HCD && FSL_SOC |
123 | select USB_EHCI_ROOT_HUB_TT | 124 | select USB_EHCI_ROOT_HUB_TT |
124 | select USB_FSL_MPH_DR_OF | 125 | select USB_FSL_MPH_DR_OF if OF |
125 | ---help--- | 126 | ---help--- |
126 | Variation of ARC USB block used in some Freescale chips. | 127 | Variation of ARC USB block used in some Freescale chips. |
127 | 128 | ||
@@ -434,3 +435,28 @@ config USB_IMX21_HCD | |||
434 | To compile this driver as a module, choose M here: the | 435 | To compile this driver as a module, choose M here: the |
435 | module will be called "imx21-hcd". | 436 | module will be called "imx21-hcd". |
436 | 437 | ||
438 | config USB_OCTEON_EHCI | ||
439 | bool "Octeon on-chip EHCI support" | ||
440 | depends on USB && USB_EHCI_HCD && CPU_CAVIUM_OCTEON | ||
441 | default n | ||
442 | select USB_EHCI_BIG_ENDIAN_MMIO | ||
443 | help | ||
444 | Enable support for the Octeon II SOC's on-chip EHCI | ||
445 | controller. It is needed for high-speed (480Mbit/sec) | ||
446 | USB 2.0 device support. All CN6XXX based chips with USB are | ||
447 | supported. | ||
448 | |||
449 | config USB_OCTEON_OHCI | ||
450 | bool "Octeon on-chip OHCI support" | ||
451 | depends on USB && USB_OHCI_HCD && CPU_CAVIUM_OCTEON | ||
452 | default USB_OCTEON_EHCI | ||
453 | select USB_OHCI_BIG_ENDIAN_MMIO | ||
454 | select USB_OHCI_LITTLE_ENDIAN | ||
455 | help | ||
456 | Enable support for the Octeon II SOC's on-chip OHCI | ||
457 | controller. It is needed for low-speed USB 1.0 device | ||
458 | support. All CN6XXX based chips with USB are supported. | ||
459 | |||
460 | config USB_OCTEON2_COMMON | ||
461 | bool | ||
462 | default y if USB_OCTEON_EHCI || USB_OCTEON_OHCI | ||
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 91c5a1bd1026..624a362f2fee 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile | |||
@@ -34,3 +34,4 @@ obj-$(CONFIG_USB_ISP1760_HCD) += isp1760.o | |||
34 | obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o | 34 | obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o |
35 | obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o | 35 | obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o |
36 | obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o | 36 | obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o |
37 | obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2adae8e39bba..502a7e6fef42 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1211,6 +1211,11 @@ MODULE_LICENSE ("GPL"); | |||
1211 | #define PLATFORM_DRIVER ehci_atmel_driver | 1211 | #define PLATFORM_DRIVER ehci_atmel_driver |
1212 | #endif | 1212 | #endif |
1213 | 1213 | ||
1214 | #ifdef CONFIG_USB_OCTEON_EHCI | ||
1215 | #include "ehci-octeon.c" | ||
1216 | #define PLATFORM_DRIVER ehci_octeon_driver | ||
1217 | #endif | ||
1218 | |||
1214 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ | 1219 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ |
1215 | !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ | 1220 | !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ |
1216 | !defined(XILINX_OF_PLATFORM_DRIVER) | 1221 | !defined(XILINX_OF_PLATFORM_DRIVER) |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index ac9c4d7c44af..bce85055019a 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -36,6 +36,8 @@ struct ehci_mxc_priv { | |||
36 | static int ehci_mxc_setup(struct usb_hcd *hcd) | 36 | static int ehci_mxc_setup(struct usb_hcd *hcd) |
37 | { | 37 | { |
38 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 38 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
39 | struct device *dev = hcd->self.controller; | ||
40 | struct mxc_usbh_platform_data *pdata = dev_get_platdata(dev); | ||
39 | int retval; | 41 | int retval; |
40 | 42 | ||
41 | /* EHCI registers start at offset 0x100 */ | 43 | /* EHCI registers start at offset 0x100 */ |
@@ -63,6 +65,12 @@ static int ehci_mxc_setup(struct usb_hcd *hcd) | |||
63 | 65 | ||
64 | ehci_reset(ehci); | 66 | ehci_reset(ehci); |
65 | 67 | ||
68 | /* set up the PORTSCx register */ | ||
69 | ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); | ||
70 | |||
71 | /* is this really needed? */ | ||
72 | msleep(10); | ||
73 | |||
66 | ehci_port_power(ehci, 0); | 74 | ehci_port_power(ehci, 0); |
67 | return 0; | 75 | return 0; |
68 | } | 76 | } |
@@ -114,7 +122,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
114 | struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data; | 122 | struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data; |
115 | struct usb_hcd *hcd; | 123 | struct usb_hcd *hcd; |
116 | struct resource *res; | 124 | struct resource *res; |
117 | int irq, ret, temp; | 125 | int irq, ret; |
118 | struct ehci_mxc_priv *priv; | 126 | struct ehci_mxc_priv *priv; |
119 | struct device *dev = &pdev->dev; | 127 | struct device *dev = &pdev->dev; |
120 | 128 | ||
@@ -188,10 +196,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
188 | clk_enable(priv->ahbclk); | 196 | clk_enable(priv->ahbclk); |
189 | } | 197 | } |
190 | 198 | ||
191 | /* set up the PORTSCx register */ | ||
192 | ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); | ||
193 | mdelay(10); | ||
194 | |||
195 | /* setup specific usb hw */ | 199 | /* setup specific usb hw */ |
196 | ret = mxc_initialize_usb_hw(pdev->id, pdata->flags); | 200 | ret = mxc_initialize_usb_hw(pdev->id, pdata->flags); |
197 | if (ret < 0) | 201 | if (ret < 0) |
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c new file mode 100644 index 000000000000..a31a031178a8 --- /dev/null +++ b/drivers/usb/host/ehci-octeon.c | |||
@@ -0,0 +1,207 @@ | |||
1 | /* | ||
2 | * EHCI HCD glue for Cavium Octeon II SOCs. | ||
3 | * | ||
4 | * Loosely based on ehci-au1xxx.c | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2010 Cavium Networks | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <asm/octeon/octeon.h> | ||
17 | #include <asm/octeon/cvmx-uctlx-defs.h> | ||
18 | |||
19 | #define OCTEON_EHCI_HCD_NAME "octeon-ehci" | ||
20 | |||
21 | /* Common clock init code. */ | ||
22 | void octeon2_usb_clocks_start(void); | ||
23 | void octeon2_usb_clocks_stop(void); | ||
24 | |||
25 | static void ehci_octeon_start(void) | ||
26 | { | ||
27 | union cvmx_uctlx_ehci_ctl ehci_ctl; | ||
28 | |||
29 | octeon2_usb_clocks_start(); | ||
30 | |||
31 | ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); | ||
32 | /* Use 64-bit addressing. */ | ||
33 | ehci_ctl.s.ehci_64b_addr_en = 1; | ||
34 | ehci_ctl.s.l2c_addr_msb = 0; | ||
35 | ehci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ | ||
36 | ehci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ | ||
37 | cvmx_write_csr(CVMX_UCTLX_EHCI_CTL(0), ehci_ctl.u64); | ||
38 | } | ||
39 | |||
40 | static void ehci_octeon_stop(void) | ||
41 | { | ||
42 | octeon2_usb_clocks_stop(); | ||
43 | } | ||
44 | |||
45 | static const struct hc_driver ehci_octeon_hc_driver = { | ||
46 | .description = hcd_name, | ||
47 | .product_desc = "Octeon EHCI", | ||
48 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
49 | |||
50 | /* | ||
51 | * generic hardware linkage | ||
52 | */ | ||
53 | .irq = ehci_irq, | ||
54 | .flags = HCD_MEMORY | HCD_USB2, | ||
55 | |||
56 | /* | ||
57 | * basic lifecycle operations | ||
58 | */ | ||
59 | .reset = ehci_init, | ||
60 | .start = ehci_run, | ||
61 | .stop = ehci_stop, | ||
62 | .shutdown = ehci_shutdown, | ||
63 | |||
64 | /* | ||
65 | * managing i/o requests and associated device resources | ||
66 | */ | ||
67 | .urb_enqueue = ehci_urb_enqueue, | ||
68 | .urb_dequeue = ehci_urb_dequeue, | ||
69 | .endpoint_disable = ehci_endpoint_disable, | ||
70 | .endpoint_reset = ehci_endpoint_reset, | ||
71 | |||
72 | /* | ||
73 | * scheduling support | ||
74 | */ | ||
75 | .get_frame_number = ehci_get_frame, | ||
76 | |||
77 | /* | ||
78 | * root hub support | ||
79 | */ | ||
80 | .hub_status_data = ehci_hub_status_data, | ||
81 | .hub_control = ehci_hub_control, | ||
82 | .bus_suspend = ehci_bus_suspend, | ||
83 | .bus_resume = ehci_bus_resume, | ||
84 | .relinquish_port = ehci_relinquish_port, | ||
85 | .port_handed_over = ehci_port_handed_over, | ||
86 | |||
87 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
88 | }; | ||
89 | |||
90 | static u64 ehci_octeon_dma_mask = DMA_BIT_MASK(64); | ||
91 | |||
92 | static int ehci_octeon_drv_probe(struct platform_device *pdev) | ||
93 | { | ||
94 | struct usb_hcd *hcd; | ||
95 | struct ehci_hcd *ehci; | ||
96 | struct resource *res_mem; | ||
97 | int irq; | ||
98 | int ret; | ||
99 | |||
100 | if (usb_disabled()) | ||
101 | return -ENODEV; | ||
102 | |||
103 | irq = platform_get_irq(pdev, 0); | ||
104 | if (irq < 0) { | ||
105 | dev_err(&pdev->dev, "No irq assigned\n"); | ||
106 | return -ENODEV; | ||
107 | } | ||
108 | |||
109 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
110 | if (res_mem == NULL) { | ||
111 | dev_err(&pdev->dev, "No register space assigned\n"); | ||
112 | return -ENODEV; | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * We can DMA from anywhere. But the descriptors must be in | ||
117 | * the lower 4GB. | ||
118 | */ | ||
119 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
120 | pdev->dev.dma_mask = &ehci_octeon_dma_mask; | ||
121 | |||
122 | hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon"); | ||
123 | if (!hcd) | ||
124 | return -ENOMEM; | ||
125 | |||
126 | hcd->rsrc_start = res_mem->start; | ||
127 | hcd->rsrc_len = res_mem->end - res_mem->start + 1; | ||
128 | |||
129 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | ||
130 | OCTEON_EHCI_HCD_NAME)) { | ||
131 | dev_err(&pdev->dev, "request_mem_region failed\n"); | ||
132 | ret = -EBUSY; | ||
133 | goto err1; | ||
134 | } | ||
135 | |||
136 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
137 | if (!hcd->regs) { | ||
138 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
139 | ret = -ENOMEM; | ||
140 | goto err2; | ||
141 | } | ||
142 | |||
143 | ehci_octeon_start(); | ||
144 | |||
145 | ehci = hcd_to_ehci(hcd); | ||
146 | |||
147 | /* Octeon EHCI matches CPU endianness. */ | ||
148 | #ifdef __BIG_ENDIAN | ||
149 | ehci->big_endian_mmio = 1; | ||
150 | #endif | ||
151 | |||
152 | ehci->caps = hcd->regs; | ||
153 | ehci->regs = hcd->regs + | ||
154 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | ||
155 | /* cache this readonly data; minimize chip reads */ | ||
156 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | ||
157 | |||
158 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); | ||
159 | if (ret) { | ||
160 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | ||
161 | goto err3; | ||
162 | } | ||
163 | |||
164 | platform_set_drvdata(pdev, hcd); | ||
165 | |||
166 | /* root ports should always stay powered */ | ||
167 | ehci_port_power(ehci, 1); | ||
168 | |||
169 | return 0; | ||
170 | err3: | ||
171 | ehci_octeon_stop(); | ||
172 | |||
173 | iounmap(hcd->regs); | ||
174 | err2: | ||
175 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
176 | err1: | ||
177 | usb_put_hcd(hcd); | ||
178 | return ret; | ||
179 | } | ||
180 | |||
181 | static int ehci_octeon_drv_remove(struct platform_device *pdev) | ||
182 | { | ||
183 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
184 | |||
185 | usb_remove_hcd(hcd); | ||
186 | |||
187 | ehci_octeon_stop(); | ||
188 | iounmap(hcd->regs); | ||
189 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
190 | usb_put_hcd(hcd); | ||
191 | |||
192 | platform_set_drvdata(pdev, NULL); | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static struct platform_driver ehci_octeon_driver = { | ||
198 | .probe = ehci_octeon_drv_probe, | ||
199 | .remove = ehci_octeon_drv_remove, | ||
200 | .shutdown = usb_hcd_platform_shutdown, | ||
201 | .driver = { | ||
202 | .name = OCTEON_EHCI_HCD_NAME, | ||
203 | .owner = THIS_MODULE, | ||
204 | } | ||
205 | }; | ||
206 | |||
207 | MODULE_ALIAS("platform:" OCTEON_EHCI_HCD_NAME); | ||
diff --git a/drivers/usb/host/octeon2-common.c b/drivers/usb/host/octeon2-common.c new file mode 100644 index 000000000000..72d672cfcf39 --- /dev/null +++ b/drivers/usb/host/octeon2-common.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2010 Cavium Networks | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/delay.h> | ||
11 | |||
12 | #include <asm/atomic.h> | ||
13 | |||
14 | #include <asm/octeon/octeon.h> | ||
15 | #include <asm/octeon/cvmx-uctlx-defs.h> | ||
16 | |||
17 | static atomic_t octeon2_usb_clock_start_cnt = ATOMIC_INIT(0); | ||
18 | |||
19 | void octeon2_usb_clocks_start(void) | ||
20 | { | ||
21 | u64 div; | ||
22 | union cvmx_uctlx_if_ena if_ena; | ||
23 | union cvmx_uctlx_clk_rst_ctl clk_rst_ctl; | ||
24 | union cvmx_uctlx_uphy_ctl_status uphy_ctl_status; | ||
25 | union cvmx_uctlx_uphy_portx_ctl_status port_ctl_status; | ||
26 | int i; | ||
27 | unsigned long io_clk_64_to_ns; | ||
28 | |||
29 | if (atomic_inc_return(&octeon2_usb_clock_start_cnt) != 1) | ||
30 | return; | ||
31 | |||
32 | io_clk_64_to_ns = 64000000000ull / octeon_get_io_clock_rate(); | ||
33 | |||
34 | /* | ||
35 | * Step 1: Wait for voltages stable. That surely happened | ||
36 | * before starting the kernel. | ||
37 | * | ||
38 | * Step 2: Enable SCLK of UCTL by writing UCTL0_IF_ENA[EN] = 1 | ||
39 | */ | ||
40 | if_ena.u64 = 0; | ||
41 | if_ena.s.en = 1; | ||
42 | cvmx_write_csr(CVMX_UCTLX_IF_ENA(0), if_ena.u64); | ||
43 | |||
44 | /* Step 3: Configure the reference clock, PHY, and HCLK */ | ||
45 | clk_rst_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_CLK_RST_CTL(0)); | ||
46 | /* 3a */ | ||
47 | clk_rst_ctl.s.p_por = 1; | ||
48 | clk_rst_ctl.s.hrst = 0; | ||
49 | clk_rst_ctl.s.p_prst = 0; | ||
50 | clk_rst_ctl.s.h_clkdiv_rst = 0; | ||
51 | clk_rst_ctl.s.o_clkdiv_rst = 0; | ||
52 | clk_rst_ctl.s.h_clkdiv_en = 0; | ||
53 | clk_rst_ctl.s.o_clkdiv_en = 0; | ||
54 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
55 | |||
56 | /* 3b */ | ||
57 | /* 12MHz crystal. */ | ||
58 | clk_rst_ctl.s.p_refclk_sel = 0; | ||
59 | clk_rst_ctl.s.p_refclk_div = 0; | ||
60 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
61 | |||
62 | /* 3c */ | ||
63 | div = octeon_get_io_clock_rate() / 130000000ull; | ||
64 | |||
65 | switch (div) { | ||
66 | case 0: | ||
67 | div = 1; | ||
68 | break; | ||
69 | case 1: | ||
70 | case 2: | ||
71 | case 3: | ||
72 | case 4: | ||
73 | break; | ||
74 | case 5: | ||
75 | div = 4; | ||
76 | break; | ||
77 | case 6: | ||
78 | case 7: | ||
79 | div = 6; | ||
80 | break; | ||
81 | case 8: | ||
82 | case 9: | ||
83 | case 10: | ||
84 | case 11: | ||
85 | div = 8; | ||
86 | break; | ||
87 | default: | ||
88 | div = 12; | ||
89 | break; | ||
90 | } | ||
91 | clk_rst_ctl.s.h_div = div; | ||
92 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
93 | /* Read it back, */ | ||
94 | clk_rst_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_CLK_RST_CTL(0)); | ||
95 | clk_rst_ctl.s.h_clkdiv_en = 1; | ||
96 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
97 | /* 3d */ | ||
98 | clk_rst_ctl.s.h_clkdiv_rst = 1; | ||
99 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
100 | |||
101 | /* 3e: delay 64 io clocks */ | ||
102 | ndelay(io_clk_64_to_ns); | ||
103 | |||
104 | /* | ||
105 | * Step 4: Program the power-on reset field in the UCTL | ||
106 | * clock-reset-control register. | ||
107 | */ | ||
108 | clk_rst_ctl.s.p_por = 0; | ||
109 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
110 | |||
111 | /* Step 5: Wait 1 ms for the PHY clock to start. */ | ||
112 | mdelay(1); | ||
113 | |||
114 | /* | ||
115 | * Step 6: Program the reset input from automatic test | ||
116 | * equipment field in the UPHY CSR | ||
117 | */ | ||
118 | uphy_ctl_status.u64 = cvmx_read_csr(CVMX_UCTLX_UPHY_CTL_STATUS(0)); | ||
119 | uphy_ctl_status.s.ate_reset = 1; | ||
120 | cvmx_write_csr(CVMX_UCTLX_UPHY_CTL_STATUS(0), uphy_ctl_status.u64); | ||
121 | |||
122 | /* Step 7: Wait for at least 10ns. */ | ||
123 | ndelay(10); | ||
124 | |||
125 | /* Step 8: Clear the ATE_RESET field in the UPHY CSR. */ | ||
126 | uphy_ctl_status.s.ate_reset = 0; | ||
127 | cvmx_write_csr(CVMX_UCTLX_UPHY_CTL_STATUS(0), uphy_ctl_status.u64); | ||
128 | |||
129 | /* | ||
130 | * Step 9: Wait for at least 20ns for UPHY to output PHY clock | ||
131 | * signals and OHCI_CLK48 | ||
132 | */ | ||
133 | ndelay(20); | ||
134 | |||
135 | /* Step 10: Configure the OHCI_CLK48 and OHCI_CLK12 clocks. */ | ||
136 | /* 10a */ | ||
137 | clk_rst_ctl.s.o_clkdiv_rst = 1; | ||
138 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
139 | |||
140 | /* 10b */ | ||
141 | clk_rst_ctl.s.o_clkdiv_en = 1; | ||
142 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
143 | |||
144 | /* 10c */ | ||
145 | ndelay(io_clk_64_to_ns); | ||
146 | |||
147 | /* | ||
148 | * Step 11: Program the PHY reset field: | ||
149 | * UCTL0_CLK_RST_CTL[P_PRST] = 1 | ||
150 | */ | ||
151 | clk_rst_ctl.s.p_prst = 1; | ||
152 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
153 | |||
154 | /* Step 12: Wait 1 uS. */ | ||
155 | udelay(1); | ||
156 | |||
157 | /* Step 13: Program the HRESET_N field: UCTL0_CLK_RST_CTL[HRST] = 1 */ | ||
158 | clk_rst_ctl.s.hrst = 1; | ||
159 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
160 | |||
161 | /* Now we can set some other registers. */ | ||
162 | |||
163 | for (i = 0; i <= 1; i++) { | ||
164 | port_ctl_status.u64 = | ||
165 | cvmx_read_csr(CVMX_UCTLX_UPHY_PORTX_CTL_STATUS(i, 0)); | ||
166 | /* Set txvreftune to 15 to obtain complient 'eye' diagram. */ | ||
167 | port_ctl_status.s.txvreftune = 15; | ||
168 | cvmx_write_csr(CVMX_UCTLX_UPHY_PORTX_CTL_STATUS(i, 0), | ||
169 | port_ctl_status.u64); | ||
170 | } | ||
171 | } | ||
172 | EXPORT_SYMBOL(octeon2_usb_clocks_start); | ||
173 | |||
174 | void octeon2_usb_clocks_stop(void) | ||
175 | { | ||
176 | union cvmx_uctlx_if_ena if_ena; | ||
177 | |||
178 | if (atomic_dec_return(&octeon2_usb_clock_start_cnt) != 0) | ||
179 | return; | ||
180 | |||
181 | if_ena.u64 = 0; | ||
182 | if_ena.s.en = 0; | ||
183 | cvmx_write_csr(CVMX_UCTLX_IF_ENA(0), if_ena.u64); | ||
184 | } | ||
185 | EXPORT_SYMBOL(octeon2_usb_clocks_stop); | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index f3713f43f3fe..5179acb7aa2f 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -1106,6 +1106,11 @@ MODULE_LICENSE ("GPL"); | |||
1106 | #define PLATFORM_DRIVER ohci_hcd_jz4740_driver | 1106 | #define PLATFORM_DRIVER ohci_hcd_jz4740_driver |
1107 | #endif | 1107 | #endif |
1108 | 1108 | ||
1109 | #ifdef CONFIG_USB_OCTEON_OHCI | ||
1110 | #include "ohci-octeon.c" | ||
1111 | #define PLATFORM_DRIVER ohci_octeon_driver | ||
1112 | #endif | ||
1113 | |||
1109 | #if !defined(PCI_DRIVER) && \ | 1114 | #if !defined(PCI_DRIVER) && \ |
1110 | !defined(PLATFORM_DRIVER) && \ | 1115 | !defined(PLATFORM_DRIVER) && \ |
1111 | !defined(OMAP1_PLATFORM_DRIVER) && \ | 1116 | !defined(OMAP1_PLATFORM_DRIVER) && \ |
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index 10e1872f3ab9..931d588c3fb5 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c | |||
@@ -273,4 +273,4 @@ static struct platform_driver ohci_hcd_jz4740_driver = { | |||
273 | }, | 273 | }, |
274 | }; | 274 | }; |
275 | 275 | ||
276 | MODULE_ALIAS("platfrom:jz4740-ohci"); | 276 | MODULE_ALIAS("platform:jz4740-ohci"); |
diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c new file mode 100644 index 000000000000..e4ddfaf8870f --- /dev/null +++ b/drivers/usb/host/ohci-octeon.c | |||
@@ -0,0 +1,214 @@ | |||
1 | /* | ||
2 | * EHCI HCD glue for Cavium Octeon II SOCs. | ||
3 | * | ||
4 | * Loosely based on ehci-au1xxx.c | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2010 Cavium Networks | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <asm/octeon/octeon.h> | ||
17 | #include <asm/octeon/cvmx-uctlx-defs.h> | ||
18 | |||
19 | #define OCTEON_OHCI_HCD_NAME "octeon-ohci" | ||
20 | |||
21 | /* Common clock init code. */ | ||
22 | void octeon2_usb_clocks_start(void); | ||
23 | void octeon2_usb_clocks_stop(void); | ||
24 | |||
25 | static void ohci_octeon_hw_start(void) | ||
26 | { | ||
27 | union cvmx_uctlx_ohci_ctl ohci_ctl; | ||
28 | |||
29 | octeon2_usb_clocks_start(); | ||
30 | |||
31 | ohci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_OHCI_CTL(0)); | ||
32 | ohci_ctl.s.l2c_addr_msb = 0; | ||
33 | ohci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ | ||
34 | ohci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ | ||
35 | cvmx_write_csr(CVMX_UCTLX_OHCI_CTL(0), ohci_ctl.u64); | ||
36 | |||
37 | } | ||
38 | |||
39 | static void ohci_octeon_hw_stop(void) | ||
40 | { | ||
41 | /* Undo ohci_octeon_start() */ | ||
42 | octeon2_usb_clocks_stop(); | ||
43 | } | ||
44 | |||
45 | static int __devinit ohci_octeon_start(struct usb_hcd *hcd) | ||
46 | { | ||
47 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
48 | int ret; | ||
49 | |||
50 | ret = ohci_init(ohci); | ||
51 | |||
52 | if (ret < 0) | ||
53 | return ret; | ||
54 | |||
55 | ret = ohci_run(ohci); | ||
56 | |||
57 | if (ret < 0) { | ||
58 | ohci_err(ohci, "can't start %s", hcd->self.bus_name); | ||
59 | ohci_stop(hcd); | ||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static const struct hc_driver ohci_octeon_hc_driver = { | ||
67 | .description = hcd_name, | ||
68 | .product_desc = "Octeon OHCI", | ||
69 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
70 | |||
71 | /* | ||
72 | * generic hardware linkage | ||
73 | */ | ||
74 | .irq = ohci_irq, | ||
75 | .flags = HCD_USB11 | HCD_MEMORY, | ||
76 | |||
77 | /* | ||
78 | * basic lifecycle operations | ||
79 | */ | ||
80 | .start = ohci_octeon_start, | ||
81 | .stop = ohci_stop, | ||
82 | .shutdown = ohci_shutdown, | ||
83 | |||
84 | /* | ||
85 | * managing i/o requests and associated device resources | ||
86 | */ | ||
87 | .urb_enqueue = ohci_urb_enqueue, | ||
88 | .urb_dequeue = ohci_urb_dequeue, | ||
89 | .endpoint_disable = ohci_endpoint_disable, | ||
90 | |||
91 | /* | ||
92 | * scheduling support | ||
93 | */ | ||
94 | .get_frame_number = ohci_get_frame, | ||
95 | |||
96 | /* | ||
97 | * root hub support | ||
98 | */ | ||
99 | .hub_status_data = ohci_hub_status_data, | ||
100 | .hub_control = ohci_hub_control, | ||
101 | |||
102 | .start_port_reset = ohci_start_port_reset, | ||
103 | }; | ||
104 | |||
105 | static int ohci_octeon_drv_probe(struct platform_device *pdev) | ||
106 | { | ||
107 | struct usb_hcd *hcd; | ||
108 | struct ohci_hcd *ohci; | ||
109 | void *reg_base; | ||
110 | struct resource *res_mem; | ||
111 | int irq; | ||
112 | int ret; | ||
113 | |||
114 | if (usb_disabled()) | ||
115 | return -ENODEV; | ||
116 | |||
117 | irq = platform_get_irq(pdev, 0); | ||
118 | if (irq < 0) { | ||
119 | dev_err(&pdev->dev, "No irq assigned\n"); | ||
120 | return -ENODEV; | ||
121 | } | ||
122 | |||
123 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
124 | if (res_mem == NULL) { | ||
125 | dev_err(&pdev->dev, "No register space assigned\n"); | ||
126 | return -ENODEV; | ||
127 | } | ||
128 | |||
129 | /* Ohci is a 32-bit device. */ | ||
130 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
131 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; | ||
132 | |||
133 | hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon"); | ||
134 | if (!hcd) | ||
135 | return -ENOMEM; | ||
136 | |||
137 | hcd->rsrc_start = res_mem->start; | ||
138 | hcd->rsrc_len = res_mem->end - res_mem->start + 1; | ||
139 | |||
140 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | ||
141 | OCTEON_OHCI_HCD_NAME)) { | ||
142 | dev_err(&pdev->dev, "request_mem_region failed\n"); | ||
143 | ret = -EBUSY; | ||
144 | goto err1; | ||
145 | } | ||
146 | |||
147 | reg_base = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
148 | if (!reg_base) { | ||
149 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
150 | ret = -ENOMEM; | ||
151 | goto err2; | ||
152 | } | ||
153 | |||
154 | ohci_octeon_hw_start(); | ||
155 | |||
156 | hcd->regs = reg_base; | ||
157 | |||
158 | ohci = hcd_to_ohci(hcd); | ||
159 | |||
160 | /* Octeon OHCI matches CPU endianness. */ | ||
161 | #ifdef __BIG_ENDIAN | ||
162 | ohci->flags |= OHCI_QUIRK_BE_MMIO; | ||
163 | #endif | ||
164 | |||
165 | ohci_hcd_init(ohci); | ||
166 | |||
167 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); | ||
168 | if (ret) { | ||
169 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | ||
170 | goto err3; | ||
171 | } | ||
172 | |||
173 | platform_set_drvdata(pdev, hcd); | ||
174 | |||
175 | return 0; | ||
176 | |||
177 | err3: | ||
178 | ohci_octeon_hw_stop(); | ||
179 | |||
180 | iounmap(hcd->regs); | ||
181 | err2: | ||
182 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
183 | err1: | ||
184 | usb_put_hcd(hcd); | ||
185 | return ret; | ||
186 | } | ||
187 | |||
188 | static int ohci_octeon_drv_remove(struct platform_device *pdev) | ||
189 | { | ||
190 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
191 | |||
192 | usb_remove_hcd(hcd); | ||
193 | |||
194 | ohci_octeon_hw_stop(); | ||
195 | iounmap(hcd->regs); | ||
196 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
197 | usb_put_hcd(hcd); | ||
198 | |||
199 | platform_set_drvdata(pdev, NULL); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static struct platform_driver ohci_octeon_driver = { | ||
205 | .probe = ohci_octeon_drv_probe, | ||
206 | .remove = ohci_octeon_drv_remove, | ||
207 | .shutdown = usb_hcd_platform_shutdown, | ||
208 | .driver = { | ||
209 | .name = OCTEON_OHCI_HCD_NAME, | ||
210 | .owner = THIS_MODULE, | ||
211 | } | ||
212 | }; | ||
213 | |||
214 | MODULE_ALIAS("platform:" OCTEON_OHCI_HCD_NAME); | ||
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 375664198776..c9078e4e1f4d 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -553,6 +553,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, | |||
553 | /* needed for power consumption */ | 553 | /* needed for power consumption */ |
554 | struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; | 554 | struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; |
555 | 555 | ||
556 | memset(&info, 0, sizeof(info)); | ||
556 | /* directly from the descriptor */ | 557 | /* directly from the descriptor */ |
557 | info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); | 558 | info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); |
558 | info.product = dev->product_id; | 559 | info.product = dev->product_id; |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 70d00e99a4b4..dd573abd2d1e 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -3008,6 +3008,7 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
3008 | #else | 3008 | #else |
3009 | x.sisusb_conactive = 0; | 3009 | x.sisusb_conactive = 0; |
3010 | #endif | 3010 | #endif |
3011 | memset(x.sisusb_reserved, 0, sizeof(x.sisusb_reserved)); | ||
3011 | 3012 | ||
3012 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) | 3013 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) |
3013 | retval = -EFAULT; | 3014 | retval = -EFAULT; |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 611a9d274363..fcb5206a65bd 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -171,8 +171,9 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci) | |||
171 | } | 171 | } |
172 | 172 | ||
173 | /* Start sampling ID pin, when plug is removed from MUSB */ | 173 | /* Start sampling ID pin, when plug is removed from MUSB */ |
174 | if (is_otg_enabled(musb) && (musb->xceiv->state == OTG_STATE_B_IDLE | 174 | if ((is_otg_enabled(musb) && (musb->xceiv->state == OTG_STATE_B_IDLE |
175 | || musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { | 175 | || musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) || |
176 | (musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) { | ||
176 | mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); | 177 | mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); |
177 | musb->a_wait_bcon = TIMER_DELAY; | 178 | musb->a_wait_bcon = TIMER_DELAY; |
178 | } | 179 | } |
@@ -323,30 +324,8 @@ int musb_platform_set_mode(struct musb *musb, u8 musb_mode) | |||
323 | return -EIO; | 324 | return -EIO; |
324 | } | 325 | } |
325 | 326 | ||
326 | int __init musb_platform_init(struct musb *musb, void *board_data) | 327 | static void musb_platform_reg_init(struct musb *musb) |
327 | { | 328 | { |
328 | |||
329 | /* | ||
330 | * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE | ||
331 | * and OTG HOST modes, while rev 1.1 and greater require PE7 to | ||
332 | * be low for DEVICE mode and high for HOST mode. We set it high | ||
333 | * here because we are in host mode | ||
334 | */ | ||
335 | |||
336 | if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) { | ||
337 | printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d \n", | ||
338 | musb->config->gpio_vrsel); | ||
339 | return -ENODEV; | ||
340 | } | ||
341 | gpio_direction_output(musb->config->gpio_vrsel, 0); | ||
342 | |||
343 | usb_nop_xceiv_register(); | ||
344 | musb->xceiv = otg_get_transceiver(); | ||
345 | if (!musb->xceiv) { | ||
346 | gpio_free(musb->config->gpio_vrsel); | ||
347 | return -ENODEV; | ||
348 | } | ||
349 | |||
350 | if (ANOMALY_05000346) { | 329 | if (ANOMALY_05000346) { |
351 | bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value); | 330 | bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value); |
352 | SSYNC(); | 331 | SSYNC(); |
@@ -358,7 +337,8 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
358 | } | 337 | } |
359 | 338 | ||
360 | /* Configure PLL oscillator register */ | 339 | /* Configure PLL oscillator register */ |
361 | bfin_write_USB_PLLOSC_CTRL(0x30a8); | 340 | bfin_write_USB_PLLOSC_CTRL(0x3080 | |
341 | ((480/musb->config->clkin) << 1)); | ||
362 | SSYNC(); | 342 | SSYNC(); |
363 | 343 | ||
364 | bfin_write_USB_SRP_CLKDIV((get_sclk()/1000) / 32 - 1); | 344 | bfin_write_USB_SRP_CLKDIV((get_sclk()/1000) / 32 - 1); |
@@ -380,6 +360,33 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
380 | EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA | | 360 | EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA | |
381 | EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA); | 361 | EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA); |
382 | SSYNC(); | 362 | SSYNC(); |
363 | } | ||
364 | |||
365 | int __init musb_platform_init(struct musb *musb, void *board_data) | ||
366 | { | ||
367 | |||
368 | /* | ||
369 | * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE | ||
370 | * and OTG HOST modes, while rev 1.1 and greater require PE7 to | ||
371 | * be low for DEVICE mode and high for HOST mode. We set it high | ||
372 | * here because we are in host mode | ||
373 | */ | ||
374 | |||
375 | if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) { | ||
376 | printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d\n", | ||
377 | musb->config->gpio_vrsel); | ||
378 | return -ENODEV; | ||
379 | } | ||
380 | gpio_direction_output(musb->config->gpio_vrsel, 0); | ||
381 | |||
382 | usb_nop_xceiv_register(); | ||
383 | musb->xceiv = otg_get_transceiver(); | ||
384 | if (!musb->xceiv) { | ||
385 | gpio_free(musb->config->gpio_vrsel); | ||
386 | return -ENODEV; | ||
387 | } | ||
388 | |||
389 | musb_platform_reg_init(musb); | ||
383 | 390 | ||
384 | if (is_host_enabled(musb)) { | 391 | if (is_host_enabled(musb)) { |
385 | musb->board_set_vbus = bfin_set_vbus; | 392 | musb->board_set_vbus = bfin_set_vbus; |
@@ -394,6 +401,27 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
394 | return 0; | 401 | return 0; |
395 | } | 402 | } |
396 | 403 | ||
404 | #ifdef CONFIG_PM | ||
405 | void musb_platform_save_context(struct musb *musb, | ||
406 | struct musb_context_registers *musb_context) | ||
407 | { | ||
408 | if (is_host_active(musb)) | ||
409 | /* | ||
410 | * During hibernate gpio_vrsel will change from high to low | ||
411 | * low which will generate wakeup event resume the system | ||
412 | * immediately. Set it to 0 before hibernate to avoid this | ||
413 | * wakeup event. | ||
414 | */ | ||
415 | gpio_set_value(musb->config->gpio_vrsel, 0); | ||
416 | } | ||
417 | |||
418 | void musb_platform_restore_context(struct musb *musb, | ||
419 | struct musb_context_registers *musb_context) | ||
420 | { | ||
421 | musb_platform_reg_init(musb); | ||
422 | } | ||
423 | #endif | ||
424 | |||
397 | int musb_platform_exit(struct musb *musb) | 425 | int musb_platform_exit(struct musb *musb) |
398 | { | 426 | { |
399 | gpio_free(musb->config->gpio_vrsel); | 427 | gpio_free(musb->config->gpio_vrsel); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index c9f9024c5515..e6669fc3b804 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -552,7 +552,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
552 | if (int_usb & MUSB_INTR_SESSREQ) { | 552 | if (int_usb & MUSB_INTR_SESSREQ) { |
553 | void __iomem *mbase = musb->mregs; | 553 | void __iomem *mbase = musb->mregs; |
554 | 554 | ||
555 | if (devctl & MUSB_DEVCTL_BDEVICE) { | 555 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS |
556 | && (devctl & MUSB_DEVCTL_BDEVICE)) { | ||
556 | DBG(3, "SessReq while on B state\n"); | 557 | DBG(3, "SessReq while on B state\n"); |
557 | return IRQ_HANDLED; | 558 | return IRQ_HANDLED; |
558 | } | 559 | } |
@@ -1052,6 +1053,11 @@ static void musb_shutdown(struct platform_device *pdev) | |||
1052 | clk_put(musb->clock); | 1053 | clk_put(musb->clock); |
1053 | spin_unlock_irqrestore(&musb->lock, flags); | 1054 | spin_unlock_irqrestore(&musb->lock, flags); |
1054 | 1055 | ||
1056 | if (!is_otg_enabled(musb) && is_host_enabled(musb)) | ||
1057 | usb_remove_hcd(musb_to_hcd(musb)); | ||
1058 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
1059 | musb_platform_exit(musb); | ||
1060 | |||
1055 | /* FIXME power down */ | 1061 | /* FIXME power down */ |
1056 | } | 1062 | } |
1057 | 1063 | ||
@@ -2244,13 +2250,6 @@ static int __exit musb_remove(struct platform_device *pdev) | |||
2244 | */ | 2250 | */ |
2245 | musb_exit_debugfs(musb); | 2251 | musb_exit_debugfs(musb); |
2246 | musb_shutdown(pdev); | 2252 | musb_shutdown(pdev); |
2247 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
2248 | if (musb->board_mode == MUSB_HOST) | ||
2249 | usb_remove_hcd(musb_to_hcd(musb)); | ||
2250 | #endif | ||
2251 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2252 | musb_platform_exit(musb); | ||
2253 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2254 | 2253 | ||
2255 | musb_free(musb); | 2254 | musb_free(musb); |
2256 | iounmap(ctrl_base); | 2255 | iounmap(ctrl_base); |
@@ -2411,9 +2410,6 @@ static int musb_suspend(struct device *dev) | |||
2411 | unsigned long flags; | 2410 | unsigned long flags; |
2412 | struct musb *musb = dev_to_musb(&pdev->dev); | 2411 | struct musb *musb = dev_to_musb(&pdev->dev); |
2413 | 2412 | ||
2414 | if (!musb->clock) | ||
2415 | return 0; | ||
2416 | |||
2417 | spin_lock_irqsave(&musb->lock, flags); | 2413 | spin_lock_irqsave(&musb->lock, flags); |
2418 | 2414 | ||
2419 | if (is_peripheral_active(musb)) { | 2415 | if (is_peripheral_active(musb)) { |
@@ -2428,10 +2424,12 @@ static int musb_suspend(struct device *dev) | |||
2428 | 2424 | ||
2429 | musb_save_context(musb); | 2425 | musb_save_context(musb); |
2430 | 2426 | ||
2431 | if (musb->set_clock) | 2427 | if (musb->clock) { |
2432 | musb->set_clock(musb->clock, 0); | 2428 | if (musb->set_clock) |
2433 | else | 2429 | musb->set_clock(musb->clock, 0); |
2434 | clk_disable(musb->clock); | 2430 | else |
2431 | clk_disable(musb->clock); | ||
2432 | } | ||
2435 | spin_unlock_irqrestore(&musb->lock, flags); | 2433 | spin_unlock_irqrestore(&musb->lock, flags); |
2436 | return 0; | 2434 | return 0; |
2437 | } | 2435 | } |
@@ -2441,13 +2439,12 @@ static int musb_resume_noirq(struct device *dev) | |||
2441 | struct platform_device *pdev = to_platform_device(dev); | 2439 | struct platform_device *pdev = to_platform_device(dev); |
2442 | struct musb *musb = dev_to_musb(&pdev->dev); | 2440 | struct musb *musb = dev_to_musb(&pdev->dev); |
2443 | 2441 | ||
2444 | if (!musb->clock) | 2442 | if (musb->clock) { |
2445 | return 0; | 2443 | if (musb->set_clock) |
2446 | 2444 | musb->set_clock(musb->clock, 1); | |
2447 | if (musb->set_clock) | 2445 | else |
2448 | musb->set_clock(musb->clock, 1); | 2446 | clk_enable(musb->clock); |
2449 | else | 2447 | } |
2450 | clk_enable(musb->clock); | ||
2451 | 2448 | ||
2452 | musb_restore_context(musb); | 2449 | musb_restore_context(musb); |
2453 | 2450 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 69797e5b46a7..febaabcc2b35 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -487,7 +487,7 @@ struct musb_context_registers { | |||
487 | }; | 487 | }; |
488 | 488 | ||
489 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ | 489 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
490 | defined(CONFIG_ARCH_OMAP4) | 490 | defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_BLACKFIN) |
491 | extern void musb_platform_save_context(struct musb *musb, | 491 | extern void musb_platform_save_context(struct musb *musb, |
492 | struct musb_context_registers *musb_context); | 492 | struct musb_context_registers *musb_context); |
493 | extern void musb_platform_restore_context(struct musb *musb, | 493 | extern void musb_platform_restore_context(struct musb *musb, |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 5d815049cbaa..36cfd060dbe5 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -644,10 +644,8 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
644 | */ | 644 | */ |
645 | 645 | ||
646 | csr |= MUSB_RXCSR_DMAENAB; | 646 | csr |= MUSB_RXCSR_DMAENAB; |
647 | if (!musb_ep->hb_mult && | ||
648 | musb_ep->hw_ep->rx_double_buffered) | ||
649 | csr |= MUSB_RXCSR_AUTOCLEAR; | ||
650 | #ifdef USE_MODE1 | 647 | #ifdef USE_MODE1 |
648 | csr |= MUSB_RXCSR_AUTOCLEAR; | ||
651 | /* csr |= MUSB_RXCSR_DMAMODE; */ | 649 | /* csr |= MUSB_RXCSR_DMAMODE; */ |
652 | 650 | ||
653 | /* this special sequence (enabling and then | 651 | /* this special sequence (enabling and then |
@@ -656,6 +654,10 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
656 | */ | 654 | */ |
657 | musb_writew(epio, MUSB_RXCSR, | 655 | musb_writew(epio, MUSB_RXCSR, |
658 | csr | MUSB_RXCSR_DMAMODE); | 656 | csr | MUSB_RXCSR_DMAMODE); |
657 | #else | ||
658 | if (!musb_ep->hb_mult && | ||
659 | musb_ep->hw_ep->rx_double_buffered) | ||
660 | csr |= MUSB_RXCSR_AUTOCLEAR; | ||
659 | #endif | 661 | #endif |
660 | musb_writew(epio, MUSB_RXCSR, csr); | 662 | musb_writew(epio, MUSB_RXCSR, csr); |
661 | 663 | ||
@@ -807,7 +809,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
807 | 809 | ||
808 | #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) | 810 | #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) |
809 | /* Autoclear doesn't clear RxPktRdy for short packets */ | 811 | /* Autoclear doesn't clear RxPktRdy for short packets */ |
810 | if ((dma->desired_mode == 0) | 812 | if ((dma->desired_mode == 0 && !hw_ep->rx_double_buffered) |
811 | || (dma->actual_len | 813 | || (dma->actual_len |
812 | & (musb_ep->packet_sz - 1))) { | 814 | & (musb_ep->packet_sz - 1))) { |
813 | /* ack the read! */ | 815 | /* ack the read! */ |
@@ -818,8 +820,16 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
818 | /* incomplete, and not short? wait for next IN packet */ | 820 | /* incomplete, and not short? wait for next IN packet */ |
819 | if ((request->actual < request->length) | 821 | if ((request->actual < request->length) |
820 | && (musb_ep->dma->actual_len | 822 | && (musb_ep->dma->actual_len |
821 | == musb_ep->packet_sz)) | 823 | == musb_ep->packet_sz)) { |
824 | /* In double buffer case, continue to unload fifo if | ||
825 | * there is Rx packet in FIFO. | ||
826 | **/ | ||
827 | csr = musb_readw(epio, MUSB_RXCSR); | ||
828 | if ((csr & MUSB_RXCSR_RXPKTRDY) && | ||
829 | hw_ep->rx_double_buffered) | ||
830 | goto exit; | ||
822 | return; | 831 | return; |
832 | } | ||
823 | #endif | 833 | #endif |
824 | musb_g_giveback(musb_ep, request, 0); | 834 | musb_g_giveback(musb_ep, request, 0); |
825 | 835 | ||
@@ -827,7 +837,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
827 | if (!request) | 837 | if (!request) |
828 | return; | 838 | return; |
829 | } | 839 | } |
830 | 840 | exit: | |
831 | /* Analyze request */ | 841 | /* Analyze request */ |
832 | rxstate(musb, to_musb_request(request)); | 842 | rxstate(musb, to_musb_request(request)); |
833 | } | 843 | } |
@@ -916,13 +926,9 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
916 | * likewise high bandwidth periodic tx | 926 | * likewise high bandwidth periodic tx |
917 | */ | 927 | */ |
918 | /* Set TXMAXP with the FIFO size of the endpoint | 928 | /* Set TXMAXP with the FIFO size of the endpoint |
919 | * to disable double buffering mode. Currently, It seems that double | 929 | * to disable double buffering mode. |
920 | * buffering has problem if musb RTL revision number < 2.0. | ||
921 | */ | 930 | */ |
922 | if (musb->hwvers < MUSB_HWVERS_2000) | 931 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); |
923 | musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); | ||
924 | else | ||
925 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); | ||
926 | 932 | ||
927 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; | 933 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; |
928 | if (musb_readw(regs, MUSB_TXCSR) | 934 | if (musb_readw(regs, MUSB_TXCSR) |
@@ -958,10 +964,7 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
958 | /* Set RXMAXP with the FIFO size of the endpoint | 964 | /* Set RXMAXP with the FIFO size of the endpoint |
959 | * to disable double buffering mode. | 965 | * to disable double buffering mode. |
960 | */ | 966 | */ |
961 | if (musb->hwvers < MUSB_HWVERS_2000) | 967 | musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); |
962 | musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_rx); | ||
963 | else | ||
964 | musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); | ||
965 | 968 | ||
966 | /* force shared fifo to OUT-only mode */ | 969 | /* force shared fifo to OUT-only mode */ |
967 | if (hw_ep->is_shared_fifo) { | 970 | if (hw_ep->is_shared_fifo) { |
@@ -1166,8 +1169,6 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1166 | : DMA_FROM_DEVICE); | 1169 | : DMA_FROM_DEVICE); |
1167 | request->mapped = 0; | 1170 | request->mapped = 0; |
1168 | } | 1171 | } |
1169 | } else if (!req->buf) { | ||
1170 | return -ENODATA; | ||
1171 | } else | 1172 | } else |
1172 | request->mapped = 0; | 1173 | request->mapped = 0; |
1173 | 1174 | ||
@@ -1695,8 +1696,10 @@ int __init musb_gadget_setup(struct musb *musb) | |||
1695 | musb_platform_try_idle(musb, 0); | 1696 | musb_platform_try_idle(musb, 0); |
1696 | 1697 | ||
1697 | status = device_register(&musb->g.dev); | 1698 | status = device_register(&musb->g.dev); |
1698 | if (status != 0) | 1699 | if (status != 0) { |
1700 | put_device(&musb->g.dev); | ||
1699 | the_gadget = NULL; | 1701 | the_gadget = NULL; |
1702 | } | ||
1700 | return status; | 1703 | return status; |
1701 | } | 1704 | } |
1702 | 1705 | ||
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h index 244267527a60..5a727c5b8676 100644 --- a/drivers/usb/musb/musb_regs.h +++ b/drivers/usb/musb/musb_regs.h | |||
@@ -633,8 +633,9 @@ static inline u8 musb_read_txhubaddr(void __iomem *mbase, u8 epnum) | |||
633 | return 0; | 633 | return 0; |
634 | } | 634 | } |
635 | 635 | ||
636 | static inline void musb_read_txhubport(void __iomem *mbase, u8 epnum) | 636 | static inline u8 musb_read_txhubport(void __iomem *mbase, u8 epnum) |
637 | { | 637 | { |
638 | return 0; | ||
638 | } | 639 | } |
639 | 640 | ||
640 | #endif /* CONFIG_BLACKFIN */ | 641 | #endif /* CONFIG_BLACKFIN */ |
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 6f771af5cbdb..563114d613d6 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c | |||
@@ -158,6 +158,8 @@ static int dma_channel_program(struct dma_channel *channel, | |||
158 | dma_addr_t dma_addr, u32 len) | 158 | dma_addr_t dma_addr, u32 len) |
159 | { | 159 | { |
160 | struct musb_dma_channel *musb_channel = channel->private_data; | 160 | struct musb_dma_channel *musb_channel = channel->private_data; |
161 | struct musb_dma_controller *controller = musb_channel->controller; | ||
162 | struct musb *musb = controller->private_data; | ||
161 | 163 | ||
162 | DBG(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n", | 164 | DBG(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n", |
163 | musb_channel->epnum, | 165 | musb_channel->epnum, |
@@ -167,6 +169,18 @@ static int dma_channel_program(struct dma_channel *channel, | |||
167 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || | 169 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || |
168 | channel->status == MUSB_DMA_STATUS_BUSY); | 170 | channel->status == MUSB_DMA_STATUS_BUSY); |
169 | 171 | ||
172 | /* | ||
173 | * The DMA engine in RTL1.8 and above cannot handle | ||
174 | * DMA addresses that are not aligned to a 4 byte boundary. | ||
175 | * It ends up masking the last two bits of the address | ||
176 | * programmed in DMA_ADDR. | ||
177 | * | ||
178 | * Fail such DMA transfers, so that the backup PIO mode | ||
179 | * can carry out the transfer | ||
180 | */ | ||
181 | if ((musb->hwvers >= MUSB_HWVERS_1800) && (dma_addr % 4)) | ||
182 | return false; | ||
183 | |||
170 | channel->actual_len = 0; | 184 | channel->actual_len = 0; |
171 | musb_channel->start_addr = dma_addr; | 185 | musb_channel->start_addr = dma_addr; |
172 | musb_channel->len = len; | 186 | musb_channel->len = len; |
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index 0bc97698af15..d335f484fcd8 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c | |||
@@ -124,7 +124,6 @@ | |||
124 | #define PHY_DPLL_CLK (1 << 0) | 124 | #define PHY_DPLL_CLK (1 << 0) |
125 | 125 | ||
126 | /* In module TWL4030_MODULE_PM_MASTER */ | 126 | /* In module TWL4030_MODULE_PM_MASTER */ |
127 | #define PROTECT_KEY 0x0E | ||
128 | #define STS_HW_CONDITIONS 0x0F | 127 | #define STS_HW_CONDITIONS 0x0F |
129 | 128 | ||
130 | /* In module TWL4030_MODULE_PM_RECEIVER */ | 129 | /* In module TWL4030_MODULE_PM_RECEIVER */ |
@@ -418,8 +417,13 @@ static void twl4030_phy_resume(struct twl4030_usb *twl) | |||
418 | static int twl4030_usb_ldo_init(struct twl4030_usb *twl) | 417 | static int twl4030_usb_ldo_init(struct twl4030_usb *twl) |
419 | { | 418 | { |
420 | /* Enable writing to power configuration registers */ | 419 | /* Enable writing to power configuration registers */ |
421 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY); | 420 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, |
422 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY); | 421 | TWL4030_PM_MASTER_KEY_CFG1, |
422 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
423 | |||
424 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, | ||
425 | TWL4030_PM_MASTER_KEY_CFG2, | ||
426 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
423 | 427 | ||
424 | /* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/ | 428 | /* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/ |
425 | /*twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/ | 429 | /*twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/ |
@@ -455,7 +459,8 @@ static int twl4030_usb_ldo_init(struct twl4030_usb *twl) | |||
455 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE); | 459 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE); |
456 | 460 | ||
457 | /* disable access to power configuration registers */ | 461 | /* disable access to power configuration registers */ |
458 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY); | 462 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, |
463 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
459 | 464 | ||
460 | return 0; | 465 | return 0; |
461 | 466 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 89a9a5847803..76f8b3556672 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -794,6 +794,8 @@ static struct usb_device_id id_table_combined [] = { | |||
794 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, | 794 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, |
795 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, | 795 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, |
796 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, | 796 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, |
797 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), | ||
798 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
797 | { }, /* Optional parameter entry */ | 799 | { }, /* Optional parameter entry */ |
798 | { } /* Terminating entry */ | 800 | { } /* Terminating entry */ |
799 | }; | 801 | }; |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 7dfe02f1fb6a..263f62551197 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -1100,3 +1100,10 @@ | |||
1100 | #define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18 | 1100 | #define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18 |
1101 | #define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C | 1101 | #define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C |
1102 | #define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D | 1102 | #define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D |
1103 | |||
1104 | /* | ||
1105 | * Milkymist One JTAG/Serial | ||
1106 | */ | ||
1107 | #define QIHARDWARE_VID 0x20B7 | ||
1108 | #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 | ||
1109 | |||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 2297fb1bcf65..ef2977d3a613 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -518,7 +518,7 @@ static const struct usb_device_id option_ids[] = { | |||
518 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, | 518 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, |
519 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, | 519 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, |
520 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, | 520 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, |
521 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, | 521 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, |
522 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, | 522 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, |
523 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, | 523 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, |
524 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, | 524 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 2054b1e25a65..d1268191acbd 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -331,10 +331,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp, | |||
331 | 331 | ||
332 | iu->iu_id = IU_ID_COMMAND; | 332 | iu->iu_id = IU_ID_COMMAND; |
333 | iu->tag = cpu_to_be16(stream_id); | 333 | iu->tag = cpu_to_be16(stream_id); |
334 | if (sdev->ordered_tags && (cmnd->request->cmd_flags & REQ_HARDBARRIER)) | 334 | iu->prio_attr = UAS_SIMPLE_TAG; |
335 | iu->prio_attr = UAS_ORDERED_TAG; | ||
336 | else | ||
337 | iu->prio_attr = UAS_SIMPLE_TAG; | ||
338 | iu->len = len; | 335 | iu->len = len; |
339 | int_to_scsilun(sdev->lun, &iu->lun); | 336 | int_to_scsilun(sdev->lun, &iu->lun); |
340 | memcpy(iu->cdb, cmnd->cmnd, cmnd->cmd_len); | 337 | memcpy(iu->cdb, cmnd->cmnd, cmnd->cmd_len); |