Skip to content

Commit

Permalink
Merge tag 'usb-3.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are a number of USB fixes for 3.11-rc3.

  Lots of little things, nothing major.  A number of new device ids,
  build fixes for DMA, and a bunch of other minor things.  All of these
  have been in the linux-next tree"

* tag 'usb-3.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (40 commits)
  usb: Clear both buffers when clearing a control transfer TT buffer.
  usb/gadget: free opts struct on error recovery
  USB: mos7840: fix memory leak in open
  usb: serial: option.c: remove ONDA MT825UP product ID fromdriver
  usb: serial: option: add Olivetti Olicard 200
  usb: serial: option: blacklist ONDA MT689DC QMI interface
  xhci: fix null pointer dereference on ring_doorbell_for_active_rings
  usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0
  usb: fix build warning in pci-quirks.h when CONFIG_PCI is not enabled
  usb: xhci: Mark two functions __maybe_unused
  xhci: Avoid NULL pointer deref when host dies.
  usb: serial: option: Add ONYX 3G device support
  USB: ti_usb_3410_5052: fix dynamic-id matching
  usb: option: add TP-LINK MA260
  USB: option: add D-Link DWM-152/C1 and DWM-156/C1
  USB: EHCI: Fix resume signalling on remote wakeup
  USB: cp210x: add MMB and PI ZigBee USB Device Support
  usb: cp210x support SEL C662 Vendor/Device
  USB: option: append Petatel NP10T device to GSM modems list
  USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga
  ...
  • Loading branch information
Linus Torvalds committed Jul 26, 2013
2 parents ab20fb8 + 2c7b871 commit db8cbfa
Show file tree
Hide file tree
Showing 33 changed files with 172 additions and 79 deletions.
48 changes: 40 additions & 8 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,15 @@ static void hub_irq(struct urb *urb)
static inline int
hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
{
/* Need to clear both directions for control ep */
if (((devinfo >> 11) & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_CONTROL) {
int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
devinfo ^ 0x8000, tt, NULL, 0, 1000);
if (status)
return status;
}
return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
tt, NULL, 0, 1000);
Expand Down Expand Up @@ -2848,6 +2857,15 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev)
USB_CTRL_SET_TIMEOUT);
}

/* Count of wakeup-enabled devices at or below udev */
static unsigned wakeup_enabled_descendants(struct usb_device *udev)
{
struct usb_hub *hub = usb_hub_to_struct_hub(udev);

return udev->do_remote_wakeup +
(hub ? hub->wakeup_enabled_descendants : 0);
}

/*
* usb_port_suspend - suspend a usb device's upstream port
* @udev: device that's no longer in active use, not a root hub
Expand Down Expand Up @@ -2888,8 +2906,8 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev)
* Linux (2.6) currently has NO mechanisms to initiate that: no khubd
* timer, no SRP, no requests through sysfs.
*
* If Runtime PM isn't enabled or used, non-SuperSpeed devices really get
* suspended only when their bus goes into global suspend (i.e., the root
* If Runtime PM isn't enabled or used, non-SuperSpeed devices may not get
* suspended until their bus goes into global suspend (i.e., the root
* hub is suspended). Nevertheless, we change @udev->state to
* USB_STATE_SUSPENDED as this is the device's "logical" state. The actual
* upstream port setting is stored in @udev->port_is_suspended.
Expand Down Expand Up @@ -2960,15 +2978,21 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
/* see 7.1.7.6 */
if (hub_is_superspeed(hub->hdev))
status = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_U3);
else if (PMSG_IS_AUTO(msg))
status = set_port_feature(hub->hdev, port1,
USB_PORT_FEAT_SUSPEND);

/*
* For system suspend, we do not need to enable the suspend feature
* on individual USB-2 ports. The devices will automatically go
* into suspend a few ms after the root hub stops sending packets.
* The USB 2.0 spec calls this "global suspend".
*
* However, many USB hubs have a bug: They don't relay wakeup requests
* from a downstream port if the port's suspend feature isn't on.
* Therefore we will turn on the suspend feature if udev or any of its
* descendants is enabled for remote wakeup.
*/
else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0)
status = set_port_feature(hub->hdev, port1,
USB_PORT_FEAT_SUSPEND);
else {
really_suspend = false;
status = 0;
Expand Down Expand Up @@ -3003,15 +3027,16 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
if (!PMSG_IS_AUTO(msg))
status = 0;
} else {
/* device has up to 10 msec to fully suspend */
dev_dbg(&udev->dev, "usb %ssuspend, wakeup %d\n",
(PMSG_IS_AUTO(msg) ? "auto-" : ""),
udev->do_remote_wakeup);
usb_set_device_state(udev, USB_STATE_SUSPENDED);
if (really_suspend) {
udev->port_is_suspended = 1;

/* device has up to 10 msec to fully suspend */
msleep(10);
}
usb_set_device_state(udev, USB_STATE_SUSPENDED);
}

/*
Expand Down Expand Up @@ -3293,7 +3318,11 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
unsigned port1;
int status;

/* Warn if children aren't already suspended */
/*
* Warn if children aren't already suspended.
* Also, add up the number of wakeup-enabled descendants.
*/
hub->wakeup_enabled_descendants = 0;
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
struct usb_device *udev;

Expand All @@ -3303,6 +3332,9 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
if (PMSG_IS_AUTO(msg))
return -EBUSY;
}
if (udev)
hub->wakeup_enabled_descendants +=
wakeup_enabled_descendants(udev);
}

