Skip to content

Commit

Permalink
Merge tag 'usb-4.13-rc2' 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 some small USB fixes for 4.13-rc2.

  The usual batch, gadget fixes for reported issues, as well as xhci
  fixes, and a small random collection of other fixes for reported
  issues.

  All have been in linux-next with no reported issues"

* tag 'usb-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits)
  xhci: fix memleak in xhci_run()
  usb: xhci: fix spinlock recursion for USB2 test mode
  xhci: fix 20000ms port resume timeout
  usb: xhci: Issue stop EP command only when the EP state is running
  xhci: Bad Ethernet performance plugged in ASM1042A host
  xhci: Fix NULL pointer dereference when cleaning up streams for removed host
  usb: renesas_usbhs: gadget: disable all eps when the driver stops
  usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
  usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen()
  usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac
  usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
  usb: gadget: f_uac2: endianness fixes.
  usb: gadget: f_uac1: endianness fixes.
  include: usb: audio: specify exact endiannes of descriptors
  usb: gadget: udc: start_udc() can be static
  usb: dwc2: gadget: On USB RESET reset device address to zero
  usb: storage: return on error to avoid a null pointer dereference
  usb: typec: include linux/device.h in ucsi.h
  USB: cdc-acm: add device-id for quirky printer
  usb: dwc3: gadget: only unmap requests from DMA if mapped
  ...
  • Loading branch information
torvalds committed Jul 22, 2017
2 parents bcb53e5 + d6f5f07 commit 55fd939
Show file tree
Hide file tree
Showing 24 changed files with 197 additions and 72 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,9 @@ static const struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
},
{ USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
},

{ USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */
.driver_info = CLEAR_HALT_CONDITIONS,
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/dwc2/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -3573,6 +3573,9 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
/* Report disconnection if it is not already done. */
dwc2_hsotg_disconnect(hsotg);

/* Reset device address to zero */
__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);

if (usb_status & GOTGCTL_BSESVLD && connected)
dwc2_hsotg_core_init_disconnected(hsotg, true);
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,15 @@ static int dwc3_core_init(struct dwc3 *dwc)
dwc->maximum_speed = USB_SPEED_HIGH;
}

ret = dwc3_core_soft_reset(dwc);
ret = dwc3_core_get_phy(dwc);
if (ret)
goto err0;

ret = dwc3_phy_setup(dwc);
ret = dwc3_core_soft_reset(dwc);
if (ret)
goto err0;

ret = dwc3_core_get_phy(dwc);
ret = dwc3_phy_setup(dwc);
if (ret)
goto err0;

Expand Down
18 changes: 8 additions & 10 deletions drivers/usb/dwc3/dwc3-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,6 @@ static int dwc3_omap_probe(struct platform_device *pdev)

/* check the DMA Status */
reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
irq_set_status_flags(omap->irq, IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
dwc3_omap_interrupt_thread, IRQF_SHARED,
"dwc3-omap", omap);
if (ret) {
dev_err(dev, "failed to request IRQ #%d --> %d\n",
omap->irq, ret);
goto err1;
}

ret = dwc3_omap_extcon_register(omap);
if (ret < 0)
Expand All @@ -532,8 +523,15 @@ static int dwc3_omap_probe(struct platform_device *pdev)
goto err1;
}

ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
dwc3_omap_interrupt_thread, IRQF_SHARED,
"dwc3-omap", omap);
if (ret) {
dev_err(dev, "failed to request IRQ #%d --> %d\n",
omap->irq, ret);
goto err1;
}
dwc3_omap_enable_irqs(omap);
enable_irq(omap->irq);
return 0;

err1:
Expand Down
8 changes: 5 additions & 3 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,16 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,

req->started = false;
list_del(&req->list);
req->trb = NULL;
req->remaining = 0;

if (req->request.status == -EINPROGRESS)
req->request.status = status;

usb_gadget_unmap_request_by_dev(dwc->sysdev,
&req->request, req->direction);
if (req->trb)
usb_gadget_unmap_request_by_dev(dwc->sysdev,
&req->request, req->direction);

req->trb = NULL;

trace_dwc3_gadget_giveback(req);

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ static int fsg_main_thread(void *common_)
int i;

down_write(&common->filesem);
for (i = 0; i < ARRAY_SIZE(common->luns); --i) {
for (i = 0; i < ARRAY_SIZE(common->luns); i++) {
struct fsg_lun *curlun = common->luns[i];
if (!curlun || !fsg_lun_is_open(curlun))
continue;
Expand Down
20 changes: 10 additions & 10 deletions drivers/usb/gadget/function/f_uac1.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ static struct uac_input_terminal_descriptor usb_out_it_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_INPUT_TERMINAL,
.bTerminalID = USB_OUT_IT_ID,
.wTerminalType = UAC_TERMINAL_STREAMING,
.wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING),
.bAssocTerminal = 0,
.wChannelConfig = 0x3,
.wChannelConfig = cpu_to_le16(0x3),
};

