Commit 6399232f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'fixes-for-v4.7-rc2' of...

Merge tag 'fixes-for-v4.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

Here's the first set of fixes for v4.7-rc
cycle. Nothing extra fancy this time around.

Patches range from MS OS Descriptor usage fixes, to
Clear Stall EP command fix on dwc3, to some f_fs
fixes and out of bounds accesses on renesas driver.
parents 1a695a90 50c763f8
What: /config/usb-gadget/gadget/functions/uvc.name What: /config/usb-gadget/gadget/functions/uvc.name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: UVC function directory Description: UVC function directory
streaming_maxburst - 0..15 (ss only) streaming_maxburst - 0..15 (ss only)
...@@ -9,37 +9,37 @@ Description: UVC function directory ...@@ -9,37 +9,37 @@ Description: UVC function directory
What: /config/usb-gadget/gadget/functions/uvc.name/control What: /config/usb-gadget/gadget/functions/uvc.name/control
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Control descriptors Description: Control descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/class What: /config/usb-gadget/gadget/functions/uvc.name/control/class
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Class descriptors Description: Class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Super speed control class descriptors Description: Super speed control class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Full speed control class descriptors Description: Full speed control class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Terminal descriptors Description: Terminal descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Output terminal descriptors Description: Output terminal descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Default output terminal descriptors Description: Default output terminal descriptors
All attributes read only: All attributes read only:
...@@ -53,12 +53,12 @@ Description: Default output terminal descriptors ...@@ -53,12 +53,12 @@ Description: Default output terminal descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Camera terminal descriptors Description: Camera terminal descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Default camera terminal descriptors Description: Default camera terminal descriptors
All attributes read only: All attributes read only:
...@@ -75,12 +75,12 @@ Description: Default camera terminal descriptors ...@@ -75,12 +75,12 @@ Description: Default camera terminal descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/processing What: /config/usb-gadget/gadget/functions/uvc.name/control/processing
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Processing unit descriptors Description: Processing unit descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Default processing unit descriptors Description: Default processing unit descriptors
All attributes read only: All attributes read only:
...@@ -94,49 +94,49 @@ Description: Default processing unit descriptors ...@@ -94,49 +94,49 @@ Description: Default processing unit descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/header What: /config/usb-gadget/gadget/functions/uvc.name/control/header
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Control header descriptors Description: Control header descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Specific control header descriptors Description: Specific control header descriptors
dwClockFrequency dwClockFrequency
bcdUVC bcdUVC
What: /config/usb-gadget/gadget/functions/uvc.name/streaming What: /config/usb-gadget/gadget/functions/uvc.name/streaming
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Streaming descriptors Description: Streaming descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Streaming class descriptors Description: Streaming class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Super speed streaming class descriptors Description: Super speed streaming class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: High speed streaming class descriptors Description: High speed streaming class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Full speed streaming class descriptors Description: Full speed streaming class descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Color matching descriptors Description: Color matching descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Default color matching descriptors Description: Default color matching descriptors
All attributes read only: All attributes read only:
...@@ -150,12 +150,12 @@ Description: Default color matching descriptors ...@@ -150,12 +150,12 @@ Description: Default color matching descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: MJPEG format descriptors Description: MJPEG format descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Specific MJPEG format descriptors Description: Specific MJPEG format descriptors
All attributes read only, All attributes read only,
...@@ -174,7 +174,7 @@ Description: Specific MJPEG format descriptors ...@@ -174,7 +174,7 @@ Description: Specific MJPEG format descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Specific MJPEG frame descriptors Description: Specific MJPEG frame descriptors
dwFrameInterval - indicates how frame interval can be dwFrameInterval - indicates how frame interval can be
...@@ -196,12 +196,12 @@ Description: Specific MJPEG frame descriptors ...@@ -196,12 +196,12 @@ Description: Specific MJPEG frame descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Uncompressed format descriptors Description: Uncompressed format descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Specific uncompressed format descriptors Description: Specific uncompressed format descriptors
bmaControls - this format's data for bmaControls in bmaControls - this format's data for bmaControls in
...@@ -221,7 +221,7 @@ Description: Specific uncompressed format descriptors ...@@ -221,7 +221,7 @@ Description: Specific uncompressed format descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Specific uncompressed frame descriptors Description: Specific uncompressed frame descriptors
dwFrameInterval - indicates how frame interval can be dwFrameInterval - indicates how frame interval can be
...@@ -243,12 +243,12 @@ Description: Specific uncompressed frame descriptors ...@@ -243,12 +243,12 @@ Description: Specific uncompressed frame descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Streaming header descriptors Description: Streaming header descriptors
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name
Date: Dec 2014 Date: Dec 2014
KernelVersion: 3.20 KernelVersion: 4.0
Description: Specific streaming header descriptors Description: Specific streaming header descriptors
All attributes read only: All attributes read only:
......
...@@ -64,6 +64,17 @@ ...@@ -64,6 +64,17 @@
DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \ DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \
dev_name(hsotg->dev), ##__VA_ARGS__) dev_name(hsotg->dev), ##__VA_ARGS__)
#ifdef CONFIG_MIPS
/*
* There are some MIPS machines that can run in either big-endian
* or little-endian mode and that use the dwc2 register without
* a byteswap in both ways.
* Unlike other architectures, MIPS apparently does not require a
* barrier before the __raw_writel() to synchronize with DMA but does
* require the barrier after the __raw_writel() to serialize a set of
* writes. This set of operations was added specifically for MIPS and
* should only be used there.
*/
static inline u32 dwc2_readl(const void __iomem *addr) static inline u32 dwc2_readl(const void __iomem *addr)
{ {
u32 value = __raw_readl(addr); u32 value = __raw_readl(addr);
...@@ -90,6 +101,22 @@ static inline void dwc2_writel(u32 value, void __iomem *addr) ...@@ -90,6 +101,22 @@ static inline void dwc2_writel(u32 value, void __iomem *addr)
pr_info("INFO:: wrote %08x to %p\n", value, addr); pr_info("INFO:: wrote %08x to %p\n", value, addr);
#endif #endif
} }
#else
/* Normal architectures just use readl/write */
static inline u32 dwc2_readl(const void __iomem *addr)
{
return readl(addr);
}
static inline void dwc2_writel(u32 value, void __iomem *addr)
{
writel(value, addr);
#ifdef DWC2_LOG_WRITES
pr_info("info:: wrote %08x to %p\n", value, addr);
#endif
}
#endif
/* Maximum number of Endpoints/HostChannels */ /* Maximum number of Endpoints/HostChannels */
#define MAX_EPS_CHANNELS 16 #define MAX_EPS_CHANNELS 16
......
...@@ -1018,7 +1018,7 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg, ...@@ -1018,7 +1018,7 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
return 1; return 1;
} }
static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value); static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now);
/** /**
* get_ep_head - return the first request on the endpoint * get_ep_head - return the first request on the endpoint
...@@ -1094,7 +1094,7 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg, ...@@ -1094,7 +1094,7 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
case USB_ENDPOINT_HALT: case USB_ENDPOINT_HALT:
halted = ep->halted; halted = ep->halted;
dwc2_hsotg_ep_sethalt(&ep->ep, set); dwc2_hsotg_ep_sethalt(&ep->ep, set, true);
ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);
if (ret) { if (ret) {
...@@ -2948,8 +2948,13 @@ static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) ...@@ -2948,8 +2948,13 @@ static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
* dwc2_hsotg_ep_sethalt - set halt on a given endpoint * dwc2_hsotg_ep_sethalt - set halt on a given endpoint
* @ep: The endpoint to set halt. * @ep: The endpoint to set halt.
* @value: Set or unset the halt. * @value: Set or unset the halt.
* @now: If true, stall the endpoint now. Otherwise return -EAGAIN if
* the endpoint is busy processing requests.
*
* We need to stall the endpoint immediately if request comes from set_feature
* protocol command handler.
*/ */
static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now)
{ {
struct dwc2_hsotg_ep *hs_ep = our_ep(ep); struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
struct dwc2_hsotg *hs = hs_ep->parent; struct dwc2_hsotg *hs = hs_ep->parent;
...@@ -2969,6 +2974,17 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) ...@@ -2969,6 +2974,17 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value)
return 0; return 0;
} }
if (hs_ep->isochronous) {
dev_err(hs->dev, "%s is Isochronous Endpoint\n", ep->name);
return -EINVAL;
}
if (!now && value && !list_empty(&hs_ep->queue)) {
dev_dbg(hs->dev, "%s request is pending, cannot halt\n",
ep->name);
return -EAGAIN;
}
if (hs_ep->dir_in) { if (hs_ep->dir_in) {
epreg = DIEPCTL(index); epreg = DIEPCTL(index);
epctl = dwc2_readl(hs->regs + epreg); epctl = dwc2_readl(hs->regs + epreg);
...@@ -3020,7 +3036,7 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) ...@@ -3020,7 +3036,7 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value)
int ret = 0; int ret = 0;
spin_lock_irqsave(&hs->lock, flags); spin_lock_irqsave(&hs->lock, flags);
ret = dwc2_hsotg_ep_sethalt(ep, value); ret = dwc2_hsotg_ep_sethalt(ep, value, false);
spin_unlock_irqrestore(&hs->lock, flags); spin_unlock_irqrestore(&hs->lock, flags);
return ret; return ret;
......
...@@ -402,6 +402,7 @@ ...@@ -402,6 +402,7 @@
#define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f)
#define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F) #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F)
#define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11)
#define DWC3_DEPCMD_CLEARPENDIN (1 << 11)
#define DWC3_DEPCMD_CMDACT (1 << 10) #define DWC3_DEPCMD_CMDACT (1 << 10)
#define DWC3_DEPCMD_CMDIOC (1 << 8) #define DWC3_DEPCMD_CMDIOC (1 << 8)
......
...@@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) ...@@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, exynos); platform_set_drvdata(pdev, exynos);
ret = dwc3_exynos_register_phys(exynos);
if (ret) {
dev_err(dev, "couldn't register PHYs\n");
return ret;
}
exynos->dev = dev; exynos->dev = dev;
exynos->clk = devm_clk_get(dev, "usbdrd30"); exynos->clk = devm_clk_get(dev, "usbdrd30");
...@@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev) ...@@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
goto err3; goto err3;
} }
ret = dwc3_exynos_register_phys(exynos);
if (ret) {
dev_err(dev, "couldn't register PHYs\n");
goto err4;
}
if (node) { if (node) {
ret = of_platform_populate(node, NULL, NULL, dev); ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) { if (ret) {
dev_err(dev, "failed to add dwc3 core\n"); dev_err(dev, "failed to add dwc3 core\n");
goto err4; goto err5;
} }
} else { } else {
dev_err(dev, "no device node, failed to add dwc3 core\n"); dev_err(dev, "no device node, failed to add dwc3 core\n");
ret = -ENODEV; ret = -ENODEV;
goto err4; goto err5;
} }
return 0; return 0;
err5:
platform_device_unregister(exynos->usb2_phy);
platform_device_unregister(exynos->usb3_phy);
err4: err4:
regulator_disable(exynos->vdd10); regulator_disable(exynos->vdd10);
err3: err3:
......
...@@ -129,12 +129,18 @@ static int st_dwc3_drd_init(struct st_dwc3 *dwc3_data) ...@@ -129,12 +129,18 @@ static int st_dwc3_drd_init(struct st_dwc3 *dwc3_data)
switch (dwc3_data->dr_mode) { switch (dwc3_data->dr_mode) {
case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_PERIPHERAL:
val &= ~(USB3_FORCE_VBUSVALID | USB3_DELAY_VBUSVALID val &= ~(USB3_DELAY_VBUSVALID
| USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)
| USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2
| USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
val |= USB3_DEVICE_NOT_HOST; /*
* USB3_PORT2_FORCE_VBUSVALID When '1' and when
* USB3_PORT2_DEVICE_NOT_HOST = 1, forces VBUSVLDEXT2 input
* of the pico PHY to 1.
*/
val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID;
break; break;
case USB_DR_MODE_HOST: case USB_DR_MODE_HOST:
......
...@@ -347,6 +347,28 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, ...@@ -347,6 +347,28 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
return ret; return ret;
} }
static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep)
{
struct dwc3 *dwc = dep->dwc;
struct dwc3_gadget_ep_cmd_params params;
u32 cmd = DWC3_DEPCMD_CLEARSTALL;
/*
* As of core revision 2.60a the recommended programming model
* is to set the ClearPendIN bit when issuing a Clear Stall EP
* command for IN endpoints. This is to prevent an issue where
* some (non-compliant) hosts may not send ACK TPs for pending
* IN transfers due to a mishandled error condition. Synopsys
* STAR 9000614252.
*/
if (dep->direction && (dwc->revision >= DWC3_REVISION_260A))
cmd |= DWC3_DEPCMD_CLEARPENDIN;
memset(&params, 0, sizeof(params));
return dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params);
}
static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep,
struct dwc3_trb *trb) struct dwc3_trb *trb)
{ {
...@@ -1314,8 +1336,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) ...@@ -1314,8 +1336,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
else else
dep->flags |= DWC3_EP_STALL; dep->flags |= DWC3_EP_STALL;
} else { } else {
ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, ret = dwc3_send_clear_stall_ep_cmd(dep);
DWC3_DEPCMD_CLEARSTALL, &params);
if (ret) if (ret)
dev_err(dwc->dev, "failed to clear STALL on %s\n", dev_err(dwc->dev, "failed to clear STALL on %s\n",
dep->name); dep->name);
...@@ -2247,7 +2268,6 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) ...@@ -2247,7 +2268,6 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc)
for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) { for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) {
struct dwc3_ep *dep; struct dwc3_ep *dep;
struct dwc3_gadget_ep_cmd_params params;
int ret; int ret;
dep = dwc->eps[epnum]; dep = dwc->eps[epnum];
...@@ -2259,9 +2279,7 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) ...@@ -2259,9 +2279,7 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc)
dep->flags &= ~DWC3_EP_STALL; dep->flags &= ~DWC3_EP_STALL;
memset(&params, 0, sizeof(params)); ret = dwc3_send_clear_stall_ep_cmd(dep);
ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
DWC3_DEPCMD_CLEARSTALL, &params);
WARN_ON_ONCE(ret); WARN_ON_ONCE(ret);
} }
} }
......
...@@ -1868,14 +1868,19 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1868,14 +1868,19 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
} }
break; break;
} }
req->length = value;
req->context = cdev; if (value >= 0) {
req->zero = value < w_length; req->length = value;
value = composite_ep0_queue(cdev, req, GFP_ATOMIC); req->context = cdev;
if (value < 0) { req->zero = value < w_length;
DBG(cdev, "ep_queue --> %d\n", value); value = composite_ep0_queue(cdev, req,
req->status = 0; GFP_ATOMIC);
composite_setup_complete(gadget->ep0, req); if (value < 0) {
DBG(cdev, "ep_queue --> %d\n", value);
req->status = 0;
composite_setup_complete(gadget->ep0,
req);
}
} }
return value; return value;
} }
......
...@@ -1401,6 +1401,7 @@ static const struct usb_gadget_driver configfs_driver_template = { ...@@ -1401,6 +1401,7 @@ static const struct usb_gadget_driver configfs_driver_template = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "configfs-gadget", .name = "configfs-gadget",
}, },
.match_existing_only = 1,
}; };
static struct config_group *gadgets_make( static struct config_group *gadgets_make(
......
...@@ -2051,7 +2051,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, ...@@ -2051,7 +2051,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type,
if (len < sizeof(*d) || if (len < sizeof(*d) ||
d->bFirstInterfaceNumber >= ffs->interfaces_count || d->bFirstInterfaceNumber >= ffs->interfaces_count ||
d->Reserved1) !d->Reserved1)
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
if (d->Reserved2[i]) if (d->Reserved2[i])
...@@ -2729,6 +2729,7 @@ static int _ffs_func_bind(struct usb_configuration *c, ...@@ -2729,6 +2729,7 @@ static int _ffs_func_bind(struct usb_configuration *c,
func->ffs->ss_descs_count; func->ffs->ss_descs_count;
int fs_len, hs_len, ss_len, ret, i; int fs_len, hs_len, ss_len, ret, i;
struct ffs_ep *eps_ptr;
/* Make it a single chunk, less management later on */ /* Make it a single chunk, less management later on */
vla_group(d); vla_group(d);
...@@ -2777,12 +2778,9 @@ static int _ffs_func_bind(struct usb_configuration *c, ...@@ -2777,12 +2778,9 @@ static int _ffs_func_bind(struct usb_configuration *c,
ffs->raw_descs_length); ffs->raw_descs_length);
memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz); memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz);
for (ret = ffs->eps_count; ret; --ret) { eps_ptr = vla_ptr(vlabuf, d, eps);
struct ffs_ep *ptr; for (i = 0; i < ffs->eps_count; i++)
eps_ptr[i].num = -1;
ptr = vla_ptr(vlabuf, d, eps);
ptr[ret].num = -1;
}
/* Save pointers /* Save pointers
* d_eps == vlabuf, func->eps used to kfree vlabuf later * d_eps == vlabuf, func->eps used to kfree vlabuf later
...@@ -2851,7 +2849,7 @@ static int _ffs_func_bind(struct usb_configuration *c, ...@@ -2851,7 +2849,7 @@ static int _ffs_func_bind(struct usb_configuration *c,
goto error; goto error;
func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table); func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table);
if (c->cdev->use_os_string) if (c->cdev->use_os_string) {
for (i = 0; i < ffs->interfaces_count; ++i) { for (i = 0; i < ffs->interfaces_count; ++i) {
struct usb_os_desc *desc; struct usb_os_desc *desc;
...@@ -2862,13 +2860,15 @@ static int _ffs_func_bind(struct usb_configuration *c, ...@@ -2862,13 +2860,15 @@ static int _ffs_func_bind(struct usb_configuration *c,
vla_ptr(vlabuf, d, ext_compat) + i * 16; vla_ptr(vlabuf, d, ext_compat) + i * 16;
INIT_LIST_HEAD(&desc->ext_prop); INIT_LIST_HEAD(&desc->ext_prop);
} }
ret = ffs_do_os_descs(ffs->ms_os_descs_count, ret = ffs_do_os_descs(ffs->ms_os_descs_count,
vla_ptr(vlabuf, d, raw_descs) + vla_ptr(vlabuf, d, raw_descs) +
fs_len + hs_len + ss_len, fs_len + hs_len + ss_len,
d_raw_descs__sz - fs_len - hs_len - ss_len, d_raw_descs__sz - fs_len - hs_len -
__ffs_func_bind_do_os_desc, func); ss_len,
if (unlikely(ret < 0)) __ffs_func_bind_do_os_desc, func);
goto error; if (unlikely(ret < 0))
goto error;
}
func->function.os_desc_n = func->function.os_desc_n =
c->cdev->use_os_string ? ffs->interfaces_count : 0; c->cdev->use_os_string ? ffs->interfaces_count : 0;
......
...@@ -161,14 +161,6 @@ static struct usb_endpoint_descriptor hs_ep_out_desc = { ...@@ -161,14 +161,6 @@ static struct usb_endpoint_descriptor hs_ep_out_desc = {
.wMaxPacketSize = cpu_to_le16(512) .wMaxPacketSize = cpu_to_le16(512)
}; };
static struct usb_qualifier_descriptor dev_qualifier = {
.bLength = sizeof(dev_qualifier),
.bDescriptorType = USB_DT_DEVICE_QUALIFIER,
.bcdUSB = cpu_to_le16(0x0200),
.bDeviceClass = USB_CLASS_PRINTER,
.bNumConfigurations = 1
};
static struct usb_descriptor_header *hs_printer_function[] = { static struct usb_descriptor_header *hs_printer_function[] = {
(struct usb_descriptor_header *) &intf_desc, (struct usb_descriptor_header *) &intf_desc,
(struct usb_descriptor_header *) &hs_ep_in_desc, (struct usb_descriptor_header *) &hs_ep_in_desc,
......
...@@ -1445,16 +1445,18 @@ static void usbg_drop_tpg(struct se_portal_group *se_tpg) ...@@ -1445,16 +1445,18 @@ static void usbg_drop_tpg(struct se_portal_group *se_tpg)
for (i = 0; i < TPG_INSTANCES; ++i) for (i = 0; i < TPG_INSTANCES; ++i)
if (tpg_instances[i].tpg == tpg) if (tpg_instances[i].tpg == tpg)
break; break;
if (i < TPG_INSTANCES) if (i < TPG_INSTANCES) {
tpg_instances[i].tpg = NULL; tpg_instances[i].tpg = NULL;
opts = container_of(tpg_instances[i].func_inst, opts = container_of(tpg_instances[i].func_inst,
struct f_tcm_opts, func_inst); struct f_tcm_opts, func_inst);
mutex_lock(&opts->dep_lock); mutex_lock(&opts->dep_lock);
if (opts->has_dep) if (opts->has_dep)
module_put(opts->dependent); module_put(opts->dependent);
else else
configfs_undepend_item_unlocked(&opts->func_inst.group.cg_item); configfs_undepend_item_unlocked(
mutex_unlock(&opts->dep_lock); &opts->func_inst.group.cg_item);
mutex_unlock(&opts->dep_lock);
}
mutex_unlock(&tpg_instances_lock); mutex_unlock(&tpg_instances_lock);
kfree(tpg); kfree(tpg);
......
...@@ -598,18 +598,6 @@ static struct usb_gadget_strings *fn_strings[] = { ...@@ -598,18 +598,6 @@ static struct usb_gadget_strings *fn_strings[] = {
NULL, NULL,
}; };
static struct usb_qualifier_descriptor devqual_desc = {
.bLength = sizeof devqual_desc,
.bDescriptorType = USB_DT_DEVICE_QUALIFIER,
.bcdUSB = cpu_to_le16(0x200),
.bDeviceClass = USB_CLASS_MISC,
.bDeviceSubClass = 0x02,
.bDeviceProtocol = 0x01,
.bNumConfigurations = 1,
.bRESERVED = 0,
};
static struct usb_interface_assoc_descriptor iad_desc = { static struct usb_interface_assoc_descriptor iad_desc = {
.bLength = sizeof iad_desc, .bLength = sizeof iad_desc,
.bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
...@@ -1292,6 +1280,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr) ...@@ -1292,6 +1280,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr)
if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) {
struct cntrl_cur_lay3 c; struct cntrl_cur_lay3 c;
memset(&c, 0, sizeof(struct cntrl_cur_lay3));
if (entity_id == USB_IN_CLK_ID) if (entity_id == USB_IN_CLK_ID)
c.dCUR = p_srate; c.dCUR = p_srate;
......
...@@ -83,9 +83,7 @@ EXPORT_SYMBOL_GPL(fsg_fs_function); ...@@ -83,9 +83,7 @@ EXPORT_SYMBOL_GPL(fsg_fs_function);
* USB 2.0 devices need to expose both high speed and full speed * USB 2.0 devices need to expose both high speed and full speed
* descriptors, unless they only run at full speed. * descriptors, unless they only run at full speed.
* *
* That means alternate endpoint descriptors (bigger packets) * That means alternate endpoint descriptors (bigger packets).
* and a "device qualifier" ... plus more construction options
* for the configuration descriptor.
*/ */
struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = { struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE, .bLength = USB_DT_ENDPOINT_SIZE,
......
...@@ -938,8 +938,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) ...@@ -938,8 +938,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
struct usb_ep *ep = dev->gadget->ep0; struct usb_ep *ep = dev->gadget->ep0;
struct usb_request *req = dev->req; struct usb_request *req = dev->req;
if ((retval = setup_req (ep, req, 0)) == 0) if ((retval = setup_req (ep, req, 0)) == 0) {
retval = usb_ep_queue (ep, req, GFP_ATOMIC); spin_unlock_irq (&dev->lock);
retval = usb_ep_queue (ep, req, GFP_KERNEL);
spin_lock_irq (&dev->lock);
}
dev->state = STATE_DEV_CONNECTED; dev->state = STATE_DEV_CONNECTED;
/* assume that was SET_CONFIGURATION */ /* assume that was SET_CONFIGURATION */
...@@ -1457,8 +1460,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1457,8 +1460,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
w_length); w_length);
if (value < 0) if (value < 0)
break; break;
spin_unlock (&dev->lock);
value = usb_ep_queue (gadget->ep0, dev->req, value = usb_ep_queue (gadget->ep0, dev->req,
GFP_ATOMIC); GFP_KERNEL);
spin_lock (&dev->lock);
if (value < 0) { if (value < 0) {
clean_req (gadget->ep0, dev->req); clean_req (gadget->ep0, dev->req);
break; break;
...@@ -1481,11 +1487,14 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1481,11 +1487,14 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
if (value >= 0 && dev->state != STATE_DEV_SETUP) { if (value >= 0 && dev->state != STATE_DEV_SETUP) {
req->length = value; req->length = value;
req->zero = value < w_length; req->zero = value < w_length;
value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
spin_unlock (&dev->lock);
value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL);
if (value < 0) { if (value < 0) {
DBG (dev, "ep_queue --> %d\n", value); DBG (dev, "ep_queue --> %d\n", value);
req->status = 0; req->status = 0;
} }
return value;
} }
/* device stalls when value < 0 */ /* device stalls when value < 0 */
......
...@@ -603,11 +603,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) ...@@ -603,11 +603,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver)
} }
} }
list_add_tail(&driver->pending, &gadget_driver_pending_list); if (!driver->match_existing_only) {
pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n", list_add_tail(&driver->pending, &gadget_driver_pending_list);
driver->function); pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",
driver->function);
ret = 0;
}
mutex_unlock(&udc_lock); mutex_unlock(&udc_lock);
return 0; return ret;
found: found:
ret = udc_bind_to_driver(udc, driver); ret = udc_bind_to_driver(udc, driver);
mutex_unlock(&udc_lock); mutex_unlock(&udc_lock);
......
...@@ -1034,6 +1034,8 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget) ...@@ -1034,6 +1034,8 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget)
* @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL, * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL,
* this driver will be bound to any available UDC. * this driver will be bound to any available UDC.
* @pending: UDC core private data used for deferred probe of this driver. * @pending: UDC core private data used for deferred probe of this driver.
* @match_existing_only: If udc is not found, return an error and don't add this
* gadget driver to list of pending driver
* *
* Devices are disabled till a gadget driver successfully bind()s, which * Devices are disabled till a gadget driver successfully bind()s, which
* means the driver will handle setup() requests needed to enumerate (and * means the driver will handle setup() requests needed to enumerate (and
...@@ -1097,6 +1099,7 @@ struct usb_gadget_driver { ...@@ -1097,6 +1099,7 @@ struct usb_gadget_driver {
char *udc_name; char *udc_name;
struct list_head pending; struct list_head pending;
unsigned match_existing_only:1;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment