Skip to content

Commit af968e2

Browse files
committed
Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
* 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (21 commits) usb: ftdi_sio: add PID for Propox ISPcable III Revert "xHCI: reset-on-resume quirk for NEC uPD720200" xHCI: fix bug in xhci_clear_command_ring() usb: gadget: fsl_udc: fix dequeuing a request in progress usb: fsl_mxc_udc.c: Remove compile-time dependency of MX35 SoC type usb: fsl_mxc_udc.c: Fix build issue by including missing header file USB: fsl_udc_core: use usb_endpoint_xfer_isoc to judge ISO XFER usb: udc: Fix gadget driver's speed check in various UDC drivers usb: gadget: fix g_serial regression usb: renesas_usbhs: fixup driver speed usb: renesas_usbhs: fixup gadget.dev.driver when udc_stop. usb: renesas_usbhs: fixup signal the driver that cable was disconnected usb: renesas_usbhs: fixup device_register timing usb: musb: PM: fix context save/restore in suspend/resume path USB: linux-cdc-acm.inf: add support for the acm_ms gadget EHCI : Fix a regression in the ISO scheduler xHCI: reset-on-resume quirk for NEC uPD720200 USB: whci-hcd: fix endian conversion in qset_clear() USB: usb-storage: unusual_devs entry for Kingston DT 101 G2 usb: option: add SIMCom SIM5218 ...
2 parents f9143ea + 8593b6f commit af968e2

22 files changed

+101
-97
lines changed

Documentation/usb/linux-cdc-acm.inf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ ServiceBinary=%12%\USBSER.sys
9090
[SourceDisksFiles]
9191
[SourceDisksNames]
9292
[DeviceList]
93-
%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02
93+
%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02, USB\VID_1D6B&PID_0106&MI_00
9494

9595
[DeviceList.NTamd64]
96-
%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02
96+
%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02, USB\VID_1D6B&PID_0106&MI_00
9797

9898

9999
;------------------------------------------------------------------------------

drivers/usb/gadget/amd5536udc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ static int amd5536_start(struct usb_gadget_driver *driver,
19591959
u32 tmp;
19601960

19611961
if (!driver || !bind || !driver->setup
1962-
|| driver->speed != USB_SPEED_HIGH)
1962+
|| driver->speed < USB_SPEED_HIGH)
19631963
return -EINVAL;
19641964
if (!dev)
19651965
return -ENODEV;

drivers/usb/gadget/f_serial.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
131131
}
132132
if (!gser->port.in->desc || !gser->port.out->desc) {
133133
DBG(cdev, "activate generic ttyGS%d\n", gser->port_num);
134-
if (!config_ep_by_speed(cdev->gadget, f, gser->port.in) ||
135-
!config_ep_by_speed(cdev->gadget, f, gser->port.out)) {
134+
if (config_ep_by_speed(cdev->gadget, f, gser->port.in) ||
135+
config_ep_by_speed(cdev->gadget, f, gser->port.out)) {
136136
gser->port.in->desc = NULL;
137137
gser->port.out->desc = NULL;
138138
return -EINVAL;

drivers/usb/gadget/fsl_mxc_udc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/err.h>
1717
#include <linux/fsl_devices.h>
1818
#include <linux/platform_device.h>
19+
#include <linux/io.h>
1920

2021
#include <mach/hardware.h>
2122

@@ -88,7 +89,6 @@ int fsl_udc_clk_init(struct platform_device *pdev)
8889
void fsl_udc_clk_finalize(struct platform_device *pdev)
8990
{
9091
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
91-
#if defined(CONFIG_SOC_IMX35)
9292
if (cpu_is_mx35()) {
9393
unsigned int v;
9494

@@ -101,7 +101,6 @@ void fsl_udc_clk_finalize(struct platform_device *pdev)
101101
USBPHYCTRL_OTGBASE_OFFSET));
102102
}
103103
}
104-
#endif
105104

106105
/* ULPI transceivers don't need usbpll */
107106
if (pdata->phy_mode == FSL_USB2_PHY_ULPI) {

drivers/usb/gadget/fsl_qe_udc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,8 +2336,7 @@ static int fsl_qe_start(struct usb_gadget_driver *driver,
23362336
if (!udc_controller)
23372337
return -ENODEV;
23382338

2339-
if (!driver || (driver->speed != USB_SPEED_FULL
2340-
&& driver->speed != USB_SPEED_HIGH)
2339+
if (!driver || driver->speed < USB_SPEED_FULL
23412340
|| !bind || !driver->disconnect || !driver->setup)
23422341
return -EINVAL;
23432342

drivers/usb/gadget/fsl_udc_core.c

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -696,12 +696,31 @@ static void fsl_free_request(struct usb_ep *_ep, struct usb_request *_req)
696696
kfree(req);
697697
}
698698

699-
/*-------------------------------------------------------------------------*/
699+
/* Actually add a dTD chain to an empty dQH and let go */
700+
static void fsl_prime_ep(struct fsl_ep *ep, struct ep_td_struct *td)
701+
{
702+
struct ep_queue_head *qh = get_qh_by_ep(ep);
703+
704+
/* Write dQH next pointer and terminate bit to 0 */
705+
qh->next_dtd_ptr = cpu_to_hc32(td->td_dma
706+
& EP_QUEUE_HEAD_NEXT_POINTER_MASK);
707+
708+
/* Clear active and halt bit */
709+
qh->size_ioc_int_sts &= cpu_to_hc32(~(EP_QUEUE_HEAD_STATUS_ACTIVE
710+
| EP_QUEUE_HEAD_STATUS_HALT));
711+
712+
/* Ensure that updates to the QH will occur before priming. */
713+
wmb();
714+
715+
/* Prime endpoint by writing correct bit to ENDPTPRIME */
716+
fsl_writel(ep_is_in(ep) ? (1 << (ep_index(ep) + 16))
717+
: (1 << (ep_index(ep))), &dr_regs->endpointprime);
718+
}
719+
720+
/* Add dTD chain to the dQH of an EP */
700721
static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
701722
{
702-
int i = ep_index(ep) * 2 + ep_is_in(ep);
703723
u32 temp, bitmask, tmp_stat;
704-
struct ep_queue_head *dQH = &ep->udc->ep_qh[i];
705724

706725
/* VDBG("QH addr Register 0x%8x", dr_regs->endpointlistaddr);
707726
VDBG("ep_qh[%d] addr is 0x%8x", i, (u32)&(ep->udc->ep_qh[i])); */
@@ -719,7 +738,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
719738
cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK);
720739
/* Read prime bit, if 1 goto done */
721740
if (fsl_readl(&dr_regs->endpointprime) & bitmask)
722-
goto out;
741+
return;
723742

724743
do {
725744
/* Set ATDTW bit in USBCMD */
@@ -736,28 +755,10 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
736755
fsl_writel(temp & ~USB_CMD_ATDTW, &dr_regs->usbcmd);
737756

738757
if (tmp_stat)
739-
goto out;
758+
return;
740759
}
741760

742-
/* Write dQH next pointer and terminate bit to 0 */
743-
temp = req->head->td_dma & EP_QUEUE_HEAD_NEXT_POINTER_MASK;
744-
dQH->next_dtd_ptr = cpu_to_hc32(temp);
745-
746-
/* Clear active and halt bit */
747-
temp = cpu_to_hc32(~(EP_QUEUE_HEAD_STATUS_ACTIVE
748-
| EP_QUEUE_HEAD_STATUS_HALT));
749-
dQH->size_ioc_int_sts &= temp;
750-
751-
/* Ensure that updates to the QH will occur before priming. */
752-
wmb();
753-
754-
/* Prime endpoint by writing 1 to ENDPTPRIME */
755-
temp = ep_is_in(ep)
756-
? (1 << (ep_index(ep) + 16))
757-
: (1 << (ep_index(ep)));
758-
fsl_writel(temp, &dr_regs->endpointprime);
759-
out:
760-
return;
761+
fsl_prime_ep(ep, req->head);
761762
}
762763

763764
/* Fill in the dTD structure
@@ -877,7 +878,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
877878
VDBG("%s, bad ep", __func__);
878879
return -EINVAL;
879880
}
880-
if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
881+
if (usb_endpoint_xfer_isoc(ep->desc)) {
881882
if (req->req.length > ep->ep.maxpacket)
882883
return -EMSGSIZE;
883884
}
@@ -973,25 +974,20 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
973974

974975
/* The request isn't the last request in this ep queue */
975976
if (req->queue.next != &ep->queue) {
976-
struct ep_queue_head *qh;
977977
struct fsl_req *next_req;
978978

979-
qh = ep->qh;
980979
next_req = list_entry(req->queue.next, struct fsl_req,
981980
queue);
982981

983-
/* Point the QH to the first TD of next request */
984-
fsl_writel((u32) next_req->head, &qh->curr_dtd_ptr);
982+
/* prime with dTD of next request */
983+
fsl_prime_ep(ep, next_req->head);
985984
}
986-
987-
/* The request hasn't been processed, patch up the TD chain */
985+
/* The request hasn't been processed, patch up the TD chain */
988986
} else {
989987
struct fsl_req *prev_req;
990988

991989
prev_req = list_entry(req->queue.prev, struct fsl_req, queue);
992-
fsl_writel(fsl_readl(&req->tail->next_td_ptr),
993-
&prev_req->tail->next_td_ptr);
994-
990+
prev_req->tail->next_td_ptr = req->tail->next_td_ptr;
995991
}
996992

997993
done(ep, req, -ECONNRESET);
@@ -1032,7 +1028,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value)
10321028
goto out;
10331029
}
10341030

