Hello.

On 12/08/2015 01:31 AM, Hauke Mehrtens wrote:

From: Rafał Miłecki <zaj...@gmail.com>

This fixes problem with controller seeing devices only in some small
percentage of cold boots.
This quirk is also added to the platform data so we can activate it
when we register our platform driver.

Signed-off-by: Rafał Miłecki <zaj...@gmail.com>
Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>

[...]
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 643d312..d49be9b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -122,6 +122,39 @@ int xhci_halt(struct xhci_hcd *xhci)
        return ret;
  }

+static int xhci_fake_doorbell(struct xhci_hcd *xhci, int slot_id)
+{
+       u32 temp;
+
+       /* alloc a virt device for slot */
+       if (!xhci_alloc_virt_device(xhci, slot_id, NULL, GFP_NOIO)) {
+               xhci_warn(xhci, "Could not allocate xHCI USB device data 
structures\n");
+               return -ENOMEM;
+       }
+
+       /* ring fake doorbell for slot_id ep 0 */
+       xhci_ring_ep_doorbell(xhci, slot_id, 0, 0);
+       usleep_range(1000, 1500);
+
+       /* read the status register to check if HSE is set or not? */
+       temp = readl(&xhci->op_regs->status);
+
+       /* clear HSE if set */
+       if (temp & STS_FATAL) {
+               xhci_dbg(xhci, "HSE problem detected, status: 0x%x\n", temp);
+               temp &= ~(0x1fff);

   Parens around the literal not needed at all...

[...]
@@ -568,10 +601,25 @@ int xhci_init(struct usb_hcd *hcd)

  static int xhci_run_finished(struct xhci_hcd *xhci)
  {
-       if (xhci_start(xhci)) {
-               xhci_halt(xhci);
-               return -ENODEV;
+       int err;
+
+       err = xhci_start(xhci);
+       if (err) {
+               err = -ENODEV;
+               goto out_err;
+       }
+       if (xhci->quirks & XHCI_FAKE_DOORBELL) {
+               err = xhci_fake_doorbell(xhci, 1);
+               if (err)
+                       goto out_err;
+
+               err = xhci_start(xhci);
+               if (err) {
+                       err = -ENODEV;
+                       goto out_err;
+               }

   Is it really necessary to call xhci_start() twice?

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to