* [PATCH v2] usb: gadget: fsl_udc_core: Fix pullup status
@ 2016-03-25 15:11 Dmitry Osipenko
2016-03-29 10:31 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Osipenko @ 2016-03-25 15:11 UTC (permalink / raw)
To: Felipe Balbi, Li Yang, Sergei Shtylyov; +Cc: linux-usb, linux-kernel
udc->softconnect should be set regardless of the VBUS state, otherwise
the USB peripheral device, connected during suspend, won't be detected
since can_pullup() would return false and the UDC won't be enabled.
Fixes: 252455c40316 (usb: gadget: fsl driver pullup fix)
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
Changelog:
V2: "(is_on != 0)" changed to "!!is_on" as per Sergei Shtylyov comment,
cleaned up commit message.
drivers/usb/gadget/udc/fsl_udc_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index aab5221..4309b4f 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -1220,10 +1220,11 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on)
udc = container_of(gadget, struct fsl_udc, gadget);
+ udc->softconnect = !!is_on;
+
if (!udc->vbus_active)
return -EOPNOTSUPP;
- udc->softconnect = (is_on != 0);
if (can_pullup(udc))
fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP),
&dr_regs->usbcmd);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] usb: gadget: fsl_udc_core: Fix pullup status
2016-03-25 15:11 [PATCH v2] usb: gadget: fsl_udc_core: Fix pullup status Dmitry Osipenko
@ 2016-03-29 10:31 ` Felipe Balbi
2016-03-29 11:16 ` Dmitry Osipenko
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2016-03-29 10:31 UTC (permalink / raw)
To: Dmitry Osipenko, Li Yang, Sergei Shtylyov; +Cc: linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]
Dmitry Osipenko <digetx@gmail.com> writes:
> udc->softconnect should be set regardless of the VBUS state, otherwise
> the USB peripheral device, connected during suspend, won't be detected
> since can_pullup() would return false and the UDC won't be enabled.
>
> Fixes: 252455c40316 (usb: gadget: fsl driver pullup fix)
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> Changelog:
> V2: "(is_on != 0)" changed to "!!is_on" as per Sergei Shtylyov comment,
> cleaned up commit message.
>
> drivers/usb/gadget/udc/fsl_udc_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
> index aab5221..4309b4f 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -1220,10 +1220,11 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on)
>
> udc = container_of(gadget, struct fsl_udc, gadget);
>
> + udc->softconnect = !!is_on;
> +
> if (!udc->vbus_active)
> return -EOPNOTSUPP;
>
> - udc->softconnect = (is_on != 0);
if we're suspended and VBUS was cut off, why would we keep softconnect
set to true ? That would also cause a discrepancy between SW state and
HW state.
I don't have this HW to test, but this patch seems wrong to me.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: gadget: fsl_udc_core: Fix pullup status
2016-03-29 10:31 ` Felipe Balbi
@ 2016-03-29 11:16 ` Dmitry Osipenko
2016-03-29 11:19 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Osipenko @ 2016-03-29 11:16 UTC (permalink / raw)
To: Felipe Balbi, Li Yang, Sergei Shtylyov; +Cc: linux-usb, linux-kernel
29.03.2016 13:31, Felipe Balbi пишет:
> Dmitry Osipenko <digetx@gmail.com> writes:
>> udc->softconnect should be set regardless of the VBUS state, otherwise
>> the USB peripheral device, connected during suspend, won't be detected
>> since can_pullup() would return false and the UDC won't be enabled.
>>
>> Fixes: 252455c40316 (usb: gadget: fsl driver pullup fix)
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>> Changelog:
>> V2: "(is_on != 0)" changed to "!!is_on" as per Sergei Shtylyov comment,
>> cleaned up commit message.
>>
>> drivers/usb/gadget/udc/fsl_udc_core.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
>> index aab5221..4309b4f 100644
>> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
>> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
>> @@ -1220,10 +1220,11 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on)
>>
>> udc = container_of(gadget, struct fsl_udc, gadget);
>>
>> + udc->softconnect = !!is_on;
>> +
>> if (!udc->vbus_active)
>> return -EOPNOTSUPP;
>>
>> - udc->softconnect = (is_on != 0);
>
> if we're suspended and VBUS was cut off, why would we keep softconnect
> set to true ? That would also cause a discrepancy between SW state and
> HW state.
>
> I don't have this HW to test, but this patch seems wrong to me.
>
Yeah, you are right. I'm using a fork of this driver with some minor differences
to make it work with other hardware and missed that upstream driver enables
controller on resume unconditionally. Sorry for the noise and please ignore this
patch.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: gadget: fsl_udc_core: Fix pullup status
2016-03-29 11:16 ` Dmitry Osipenko
@ 2016-03-29 11:19 ` Felipe Balbi
0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2016-03-29 11:19 UTC (permalink / raw)
To: Dmitry Osipenko, Li Yang, Sergei Shtylyov; +Cc: linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]
Dmitry Osipenko <digetx@gmail.com> writes:
> 29.03.2016 13:31, Felipe Balbi пишет:
>> Dmitry Osipenko <digetx@gmail.com> writes:
>>> udc->softconnect should be set regardless of the VBUS state, otherwise
>>> the USB peripheral device, connected during suspend, won't be detected
>>> since can_pullup() would return false and the UDC won't be enabled.
>>>
>>> Fixes: 252455c40316 (usb: gadget: fsl driver pullup fix)
>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>> ---
>>> Changelog:
>>> V2: "(is_on != 0)" changed to "!!is_on" as per Sergei Shtylyov comment,
>>> cleaned up commit message.
>>>
>>> drivers/usb/gadget/udc/fsl_udc_core.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
>>> index aab5221..4309b4f 100644
>>> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
>>> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
>>> @@ -1220,10 +1220,11 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on)
>>>
>>> udc = container_of(gadget, struct fsl_udc, gadget);
>>>
>>> + udc->softconnect = !!is_on;
>>> +
>>> if (!udc->vbus_active)
>>> return -EOPNOTSUPP;
>>>
>>> - udc->softconnect = (is_on != 0);
>>
>> if we're suspended and VBUS was cut off, why would we keep softconnect
>> set to true ? That would also cause a discrepancy between SW state and
>> HW state.
>>
>> I don't have this HW to test, but this patch seems wrong to me.
>>
>
> Yeah, you are right. I'm using a fork of this driver with some minor differences
> to make it work with other hardware and missed that upstream driver enables
> controller on resume unconditionally. Sorry for the noise and please ignore this
> patch.
you shouldn't send patches unless you have tested them. Simply
cherry-picking from another tree and sending it is NOT good enough. You
MUST test what you're sending with latest tag from Linus (right now,
that's v4.6-rc1). If you can't update your kernel, then don't try to
patch something you can't validate.
Thanks
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-29 11:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 15:11 [PATCH v2] usb: gadget: fsl_udc_core: Fix pullup status Dmitry Osipenko
2016-03-29 10:31 ` Felipe Balbi
2016-03-29 11:16 ` Dmitry Osipenko
2016-03-29 11:19 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox