Re: [PATCH] USB: dwc2: add a call to device_reset_optional()

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

 



On 14/10/2014 21:54, Paul Zimmerman wrote:
>> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of John Crispin
>> Sent: Friday, October 10, 2014 10:27 AM
>>
>> We need this for dwc2 to work on older ralink SoC like the rt3052.
>>
>> Signed-off-by: John Crispin <blogic@xxxxxxxxxxx>
>> ---
>>  drivers/usb/dwc2/hcd.c |    6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
>> index 4d918ed..8b5f966 100644
>> --- a/drivers/usb/dwc2/hcd.c
>> +++ b/drivers/usb/dwc2/hcd.c
>> @@ -47,6 +47,7 @@
>>  #include <linux/io.h>
>>  #include <linux/slab.h>
>>  #include <linux/usb.h>
>> +#include <linux/reset.h>
>>
>>  #include <linux/usb/hcd.h>
>>  #include <linux/usb/ch11.h>
>> @@ -2764,6 +2765,11 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
>>
>>  	dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n");
>>
>> +	/* reset the device if a reset controller is present */
>> +	retval = device_reset_optional(hsotg->dev);
>> +	if (retval && retval != -ENOSYS)
>> +		return retval;
>> +
>>  	/* Detect config values from hardware */
>>  	retval = dwc2_get_hwparams(hsotg);
>>
> Hmm. Can you explain this a bit more? I'm not familiar with the reset
> control API.
>
> But I see that there is currently no user of device_reset_optional() in
> the kernel. Looks like drivers typically call devm_reset_control_get()
> in their probe functions, then save the returned pointer and call it
> later to do the reset. I wonder why dwc2 would be the only driver not
> to do it that way?
>
Hi,

we originally used device_reset(), when the reset api was new. this had
the problem that there was no stub in the headers for when the api was
not enabled.
when i rebased the patch last week, i simply checked the header file and
saw that there was a new stub and used it. hence the use of
device_reset_optional(). i will rework the patch and use
devm_reset_control_get instead.

    John
--
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