forked from luck/tmp_suning_uos_patched
USB fixes for 3.4-rc4
Here are a number of tiny USB fixes for 3.4-rc4. Most of them are in the USB gadget area, but a few other minor USB driver and core fixes are here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEABECAAYFAk+RmT0ACgkQMUfUDdst+yn+ZwCfdYjcW7uIvCqNifegNcSapAX5 zDUAninQ0Dhuu+jSkB3+hbfYDxFCutbW =H4c9 -----END PGP SIGNATURE----- Merge tag 'usb-3.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB fixes from Greg Kroah-Hartman: "Here are a number of tiny USB fixes for 3.4-rc4. Most of them are in the USB gadget area, but a few other minor USB driver and core fixes are here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'usb-3.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (36 commits) USB: serial: cp210x: Fixed usb_control_msg timeout values USB: ehci-tegra: don't call set_irq_flags(IRQF_VALID) USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb USB: yurex: Remove allocation of coherent buffer for setup-packet buffer drivers/usb/misc/usbtest.c: add kfrees USB: ehci-fsl: Fix kernel crash on mpc5121e uwb: fix error handling uwb: fix use of del_timer_sync() in interrupt EHCI: always clear the STS_FLR status bit EHCI: fix criterion for resuming the root hub USB: sierra: avoid QMI/wwan interface on MC77xx usb: usbtest: avoid integer overflow in alloc_sglist() usb: usbtest: avoid integer overflow in test_ctrl_queue() USB: fix deadlock in bConfigurationValue attribute method usb: gadget: eliminate NULL pointer dereference (bugfix) usb: gadget: uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine usb: gadget: rndis: fix Missing req->context assignment usb: musb: omap: fix the error check for pm_runtime_get_sync usb: gadget: udc-core: fix asymmetric calls in remove_driver usb: musb: omap: fix crash when musb glue (omap) gets initialized ...
This commit is contained in:
commit
1cd653a665
@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev)
|
||||
{
|
||||
struct usb_device *udev = *pdev;
|
||||
int i;
|
||||
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
|
||||
|
||||
/* mark the device as inactive, so any further urb submissions for
|
||||
* this device (and any of its children) will fail immediately.
|
||||
@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev)
|
||||
* so that the hardware is now fully quiesced.
|
||||
*/
|
||||
dev_dbg (&udev->dev, "unregistering device\n");
|
||||
mutex_lock(hcd->bandwidth_mutex);
|
||||
usb_disable_device(udev, 0);
|
||||
mutex_unlock(hcd->bandwidth_mutex);
|
||||
usb_hcd_synchronize_unlinks(udev);
|
||||
|
||||
usb_remove_ep_devs(&udev->ep0);
|
||||
|
@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
|
||||
* Deallocates hcd/hardware state for the endpoints (nuking all or most
|
||||
* pending urbs) and usbcore state for the interfaces, so that usbcore
|
||||
* must usb_set_configuration() before any interfaces could be used.
|
||||
*
|
||||
* Must be called with hcd->bandwidth_mutex held.
|
||||
*/
|
||||
void usb_disable_device(struct usb_device *dev, int skip_ep0)
|
||||
{
|
||||
@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
|
||||
usb_disable_endpoint(dev, i + USB_DIR_IN, false);
|
||||
}
|
||||
/* Remove endpoints from the host controller internal state */
|
||||
mutex_lock(hcd->bandwidth_mutex);
|
||||
usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
|
||||
mutex_unlock(hcd->bandwidth_mutex);
|
||||
/* Second pass: remove endpoint pointers */
|
||||
}
|
||||
for (i = skip_ep0; i < 16; ++i) {
|
||||
@ -1750,7 +1750,6 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
|
||||
/* if it's already configured, clear out old state first.
|
||||
* getting rid of old interfaces means unbinding their drivers.
|
||||
*/
|
||||
mutex_lock(hcd->bandwidth_mutex);
|
||||
if (dev->state != USB_STATE_ADDRESS)
|
||||
usb_disable_device(dev, 1); /* Skip ep0 */
|
||||
|
||||
@ -1763,6 +1762,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
|
||||
* host controller will not allow submissions to dropped endpoints. If
|
||||
* this call fails, the device state is unchanged.
|
||||
*/
|
||||
mutex_lock(hcd->bandwidth_mutex);
|
||||
ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
|
||||
if (ret < 0) {
|
||||
mutex_unlock(hcd->bandwidth_mutex);
|
||||
|
@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
|
||||
|
||||
for (i = 0; i < dwc->num_event_buffers; i++) {
|
||||
evt = dwc->ev_buffs[i];
|
||||
if (evt) {
|
||||
if (evt)
|
||||
dwc3_free_one_event_buffer(dwc, evt);
|
||||
dwc->ev_buffs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
kfree(dwc->ev_buffs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
|
||||
|
||||
dwc->test_mode_nr = wIndex >> 8;
|
||||
dwc->test_mode = true;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
|
||||
length = trb->size & DWC3_TRB_SIZE_MASK;
|
||||
|
||||
if (dwc->ep0_bounced) {
|
||||
unsigned transfer_size = ur->length;
|
||||
unsigned maxp = ep0->endpoint.maxpacket;
|
||||
|
||||
transfer_size += (maxp - (transfer_size % maxp));
|
||||
transferred = min_t(u32, ur->length,
|
||||
ep0->endpoint.maxpacket - length);
|
||||
transfer_size - length);
|
||||
memcpy(ur->buf, dwc->ep0_bounce, transferred);
|
||||
dwc->ep0_bounced = false;
|
||||
} else {
|
||||
transferred = ur->length - length;
|
||||
ur->actual += transferred;
|
||||
}
|
||||
|
||||
ur->actual += transferred;
|
||||
|
||||
if ((epnum & 1) && ur->actual < ur->length) {
|
||||
/* for some reason we did not get everything out */
|
||||
|
||||
|
@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
|
||||
if (code == FUNCTIONFS_INTERFACE_REVMAP) {
|
||||
struct ffs_function *func = ffs->func;
|
||||
ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
|
||||
} else if (gadget->ops->ioctl) {
|
||||
} else if (gadget && gadget->ops->ioctl) {
|
||||
ret = gadget->ops->ioctl(gadget, code, value);
|
||||
} else {
|
||||
ret = -ENOTTY;
|
||||
@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs)
|
||||
ffs->ep0req = NULL;
|
||||
ffs->gadget = NULL;
|
||||
ffs_data_put(ffs);
|
||||
clear_bit(FFS_FL_BOUND, &ffs->flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
|
||||
if (buf) {
|
||||
memcpy(req->buf, buf, n);
|
||||
req->complete = rndis_response_complete;
|
||||
req->context = rndis;
|
||||
rndis_free_response(rndis->config, buf);
|
||||
value = n;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
|
||||
: (1 << (ep_index(ep)));
|
||||
|
||||
/* check if the pipe is empty */
|
||||
if (!(list_empty(&ep->queue))) {
|
||||
if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) {
|
||||
/* Add td to the end */
|
||||
struct fsl_req *lastreq;
|
||||
lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
|
||||
@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Update ep0 state */
|
||||
if ((ep_index(ep) == 0))
|
||||
udc->ep0_state = DATA_STATE_XMIT;
|
||||
|
||||
/* irq handler advances the queue */
|
||||
if (req != NULL)
|
||||
list_add_tail(&req->queue, &ep->queue);
|
||||
@ -1279,6 +1275,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
|
||||
udc->ep0_dir = USB_DIR_OUT;
|
||||
|
||||
ep = &udc->eps[0];
|
||||
if (udc->ep0_state != DATA_STATE_XMIT)
|
||||
udc->ep0_state = WAIT_FOR_OUT_STATUS;
|
||||
|
||||
req->ep = ep;
|
||||
@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
|
||||
|
||||
list_add_tail(&req->queue, &ep->queue);
|
||||
udc->ep0_state = DATA_STATE_XMIT;
|
||||
if (ep0_prime_status(udc, EP_DIR_OUT))
|
||||
ep0stall(udc);
|
||||
|
||||
return;
|
||||
stall:
|
||||
ep0stall(udc);
|
||||
@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc,
|
||||
spin_lock(&udc->lock);
|
||||
udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
|
||||
? DATA_STATE_XMIT : DATA_STATE_RECV;
|
||||
/*
|
||||
* If the data stage is IN, send status prime immediately.
|
||||
* See 2.0 Spec chapter 8.5.3.3 for detail.
|
||||
*/
|
||||
if (udc->ep0_state == DATA_STATE_XMIT)
|
||||
if (ep0_prime_status(udc, EP_DIR_OUT))
|
||||
ep0stall(udc);
|
||||
|
||||
} else {
|
||||
/* No data phase, IN status from gadget */
|
||||
udc->ep0_dir = USB_DIR_IN;
|
||||
@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0,
|
||||
|
||||
switch (udc->ep0_state) {
|
||||
case DATA_STATE_XMIT:
|
||||
/* receive status phase */
|
||||
if (ep0_prime_status(udc, EP_DIR_OUT))
|
||||
ep0stall(udc);
|
||||
/* already primed at setup_received_irq */
|
||||
udc->ep0_state = WAIT_FOR_OUT_STATUS;
|
||||
break;
|
||||
case DATA_STATE_RECV:
|
||||
/* send status phase */
|
||||
|
@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = {
|
||||
static struct ffs_data *gfs_ffs_data;
|
||||
static unsigned long gfs_registered;
|
||||
|
||||
static int gfs_init(void)
|
||||
static int __init gfs_init(void)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
@ -169,7 +169,7 @@ static int gfs_init(void)
|
||||
}
|
||||
module_init(gfs_init);
|
||||
|
||||
static void gfs_exit(void)
|
||||
static void __exit gfs_exit(void)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
|
@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
|
||||
/* currently we allocate TX FIFOs for all possible endpoints,
|
||||
* and assume that they are all the same size. */
|
||||
|
||||
for (ep = 0; ep <= 15; ep++) {
|
||||
for (ep = 1; ep <= 15; ep++) {
|
||||
val = addr;
|
||||
val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
|
||||
addr += size;
|
||||
@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
||||
/* write size / packets */
|
||||
writel(epsize, hsotg->regs + epsize_reg);
|
||||
|
||||
if (using_dma(hsotg)) {
|
||||
if (using_dma(hsotg) && !continuing) {
|
||||
unsigned int dma_reg;
|
||||
|
||||
/* write DMA address to control register, buffer already
|
||||
@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
|
||||
reg |= mpsval;
|
||||
writel(reg, regs + S3C_DIEPCTL(ep));
|
||||
|
||||
if (ep) {
|
||||
reg = readl(regs + S3C_DOEPCTL(ep));
|
||||
reg &= ~S3C_DxEPCTL_MPS_MASK;
|
||||
reg |= mpsval;
|
||||
writel(reg, regs + S3C_DOEPCTL(ep));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@ -1919,6 +1921,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
|
||||
ints & S3C_DIEPMSK_TxFIFOEmpty) {
|
||||
dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
|
||||
__func__, idx);
|
||||
if (!using_dma(hsotg))
|
||||
s3c_hsotg_trytx(hsotg, hs_ep);
|
||||
}
|
||||
}
|
||||
|
@ -264,8 +264,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
|
||||
if (udc_is_newstyle(udc)) {
|
||||
udc->driver->disconnect(udc->gadget);
|
||||
udc->driver->unbind(udc->gadget);
|
||||
usb_gadget_udc_stop(udc->gadget, udc->driver);
|
||||
usb_gadget_disconnect(udc->gadget);
|
||||
usb_gadget_udc_stop(udc->gadget, udc->driver);
|
||||
} else {
|
||||
usb_gadget_stop(udc->gadget, udc->driver);
|
||||
}
|
||||
@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
|
||||
struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
|
||||
|
||||
if (sysfs_streq(buf, "connect")) {
|
||||
if (udc_is_newstyle(udc))
|
||||
usb_gadget_udc_start(udc->gadget, udc->driver);
|
||||
usb_gadget_connect(udc->gadget);
|
||||
} else if (sysfs_streq(buf, "disconnect")) {
|
||||
if (udc_is_newstyle(udc))
|
||||
usb_gadget_udc_stop(udc->gadget, udc->driver);
|
||||
usb_gadget_disconnect(udc->gadget);
|
||||
} else {
|
||||
dev_err(dev, "unsupported command '%s'\n", buf);
|
||||
|
@ -543,11 +543,11 @@ static int uvc_queue_enable(struct uvc_video_queue *queue, int enable)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* called with queue->irqlock held.. */
|
||||
static struct uvc_buffer *
|
||||
uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
|
||||
{
|
||||
struct uvc_buffer *nextbuf;
|
||||
unsigned long flags;
|
||||
|
||||
if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
|
||||
buf->buf.length != buf->buf.bytesused) {
|
||||
@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
|
||||
return buf;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&queue->irqlock, flags);
|
||||
list_del(&buf->queue);
|
||||
if (!list_empty(&queue->irqqueue))
|
||||
nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
|
||||
queue);
|
||||
else
|
||||
nextbuf = NULL;
|
||||
spin_unlock_irqrestore(&queue->irqlock, flags);
|
||||
|
||||
buf->buf.sequence = queue->sequence++;
|
||||
do_gettimeofday(&buf->buf.timestamp);
|
||||
|
@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
|
||||
u32 portsc;
|
||||
struct usb_hcd *hcd = ehci_to_hcd(ehci);
|
||||
void __iomem *non_ehci = hcd->regs;
|
||||
struct fsl_usb2_platform_data *pdata;
|
||||
|
||||
pdata = hcd->self.controller->platform_data;
|
||||
|
||||
portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
|
||||
portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW);
|
||||
@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
|
||||
/* fall through */
|
||||
case FSL_USB2_PHY_UTMI:
|
||||
/* enable UTMI PHY */
|
||||
setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN);
|
||||
if (pdata->have_sysif_regs)
|
||||
setbits32(non_ehci + FSL_SOC_USB_CTRL,
|
||||
CTRL_UTMI_PHY_EN);
|
||||
portsc |= PORT_PTS_UTMI;
|
||||
break;
|
||||
case FSL_USB2_PHY_NONE:
|
||||
|
@ -858,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
|
||||
goto dead;
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't use STS_FLR, but some controllers don't like it to
|
||||
* remain on, so mask it out along with the other status bits.
|
||||
*/
|
||||
masked_status = status & (INTR_MASK | STS_FLR);
|
||||
|
||||
/* Shared IRQ? */
|
||||
masked_status = status & INTR_MASK;
|
||||
if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
|
||||
spin_unlock(&ehci->lock);
|
||||
return IRQ_NONE;
|
||||
@ -910,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
|
||||
pcd_status = status;
|
||||
|
||||
/* resume root hub? */
|
||||
if (!(cmd & CMD_RUN))
|
||||
if (ehci->rh_state == EHCI_RH_SUSPENDED)
|
||||
usb_hcd_resume_root_hub(hcd);
|
||||
|
||||
/* get per-port change detect bits */
|
||||
|
@ -731,7 +731,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
||||
err = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
set_irq_flags(irq, IRQF_VALID);
|
||||
|
||||
#ifdef CONFIG_USB_OTG_UTILS
|
||||
if (pdata->operating_mode == TEGRA_USB_OTG) {
|
||||
|
@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary)
|
||||
unsigned i;
|
||||
unsigned size = max;
|
||||
|
||||
sg = kmalloc(nents * sizeof *sg, GFP_KERNEL);
|
||||
sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL);
|
||||
if (!sg)
|
||||
return NULL;
|
||||
sg_init_table(sg, nents);
|
||||
@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
|
||||
struct ctrl_ctx context;
|
||||
int i;
|
||||
|
||||
if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
spin_lock_init(&context.lock);
|
||||
context.dev = dev;
|
||||
init_completion(&context.complete);
|
||||
@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
|
||||
|
||||
/* queued control messaging */
|
||||
case 10:
|
||||
if (param->sglen == 0)
|
||||
break;
|
||||
retval = 0;
|
||||
dev_info(&intf->dev,
|
||||
"TEST 10: queue %d control calls, %d times\n",
|
||||
@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||
if (status < 0) {
|
||||
WARNING(dev, "couldn't get endpoints, %d\n",
|
||||
status);
|
||||
kfree(dev->buf);
|
||||
kfree(dev);
|
||||
return status;
|
||||
}
|
||||
/* may find bulk or ISO pipes */
|
||||
|
@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
|
||||
usb_put_dev(dev->udev);
|
||||
if (dev->cntl_urb) {
|
||||
usb_kill_urb(dev->cntl_urb);
|
||||
if (dev->cntl_req)
|
||||
usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
|
||||
dev->cntl_req, dev->cntl_urb->setup_dma);
|
||||
kfree(dev->cntl_req);
|
||||
if (dev->cntl_buffer)
|
||||
usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
|
||||
dev->cntl_buffer, dev->cntl_urb->transfer_dma);
|
||||
@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
||||
}
|
||||
|
||||
/* allocate buffer for control req */
|
||||
dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
|
||||
GFP_KERNEL,
|
||||
&dev->cntl_urb->setup_dma);
|
||||
dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
|
||||
if (!dev->cntl_req) {
|
||||
err("Could not allocate cntl_req");
|
||||
goto error;
|
||||
@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
||||
usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
|
||||
dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
|
||||
dev, 1);
|
||||
dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
|
||||
retval = -EIO;
|
||||
err("Could not submitting URB");
|
||||
|
@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
|
||||
int i = 0;
|
||||
u8 r;
|
||||
u8 power;
|
||||
int ret;
|
||||
|
||||
pm_runtime_get_sync(phy->io_dev);
|
||||
|
||||
/* Make sure the transceiver is not in low power mode */
|
||||
power = musb_readb(addr, MUSB_POWER);
|
||||
@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
|
||||
while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
|
||||
& MUSB_ULPI_REG_CMPLT)) {
|
||||
i++;
|
||||
if (i == 10000)
|
||||
return -ETIMEDOUT;
|
||||
if (i == 10000) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
}
|
||||
r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
|
||||
r &= ~MUSB_ULPI_REG_CMPLT;
|
||||
musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
|
||||
|
||||
return musb_readb(addr, MUSB_ULPI_REG_DATA);
|
||||
ret = musb_readb(addr, MUSB_ULPI_REG_DATA);
|
||||
|
||||
out:
|
||||
pm_runtime_put(phy->io_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
|
||||
@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
|
||||
int i = 0;
|
||||
u8 r = 0;
|
||||
u8 power;
|
||||
int ret = 0;
|
||||
|
||||
pm_runtime_get_sync(phy->io_dev);
|
||||
|
||||
/* Make sure the transceiver is not in low power mode */
|
||||
power = musb_readb(addr, MUSB_POWER);
|
||||
@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
|
||||
while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
|
||||
& MUSB_ULPI_REG_CMPLT)) {
|
||||
i++;
|
||||
if (i == 10000)
|
||||
return -ETIMEDOUT;
|
||||
if (i == 10000) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
|
||||
r &= ~MUSB_ULPI_REG_CMPLT;
|
||||
musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
|
||||
|
||||
return 0;
|
||||
out:
|
||||
pm_runtime_put(phy->io_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#define musb_ulpi_read NULL
|
||||
@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
|
||||
|
||||
if (!musb->isr) {
|
||||
status = -ENODEV;
|
||||
goto fail3;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
if (!musb->xceiv->io_ops) {
|
||||
musb->xceiv->io_dev = musb->controller;
|
||||
musb->xceiv->io_priv = musb->mregs;
|
||||
musb->xceiv->io_ops = &musb_ulpi_access;
|
||||
}
|
||||
|
||||
pm_runtime_get_sync(musb->controller);
|
||||
|
||||
#ifndef CONFIG_MUSB_PIO_ONLY
|
||||
if (use_dma && dev->dma_mask) {
|
||||
struct dma_controller *c;
|
||||
@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
|
||||
goto fail5;
|
||||
#endif
|
||||
|
||||
pm_runtime_put(musb->controller);
|
||||
|
||||
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
|
||||
({char *s;
|
||||
switch (musb->board_mode) {
|
||||
@ -2047,6 +2070,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
|
||||
musb_gadget_cleanup(musb);
|
||||
|
||||
fail3:
|
||||
pm_runtime_put_sync(musb->controller);
|
||||
|
||||
fail2:
|
||||
if (musb->irq_wake)
|
||||
device_init_wakeup(dev, 0);
|
||||
musb_platform_exit(musb);
|
||||
|
@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
|
||||
}
|
||||
|
||||
/* turn off DMA requests, discard state, stop polling ... */
|
||||
if (is_in) {
|
||||
if (ep->epnum && is_in) {
|
||||
/* giveback saves bulk toggle */
|
||||
csr = musb_h_flush_rxfifo(ep, 0);
|
||||
|
||||
|
@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
|
||||
|
||||
static int omap2430_musb_init(struct musb *musb)
|
||||
{
|
||||
u32 l, status = 0;
|
||||
u32 l;
|
||||
int status = 0;
|
||||
struct device *dev = musb->controller;
|
||||
struct musb_hdrc_platform_data *plat = dev->platform_data;
|
||||
struct omap_musb_board_data *data = plat->board_data;
|
||||
@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb)
|
||||
|
||||
status = pm_runtime_get_sync(dev);
|
||||
if (status < 0) {
|
||||
dev_err(dev, "pm_runtime_get_sync FAILED");
|
||||
dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
|
||||
goto err1;
|
||||
}
|
||||
|
||||
@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb)
|
||||
|
||||
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
|
||||
|
||||
pm_runtime_put_noidle(musb->controller);
|
||||
return 0;
|
||||
|
||||
err1:
|
||||
@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
|
||||
goto err2;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
ret = platform_device_add(musb);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to register musb device\n");
|
||||
goto err2;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
||||
err2:
|
||||
@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
|
||||
|
||||
platform_device_del(glue->musb);
|
||||
platform_device_put(glue->musb);
|
||||
pm_runtime_put(&pdev->dev);
|
||||
kfree(glue);
|
||||
|
||||
return 0;
|
||||
@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev)
|
||||
struct omap2430_glue *glue = dev_get_drvdata(dev);
|
||||
struct musb *musb = glue_to_musb(glue);
|
||||
|
||||
if (musb) {
|
||||
musb->context.otg_interfsel = musb_readl(musb->mregs,
|
||||
OTG_INTERFSEL);
|
||||
|
||||
omap2430_low_level_exit(musb);
|
||||
usb_phy_set_suspend(musb->xceiv, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev)
|
||||
struct omap2430_glue *glue = dev_get_drvdata(dev);
|
||||
struct musb *musb = glue_to_musb(glue);
|
||||
|
||||
if (musb) {
|
||||
omap2430_low_level_init(musb);
|
||||
musb_writel(musb->mregs, OTG_INTERFSEL,
|
||||
musb->context.otg_interfsel);
|
||||
|
||||
usb_phy_set_suspend(musb->xceiv, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
|
||||
/* Issue the request, attempting to read 'size' bytes */
|
||||
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
|
||||
request, REQTYPE_DEVICE_TO_HOST, 0x0000,
|
||||
port_priv->bInterfaceNumber, buf, size, 300);
|
||||
port_priv->bInterfaceNumber, buf, size,
|
||||
USB_CTRL_GET_TIMEOUT);
|
||||
|
||||
/* Convert data into an array of integers */
|
||||
for (i = 0; i < length; i++)
|
||||
@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
|
||||
result = usb_control_msg(serial->dev,
|
||||
usb_sndctrlpipe(serial->dev, 0),
|
||||
request, REQTYPE_HOST_TO_DEVICE, 0x0000,
|
||||
port_priv->bInterfaceNumber, buf, size, 300);
|
||||
port_priv->bInterfaceNumber, buf, size,
|
||||
USB_CTRL_SET_TIMEOUT);
|
||||
} else {
|
||||
result = usb_control_msg(serial->dev,
|
||||
usb_sndctrlpipe(serial->dev, 0),
|
||||
request, REQTYPE_HOST_TO_DEVICE, data[0],
|
||||
port_priv->bInterfaceNumber, NULL, 0, 300);
|
||||
port_priv->bInterfaceNumber, NULL, 0,
|
||||
USB_CTRL_SET_TIMEOUT);
|
||||
}
|
||||
|
||||
kfree(buf);
|
||||
|
@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = {
|
||||
};
|
||||
|
||||
/* 'blacklist' of interfaces not served by this driver */
|
||||
static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 };
|
||||
static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 };
|
||||
static const struct sierra_iface_info direct_ip_interface_blacklist = {
|
||||
.infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces),
|
||||
.ifaceinfo = direct_ip_non_serial_ifaces,
|
||||
@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = {
|
||||
{ USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
|
||||
{ USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */
|
||||
{ USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */
|
||||
{ USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */
|
||||
/* Sierra Wireless C885 */
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)},
|
||||
/* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
|
||||
@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = {
|
||||
/* Sierra Wireless HSPA Non-Composite Device */
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
|
||||
{ USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */
|
||||
{ USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */
|
||||
.driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
|
||||
},
|
||||
{ USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
|
||||
.driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
|
||||
},
|
||||
|
@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb)
|
||||
dev_err(dev, "NEEP: URB error %d\n", urb->status);
|
||||
}
|
||||
result = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (result < 0) {
|
||||
if (result < 0 && result != -ENODEV && result != -EPERM) {
|
||||
/* ignoring unrecoverable errors */
|
||||
dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
|
||||
result);
|
||||
goto error;
|
||||
|
@ -107,6 +107,7 @@ struct uwb_rc_neh {
|
||||
u8 evt_type;
|
||||
__le16 evt;
|
||||
u8 context;
|
||||
u8 completed;
|
||||
uwb_rc_cmd_cb_f cb;
|
||||
void *arg;
|
||||
|
||||
@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
|
||||
struct device *dev = &rc->uwb_dev.dev;
|
||||
struct uwb_rc_neh *neh;
|
||||
struct uwb_rceb *notif;
|
||||
unsigned long flags;
|
||||
|
||||
if (rceb->bEventContext == 0) {
|
||||
notif = kmalloc(size, GFP_ATOMIC);
|
||||
@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
|
||||
} else {
|
||||
neh = uwb_rc_neh_lookup(rc, rceb);
|
||||
if (neh) {
|
||||
del_timer_sync(&neh->timer);
|
||||
spin_lock_irqsave(&rc->neh_lock, flags);
|
||||
/* to guard against a timeout */
|
||||
neh->completed = 1;
|
||||
del_timer(&neh->timer);
|
||||
spin_unlock_irqrestore(&rc->neh_lock, flags);
|
||||
uwb_rc_neh_cb(neh, rceb, size);
|
||||
} else
|
||||
dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
|
||||
@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg)
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&rc->neh_lock, flags);
|
||||
if (neh->completed) {
|
||||
spin_unlock_irqrestore(&rc->neh_lock, flags);
|
||||
return;
|
||||
}
|
||||
if (neh->context)
|
||||
__uwb_rc_neh_rm(rc, neh);
|
||||
else
|
||||
|
@ -94,6 +94,7 @@ struct usb_phy {
|
||||
|
||||
struct usb_otg *otg;
|
||||
|
||||
struct device *io_dev;
|
||||
struct usb_phy_io_ops *io_ops;
|
||||
void __iomem *io_priv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user