if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) {
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/core/hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ struct usb_hub {
struct usb_tt tt; /* Transaction Translator */

unsigned mA_per_port; /* current for each child */
#ifdef CONFIG_PM
unsigned wakeup_enabled_descendants;
#endif

unsigned limited_power:1;
unsigned quiescing:1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/dwc3/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config USB_DWC3
tristate "DesignWare USB3 DRD Core Support"
depends on (USB || USB_GADGET) && GENERIC_HARDIRQS
depends on (USB || USB_GADGET) && GENERIC_HARDIRQS && HAS_DMA
select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
help
Say Y or M here if your system has a Dual Role SuperSpeed
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static int dwc3_probe(struct platform_device *pdev)
}

if (IS_ERR(dwc->usb3_phy)) {
ret = PTR_ERR(dwc->usb2_phy);
ret = PTR_ERR(dwc->usb3_phy);

/*
* if -ENXIO is returned, it means PHY layer wasn't
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/dwc3/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ struct dwc3 {

struct dwc3_event_type {
u32 is_devspec:1;
u32 type:6;
u32 reserved8_31:25;
u32 type:7;
u32 reserved8_31:24;
} __packed;

#define DWC3_DEPEVT_XFERCOMPLETE 0x01
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
__dwc3_gadget_ep_disable(dwc->eps[0]);

err0:
dwc->gadget_driver = NULL;
spin_unlock_irqrestore(&dwc->lock, flags);

return ret;
Expand Down
5 changes: 4 additions & 1 deletion drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ config USB_FUSB300
Faraday usb device controller FUSB300 driver

config USB_FOTG210_UDC
depends on HAS_DMA
tristate "Faraday FOTG210 USB Peripheral Controller"
help
Faraday USB2.0 OTG controller which can be configured as
Expand Down Expand Up @@ -328,13 +329,14 @@ config USB_S3C_HSUDC

config USB_MV_UDC
tristate "Marvell USB2.0 Device Controller"
depends on GENERIC_HARDIRQS
depends on GENERIC_HARDIRQS && HAS_DMA
help
Marvell Socs (including PXA and MMP series) include a high speed
USB2.0 OTG controller, which can be configured as high speed or
full speed USB peripheral.

config USB_MV_U3D
depends on HAS_DMA
tristate "MARVELL PXA2128 USB 3.0 controller"
help
MARVELL PXA2128 Processor series include a super speed USB3.0 device
Expand Down Expand Up @@ -639,6 +641,7 @@ config USB_CONFIGFS_RNDIS
depends on USB_CONFIGFS
depends on NET
select USB_U_ETHER
select USB_U_RNDIS
select USB_F_RNDIS
help
Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
Expand Down
16 changes: 9 additions & 7 deletions drivers/usb/gadget/at91_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,8 @@ static void clk_on(struct at91_udc *udc)
if (udc->clocked)
return;
udc->clocked = 1;
clk_enable(udc->iclk);
clk_enable(udc->fclk);
clk_prepare_enable(udc->iclk);
clk_prepare_enable(udc->fclk);
}

static void clk_off(struct at91_udc *udc)
Expand All @@ -880,8 +880,8 @@ static void clk_off(struct at91_udc *udc)
return;
udc->clocked = 0;
udc->gadget.speed = USB_SPEED_UNKNOWN;
clk_disable(udc->fclk);
clk_disable(udc->iclk);
clk_disable_unprepare(udc->fclk);
clk_disable_unprepare(udc->iclk);
}

/*
Expand Down Expand Up @@ -1725,7 +1725,7 @@ static int at91udc_probe(struct platform_device *pdev)
/* init software state */
udc = &controller;
udc->gadget.dev.parent = dev;
if (pdev->dev.of_node)
if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
at91udc_of_init(udc, pdev->dev.of_node);
else
memcpy(&udc->board, dev->platform_data,
Expand Down Expand Up @@ -1782,12 +1782,14 @@ static int at91udc_probe(struct platform_device *pdev)
}

/* don't do anything until we have both gadget driver and VBUS */
clk_enable(udc->iclk);
retval = clk_prepare_enable(udc->iclk);
if (retval)
goto fail1;
at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
at91_udp_write(udc, AT91_UDP_IDR, 0xffffffff);
/* Clear all pending interrupts - UDP may be used by bootloader. */
at91_udp_write(udc, AT91_UDP_ICR, 0xffffffff);
clk_disable(udc->iclk);
clk_disable_unprepare(udc->iclk);

/* request UDC and maybe VBUS irqs */
udc->udp_irq = platform_get_irq(pdev, 0);
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/f_ecm.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,11 @@ static struct usb_function_instance *ecm_alloc_inst(void)
mutex_init(&opts->lock);
opts->func_inst.free_func_inst = ecm_free_inst;
opts->net = gether_setup_default();
if (IS_ERR(opts->net))
return ERR_PTR(PTR_ERR(opts->net));
if (IS_ERR(opts->net)) {
struct net_device *net = opts->net;
kfree(opts);
return ERR_CAST(net);
}

config_group_init_type_name(&opts->func_inst.group, "", &ecm_func_type);

Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/f_eem.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,11 @@ static struct usb_function_instance *eem_alloc_inst(void)
mutex_init(&opts->lock);
opts->func_inst.free_func_inst = eem_free_inst;
opts->net = gether_setup_default();
if (IS_ERR(opts->net))
return ERR_CAST(opts->net);
if (IS_ERR(opts->net)) {
struct net_device *net = opts->net;
kfree(opts);
return ERR_CAST(net);
}

config_group_init_type_name(&opts->func_inst.group, "", &eem_func_type);

Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/f_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1350,8 +1350,11 @@ static struct usb_function_instance *ncm_alloc_inst(void)
mutex_init(&opts->lock);
opts->func_inst.free_func_inst = ncm_free_inst;
opts->net = gether_setup_default();
if (IS_ERR(opts->net))
return ERR_PTR(PTR_ERR(opts->net));
if (IS_ERR(opts->net)) {
struct net_device *net = opts->net;
kfree(opts);
return ERR_CAST(net);
}

config_group_init_type_name(&opts->func_inst.group, "", &ncm_func_type);

Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,11 @@ static struct usb_function_instance *phonet_alloc_inst(void)

opts->func_inst.free_func_inst = phonet_free_inst;
opts->net = gphonet_setup_default();
if (IS_ERR(opts->net))
return ERR_PTR(PTR_ERR(opts->net));
if (IS_ERR(opts->net)) {
struct net_device *net = opts->net;
kfree(opts);
return ERR_CAST(net);
}

config_group_init_type_name(&opts->func_inst.group, "",
&phonet_func_type);
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/f_rndis.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,11 @@ static struct usb_function_instance *rndis_alloc_inst(void)
mutex_init(&opts->lock);
opts->func_inst.free_func_inst = rndis_free_inst;
opts->net = gether_setup_default();
if (IS_ERR(opts->net))
return ERR_CAST(opts->net);
if (IS_ERR(opts->net)) {
struct net_device *net = opts->net;
kfree(opts);
return ERR_CAST(net);
}

config_group_init_type_name(&opts->func_inst.group, "",
&rndis_func_type);
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/f_subset.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,11 @@ static struct usb_function_instance *geth_alloc_inst(void)
mutex_init(&opts->lock);
opts->func_inst.free_func_inst = geth_free_inst;
opts->net = gether_setup_default();
if (IS_ERR(opts->net))
return ERR_CAST(opts->net);
if (IS_ERR(opts->net)) {
struct net_device *net = opts->net;
kfree(opts);
return ERR_CAST(net);
}

config_group_init_type_name(&opts->func_inst.group, "",
&gether_func_type);
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/gadget/fotg210-udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ static struct usb_gadget_ops fotg210_gadget_ops = {
.udc_stop = fotg210_udc_stop,
};

static int __exit fotg210_udc_remove(struct platform_device *pdev)
static int fotg210_udc_remove(struct platform_device *pdev)
{
struct fotg210_udc *fotg210 = dev_get_drvdata(&pdev->dev);

Expand All @@ -1088,7 +1088,7 @@ static int __exit fotg210_udc_remove(struct platform_device *pdev)
return 0;
}

static int __init fotg210_udc_probe(struct platform_device *pdev)
static int fotg210_udc_probe(struct platform_device *pdev)
{
struct resource *res, *ires;
struct fotg210_udc *fotg210 = NULL;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/gadget/mv_u3d_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ static int mv_u3d_remove(struct platform_device *dev)
kfree(u3d->eps);

if (u3d->irq)
free_irq(u3d->irq, &dev->dev);
free_irq(u3d->irq, u3d);

if (u3d->cap_regs)
iounmap(u3d->cap_regs);
Expand Down Expand Up @@ -1974,7 +1974,7 @@ static int mv_u3d_probe(struct platform_device *dev)
return 0;

err_unregister:
free_irq(u3d->irq, &dev->dev);
free_irq(u3d->irq, u3d);
err_request_irq:
err_get_irq:
kfree(u3d->status_req);
Expand Down
6 changes: 6 additions & 0 deletions drivers/usb/gadget/udc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ static DEFINE_MUTEX(udc_lock);

/* ------------------------------------------------------------------------- */

#ifdef CONFIG_HAS_DMA

int usb_gadget_map_request(struct usb_gadget *gadget,
struct usb_request *req, int is_in)
{
Expand Down Expand Up @@ -99,6 +101,8 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
}
EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);

#endif /* CONFIG_HAS_DMA */

/* ------------------------------------------------------------------------- */

void usb_gadget_set_state(struct usb_gadget *gadget,
Expand Down Expand Up @@ -194,9 +198,11 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
dev_set_name(&gadget->dev, "gadget");
gadget->dev.parent = parent;

#ifdef CONFIG_HAS_DMA
dma_set_coherent_mask(&gadget->dev, parent->coherent_dma_mask);
gadget->dev.dma_parms = parent->dma_parms;
gadget->dev.dma_mask = parent->dma_mask;
#endif

if (release)
gadget->dev.release = release;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/host/ehci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ static int ehci_hub_control (
ehci->reset_done[wIndex] = jiffies
+ msecs_to_jiffies(20);
usb_hcd_start_port_resume(&hcd->self, wIndex);
set_bit(wIndex, &ehci->resuming_ports);
/* check the port again */
mod_timer(&ehci_to_hcd(ehci)->rh_timer,
ehci->reset_done[wIndex]);
Expand Down
Loading

0 comments on commit db8cbfa

Please sign in to comment.