1035-
if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
1031+
if (usb_endpoint_xfer_isoc(ep->desc)) {
10361032
status = -EOPNOTSUPP;
10371033
goto out;
10381034
}
@@ -1068,7 +1064,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
10681064
struct fsl_udc *udc;
10691065
int size = 0;
10701066
u32 bitmask;
1071-
struct ep_queue_head *d_qh;
1067+
struct ep_queue_head *qh;
10721068

10731069
ep = container_of(_ep, struct fsl_ep, ep);
10741070
if (!_ep || (!ep->desc && ep_index(ep) != 0))
@@ -1079,13 +1075,13 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
10791075
if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN)
10801076
return -ESHUTDOWN;
10811077

1082-
d_qh = &ep->udc->ep_qh[ep_index(ep) * 2 + ep_is_in(ep)];
1078+
qh = get_qh_by_ep(ep);
10831079

10841080
bitmask = (ep_is_in(ep)) ? (1 << (ep_index(ep) + 16)) :
10851081
(1 << (ep_index(ep)));
10861082

10871083
if (fsl_readl(&dr_regs->endptstatus) & bitmask)
1088-
size = (d_qh->size_ioc_int_sts & DTD_PACKET_SIZE)
1084+
size = (qh->size_ioc_int_sts & DTD_PACKET_SIZE)
10891085
>> DTD_LENGTH_BIT_POS;
10901086

10911087
pr_debug("%s %u\n", __func__, size);
@@ -1938,8 +1934,7 @@ static int fsl_start(struct usb_gadget_driver *driver,
19381934
if (!udc_controller)
19391935
return -ENODEV;
19401936

1941-
if (!driver || (driver->speed != USB_SPEED_FULL
1942-
&& driver->speed != USB_SPEED_HIGH)
1937+
if (!driver || driver->speed < USB_SPEED_FULL
19431938
|| !bind || !driver->disconnect || !driver->setup)
19441939
return -EINVAL;
19451940

drivers/usb/gadget/fsl_usb2_udc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,16 @@ static void dump_msg(const char *label, const u8 * buf, unsigned int length)
569569
* 2 + ((windex & USB_DIR_IN) ? 1 : 0))
570570
#define get_pipe_by_ep(EP) (ep_index(EP) * 2 + ep_is_in(EP))
571571

572+
static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep)
573+
{
574+
/* we only have one ep0 structure but two queue heads */
575+
if (ep_index(ep) != 0)
576+
return ep->qh;
577+
else
578+
return &ep->udc->ep_qh[(ep->udc->ep0_dir ==
579+
USB_DIR_IN) ? 1 : 0];
580+
}
581+
572582
struct platform_device;
573583
#ifdef CONFIG_ARCH_MXC
574584
int fsl_udc_clk_init(struct platform_device *pdev);

drivers/usb/gadget/m66592-udc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ static int m66592_start(struct usb_gadget_driver *driver,
14721472
int retval;
14731473

14741474
if (!driver
1475-
|| driver->speed != USB_SPEED_HIGH
1475+
|| driver->speed < USB_SPEED_HIGH
14761476
|| !bind
14771477
|| !driver->setup)
14781478
return -EINVAL;

drivers/usb/gadget/net2280.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ static int net2280_start(struct usb_gadget *_gadget,
18811881
* (dev->usb->xcvrdiag & FORCE_FULL_SPEED_MODE)
18821882
* "must not be used in normal operation"
18831883
*/
1884-
if (!driver || driver->speed != USB_SPEED_HIGH
1884+
if (!driver || driver->speed < USB_SPEED_HIGH
18851885
|| !driver->setup)
18861886
return -EINVAL;
18871887

drivers/usb/gadget/r8a66597-udc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ static int r8a66597_start(struct usb_gadget *gadget,
17461746
struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget);
17471747

17481748
if (!driver
1749-
|| driver->speed != USB_SPEED_HIGH
1749+
|| driver->speed < USB_SPEED_HIGH
17501750
|| !driver->setup)
17511751
return -EINVAL;
17521752
if (!r8a66597)

drivers/usb/gadget/s3c-hsotg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,10 +2586,8 @@ static int s3c_hsotg_start(struct usb_gadget_driver *driver,
25862586
return -EINVAL;
25872587
}
25882588

2589-
if (driver->speed != USB_SPEED_HIGH &&
2590-
driver->speed != USB_SPEED_FULL) {
2589+
if (driver->speed < USB_SPEED_FULL)
25912590
dev_err(hsotg->dev, "%s: bad speed\n", __func__);
2592-
}
25932591

25942592
if (!bind || !driver->setup) {
25952593
dev_err(hsotg->dev, "%s: missing entry points\n", __func__);

drivers/usb/gadget/s3c-hsudc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,8 +1142,7 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver,
11421142
int ret;
11431143

11441144
if (!driver
1145-
|| (driver->speed != USB_SPEED_FULL &&
1146-
driver->speed != USB_SPEED_HIGH)
1145+
|| driver->speed < USB_SPEED_FULL
11471146
|| !bind
11481147
|| !driver->unbind || !driver->disconnect || !driver->setup)
11491148
return -EINVAL;

drivers/usb/host/ehci-sched.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,7 @@ iso_stream_schedule (
14751475
* jump until after the queue is primed.
14761476
*/
14771477
else {
1478+
int done = 0;
14781479
start = SCHEDULE_SLOP + (now & ~0x07);
14791480

14801481
/* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
@@ -1492,18 +1493,18 @@ iso_stream_schedule (
14921493
if (stream->highspeed) {
14931494
if (itd_slot_ok(ehci, mod, start,
14941495
stream->usecs, period))
1495-
break;
1496+
done = 1;
14961497
} else {
14971498
if ((start % 8) >= 6)
14981499
continue;
14991500
if (sitd_slot_ok(ehci, mod, stream,
15001501
start, sched, period))
1501-
break;
1502+
done = 1;
15021503
}
1503-
} while (start > next);
1504+
} while (start > next && !done);
15041505

15051506
/* no room in the schedule */
1506-
if (start == next) {
1507+
if (!done) {
15071508
ehci_dbg(ehci, "iso resched full %p (now %d max %d)\n",
15081509
urb, now, now + mod);
15091510
status = -ENOSPC;

drivers/usb/host/whci/qset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void qset_clear(struct whc *whc, struct whc_qset *qset)
124124
{
125125
qset->td_start = qset->td_end = qset->ntds = 0;
126126

127-
qset->qh.link = cpu_to_le32(QH_LINK_NTDS(8) | QH_LINK_T);
127+
qset->qh.link = cpu_to_le64(QH_LINK_NTDS(8) | QH_LINK_T);
128128
qset->qh.status = qset->qh.status & QH_STATUS_SEQ_MASK;
129129
qset->qh.err_count = 0;
130130
qset->qh.scratch[0] = 0;

drivers/usb/host/xhci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,10 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci)
711711
ring = xhci->cmd_ring;
712712
seg = ring->deq_seg;
713713
do {
714-
memset(seg->trbs, 0, SEGMENT_SIZE);
714+
memset(seg->trbs, 0,
715+
sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1));
716+
seg->trbs[TRBS_PER_SEGMENT - 1].link.control &=
717+
cpu_to_le32(~TRB_CYCLE);
715718
seg = seg->next;
716719
} while (seg != ring->deq_seg);
717720

drivers/usb/musb/musb_core.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,18 +2301,12 @@ static int musb_suspend(struct device *dev)
23012301
*/
23022302
}
23032303

2304-
musb_save_context(musb);
2305-
23062304
spin_unlock_irqrestore(&musb->lock, flags);
23072305
return 0;
23082306
}
23092307

23102308
static int musb_resume_noirq(struct device *dev)
23112309
{
2312-
struct musb *musb = dev_to_musb(dev);
2313-
2314-
musb_restore_context(musb);
2315-
23162310
/* for static cmos like DaVinci, register values were preserved
23172311
* unless for some reason the whole soc powered down or the USB
23182312
* module got reset through the PSC (vs just being disabled).

drivers/usb/musb/musb_gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ static int musb_gadget_start(struct usb_gadget *g,
19031903
unsigned long flags;
19041904
int retval = -EINVAL;
19051905

1906-
if (driver->speed != USB_SPEED_HIGH)
1906+
if (driver->speed < USB_SPEED_HIGH)
19071907
goto err0;
19081908

19091909
pm_runtime_get_sync(musb->controller);

0 commit comments

Comments
 (0)