From: Lu Baolu <baolu.lu@linux.intel.com>
To: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Lu Baolu <baolu.lu@linux.intel.com>,
stable@vger.kernel.org
Subject: [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices
Date: Wed, 7 Sep 2016 11:05:43 +0800 [thread overview]
Message-ID: <1473217583-17174-1-git-send-email-baolu.lu@linux.intel.com> (raw)
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
next reply other threads:[~2016-09-07 3:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 3:05 Lu Baolu [this message]
2016-09-08 8:06 ` [PATCH 1/1] usb: dwc3: avoid setting ClearPendIn for Intel Cherry Trail devices Lu Baolu
2016-09-08 8:31 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473217583-17174-1-git-send-email-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=felipe.balbi@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.