#define IO_OUT_OT_ID 2
Expand All @@ -103,7 +103,7 @@ static struct uac1_output_terminal_descriptor io_out_ot_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
.bTerminalID = IO_OUT_OT_ID,
.wTerminalType = UAC_OUTPUT_TERMINAL_SPEAKER,
.wTerminalType = cpu_to_le16(UAC_OUTPUT_TERMINAL_SPEAKER),
.bAssocTerminal = 0,
.bSourceID = USB_OUT_IT_ID,
};
Expand All @@ -114,9 +114,9 @@ static struct uac_input_terminal_descriptor io_in_it_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_INPUT_TERMINAL,
.bTerminalID = IO_IN_IT_ID,
.wTerminalType = UAC_INPUT_TERMINAL_MICROPHONE,
.wTerminalType = cpu_to_le16(UAC_INPUT_TERMINAL_MICROPHONE),
.bAssocTerminal = 0,
.wChannelConfig = 0x3,
.wChannelConfig = cpu_to_le16(0x3),
};

#define USB_IN_OT_ID 4
Expand All @@ -125,7 +125,7 @@ static struct uac1_output_terminal_descriptor usb_in_ot_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
.bTerminalID = USB_IN_OT_ID,
.wTerminalType = UAC_TERMINAL_STREAMING,
.wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING),
.bAssocTerminal = 0,
.bSourceID = IO_IN_IT_ID,
};
Expand Down Expand Up @@ -174,7 +174,7 @@ static struct uac1_as_header_descriptor as_out_header_desc = {
.bDescriptorSubtype = UAC_AS_GENERAL,
.bTerminalLink = USB_OUT_IT_ID,
.bDelay = 1,
.wFormatTag = UAC_FORMAT_TYPE_I_PCM,
.wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM),
};

static struct uac1_as_header_descriptor as_in_header_desc = {
Expand All @@ -183,7 +183,7 @@ static struct uac1_as_header_descriptor as_in_header_desc = {
.bDescriptorSubtype = UAC_AS_GENERAL,
.bTerminalLink = USB_IN_OT_ID,
.bDelay = 1,
.wFormatTag = UAC_FORMAT_TYPE_I_PCM,
.wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM),
};

DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1);
Expand Down Expand Up @@ -606,8 +606,8 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
if (status)
goto fail;

audio->out_ep_maxpsize = as_out_ep_desc.wMaxPacketSize;
audio->in_ep_maxpsize = as_in_ep_desc.wMaxPacketSize;
audio->out_ep_maxpsize = le16_to_cpu(as_out_ep_desc.wMaxPacketSize);
audio->in_ep_maxpsize = le16_to_cpu(as_in_ep_desc.wMaxPacketSize);
audio->params.c_chmask = audio_opts->c_chmask;
audio->params.c_srate = audio_opts->c_srate;
audio->params.c_ssize = audio_opts->c_ssize;
Expand Down
25 changes: 14 additions & 11 deletions drivers/usb/gadget/function/f_uac2.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static struct uac2_input_terminal_descriptor usb_out_it_desc = {
.bAssocTerminal = 0,
.bCSourceID = USB_OUT_CLK_ID,
.iChannelNames = 0,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
.bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
};

/* Input Terminal for I/O-In */
Expand All @@ -182,7 +182,7 @@ static struct uac2_input_terminal_descriptor io_in_it_desc = {
.bAssocTerminal = 0,
.bCSourceID = USB_IN_CLK_ID,
.iChannelNames = 0,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
.bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
};

/* Ouput Terminal for USB_IN */
Expand All @@ -196,7 +196,7 @@ static struct uac2_output_terminal_descriptor usb_in_ot_desc = {
.bAssocTerminal = 0,
.bSourceID = IO_IN_IT_ID,
.bCSourceID = USB_IN_CLK_ID,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
.bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
};

/* Ouput Terminal for I/O-Out */
Expand All @@ -210,7 +210,7 @@ static struct uac2_output_terminal_descriptor io_out_ot_desc = {
.bAssocTerminal = 0,
.bSourceID = USB_OUT_IT_ID,
.bCSourceID = USB_OUT_CLK_ID,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
.bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
};

static struct uac2_ac_header_descriptor ac_hdr_desc = {
Expand All @@ -220,9 +220,10 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = {
.bDescriptorSubtype = UAC_MS_HEADER,
.bcdADC = cpu_to_le16(0x200),
.bCategory = UAC2_FUNCTION_IO_BOX,
.wTotalLength = sizeof in_clk_src_desc + sizeof out_clk_src_desc
+ sizeof usb_out_it_desc + sizeof io_in_it_desc
+ sizeof usb_in_ot_desc + sizeof io_out_ot_desc,
.wTotalLength = cpu_to_le16(sizeof in_clk_src_desc
+ sizeof out_clk_src_desc + sizeof usb_out_it_desc
+ sizeof io_in_it_desc + sizeof usb_in_ot_desc
+ sizeof io_out_ot_desc),
.bmControls = 0,
};

Expand Down Expand Up @@ -569,10 +570,12 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
return ret;
}

agdev->in_ep_maxpsize = max(fs_epin_desc.wMaxPacketSize,
hs_epin_desc.wMaxPacketSize);
agdev->out_ep_maxpsize = max(fs_epout_desc.wMaxPacketSize,
hs_epout_desc.wMaxPacketSize);
agdev->in_ep_maxpsize = max_t(u16,
le16_to_cpu(fs_epin_desc.wMaxPacketSize),
le16_to_cpu(hs_epin_desc.wMaxPacketSize));
agdev->out_ep_maxpsize = max_t(u16,
le16_to_cpu(fs_epout_desc.wMaxPacketSize),
le16_to_cpu(hs_epout_desc.wMaxPacketSize));

hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
Expand Down
5 changes: 3 additions & 2 deletions drivers/usb/gadget/udc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ config USB_RENESAS_USBHS_UDC
config USB_RENESAS_USB3
tristate 'Renesas USB3.0 Peripheral controller'
depends on ARCH_RENESAS || COMPILE_TEST
depends on EXTCON
depends on EXTCON && HAS_DMA
help
Renesas USB3.0 Peripheral controller is a USB peripheral controller
that supports super, high, and full speed USB 3.0 data transfers.
Expand Down Expand Up @@ -257,6 +257,7 @@ config USB_MV_U3D

config USB_SNP_CORE
depends on (USB_AMD5536UDC || USB_SNP_UDC_PLAT)
depends on HAS_DMA
tristate
help
This enables core driver support for Synopsys USB 2.0 Device
Expand All @@ -271,7 +272,7 @@ config USB_SNP_CORE

config USB_SNP_UDC_PLAT
tristate "Synopsys USB 2.0 Device controller"
depends on (USB_GADGET && OF)
depends on USB_GADGET && OF && HAS_DMA
select USB_GADGET_DUALSPEED
select USB_SNP_CORE
default ARCH_BCM_IPROC
Expand Down
14 changes: 10 additions & 4 deletions drivers/usb/gadget/udc/renesas_usb3.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@

/* USB_COM_CON */
#define USB_COM_CON_CONF BIT(24)
#define USB_COM_CON_PN_WDATAIF_NL BIT(23)
#define USB_COM_CON_PN_RDATAIF_NL BIT(22)
#define USB_COM_CON_PN_LSTTR_PP BIT(21)
#define USB_COM_CON_SPD_MODE BIT(17)
#define USB_COM_CON_EP0_EN BIT(16)
#define USB_COM_CON_DEV_ADDR_SHIFT 8
Expand Down Expand Up @@ -686,6 +689,9 @@ static void renesas_usb3_init_controller(struct renesas_usb3 *usb3)
{
usb3_init_axi_bridge(usb3);
usb3_init_epc_registers(usb3);
usb3_set_bit(usb3, USB_COM_CON_PN_WDATAIF_NL |
USB_COM_CON_PN_RDATAIF_NL | USB_COM_CON_PN_LSTTR_PP,
USB3_USB_COM_CON);
usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA);
usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA);

Expand Down Expand Up @@ -1369,7 +1375,7 @@ static int renesas_usb3_dma_free_prd(struct renesas_usb3 *usb3,

usb3_for_each_dma(usb3, dma, i) {
if (dma->prd) {
dma_free_coherent(dev, USB3_DMA_MAX_XFER_SIZE,
dma_free_coherent(dev, USB3_DMA_PRD_SIZE,
dma->prd, dma->prd_dma);
dma->prd = NULL;
}
Expand Down Expand Up @@ -1409,12 +1415,12 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep,
int ret = -EAGAIN;
u32 enable_bits = 0;

spin_lock_irqsave(&usb3->lock, flags);
if (usb3_ep->halt || usb3_ep->started)
return;
goto out;
if (usb3_req != usb3_req_first)
return;
goto out;

spin_lock_irqsave(&usb3->lock, flags);
if (usb3_pn_change(usb3, usb3_ep->num) < 0)
goto out;

Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/gadget/udc/snps_udc_plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/* description */
#define UDC_MOD_DESCRIPTION "Synopsys UDC platform driver"

void start_udc(struct udc *udc)
static void start_udc(struct udc *udc)
{
if (udc->driver) {
dev_info(udc->dev, "Connecting...\n");
Expand All @@ -38,7 +38,7 @@ void start_udc(struct udc *udc)
}
}

void stop_udc(struct udc *udc)
static void stop_udc(struct udc *udc)
{
int tmp;
u32 reg;
Expand Down Expand Up @@ -76,7 +76,7 @@ void stop_udc(struct udc *udc)
dev_info(udc->dev, "Device disconnected\n");
}

void udc_drd_work(struct work_struct *work)
static void udc_drd_work(struct work_struct *work)
{
struct udc *udc;

Expand Down
Loading

0 comments on commit 55fd939

Please sign in to comment.