Re: [PATCH v2 2/2] usb: xhci: add Broadcom specific fake doorbell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/08/2015 03:31 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 12/08/2015 01:31 AM, Hauke Mehrtens wrote:
> 
>> From: Rafał Miłecki <zajec5@xxxxxxxxx>
>>
>> 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 <zajec5@xxxxxxxxx>
>> Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
> 
> [...]
>> 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...

I will remove them

> 
> [...]
>> @@ -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?

at least in my test it was necessary. I will look into this again.

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux