* [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices
@ 2016-09-07 3:05 Lu Baolu
2016-09-08 8:06 ` Lu Baolu
0 siblings, 1 reply; 3+ messages in thread
From: Lu Baolu @ 2016-09-07 3:05 UTC (permalink / raw)
To: Felipe Balbi; +Cc: linux-usb, linux-kernel, Lu Baolu, stable
Commit 50c763f8c1bac ("usb: dwc3: Set the ClearPendIN bit on Clear
Stall EP command") causes Clear Stall EP command failure on Intel
Cherry Trail devices. This patch add a quirk to avoid setting this
bit for those Intel devices.
Cc: stable@vger.kernel.org # 4.7+
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/usb/dwc3/core.c | 3 +++
drivers/usb/dwc3/core.h | 3 +++
drivers/usb/dwc3/dwc3-pci.c | 11 +++++++++++
drivers/usb/dwc3/gadget.c | 3 ++-
4 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 35d0924..b858c43 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -934,6 +934,9 @@ static int dwc3_probe(struct platform_device *pdev)
device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
&dwc->fladj);
+ dwc->avoid_clearpendin_quirk = device_property_read_bool(dev,
+ "snps,avoid_clearpendin_quirk");
+
dwc->lpm_nyet_threshold = lpm_nyet_threshold;
dwc->tx_de_emphasis = tx_de_emphasis;
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 45d6de5..eddfa75 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -805,6 +805,8 @@ struct dwc3_scratchpad_array {
* 1 - -3.5dB de-emphasis
* 2 - No de-emphasis
* 3 - Reserved
+ * @avoid_clearpendin_quirk: set if we avoid setting ClearPendIn bit
+ * on Clear Stall EP command
*/
struct dwc3 {
struct usb_ctrlrequest *ctrl_req;
@@ -945,6 +947,7 @@ struct dwc3 {
unsigned tx_de_emphasis_quirk:1;
unsigned tx_de_emphasis:2;
+ unsigned avoid_clearpendin_quirk:1;
};
/* -------------------------------------------------------------------------- */
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 0a32430..e89893e 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -117,6 +117,17 @@ static int dwc3_pci_quirks(struct pci_dev *pdev, struct platform_device *dwc3)
usleep_range(10000, 11000);
}
}
+
+ if (pdev->device == PCI_DEVICE_ID_INTEL_BSW) {
+ struct property_entry bsw_properties[] = {
+ PROPERTY_ENTRY_BOOL(
+ "snps,avoid_clearpendin_quirk"),
+ { }
+ };
+
+ return platform_device_add_properties(dwc3,
+ bsw_properties);
+ }
}
if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS &&
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 7a8d3d8..5a6897e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -348,7 +348,8 @@ static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep)
* IN transfers due to a mishandled error condition. Synopsys
* STAR 9000614252.
*/
- if (dep->direction && (dwc->revision >= DWC3_REVISION_260A))
+ if (dep->direction && (dwc->revision >= DWC3_REVISION_260A) &&
+ !dwc->avoid_clearpendin_quirk)
cmd |= DWC3_DEPCMD_CLEARPENDIN;
memset(¶ms, 0, sizeof(params));
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices
2016-09-07 3:05 [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices Lu Baolu
@ 2016-09-08 8:06 ` Lu Baolu
2016-09-08 8:31 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: Lu Baolu @ 2016-09-08 8:06 UTC (permalink / raw)
To: Felipe Balbi; +Cc: linux-usb, linux-kernel, stable
Hi Felipe,
On 09/07/2016 11:05 AM, Lu Baolu wrote:
> Commit 50c763f8c1bac ("usb: dwc3: Set the ClearPendIN bit on Clear
> Stall EP command") causes Clear Stall EP command failure on Intel
> Cherry Trail devices. This patch add a quirk to avoid setting this
> bit for those Intel devices.
>
> Cc: stable@vger.kernel.org # 4.7+
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Please ignore this patch. It's not a quirk, but a bug.
I will send you a fix soon. Sorry for disturbing.
Best regards,
Lu Baolu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices
2016-09-08 8:06 ` Lu Baolu
@ 2016-09-08 8:31 ` Felipe Balbi
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2016-09-08 8:31 UTC (permalink / raw)
To: Lu Baolu; +Cc: linux-usb, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Hi Baolu,
Lu Baolu <baolu.lu@linux.intel.com> writes:
> Hi Felipe,
>
> On 09/07/2016 11:05 AM, Lu Baolu wrote:
>> Commit 50c763f8c1bac ("usb: dwc3: Set the ClearPendIN bit on Clear
>> Stall EP command") causes Clear Stall EP command failure on Intel
>> Cherry Trail devices. This patch add a quirk to avoid setting this
>> bit for those Intel devices.
>>
>> Cc: stable@vger.kernel.org # 4.7+
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>
> Please ignore this patch. It's not a quirk, but a bug.
> I will send you a fix soon. Sorry for disturbing.
that's okay, thanks for letting me know.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-08 8:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-07 3:05 [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices Lu Baolu
2016-09-08 8:06 ` Lu Baolu
2016-09-08 8:31 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).