All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Paul Zimmerman
	<Paul.Zimmerman-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
	Kyungmin Park
	<kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Robert Baldyga
	<r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH v2 01/10] usb: dwc2/gadget: report disconnect event from 'end session' irq
Date: Fri, 31 Oct 2014 08:45:58 +0100	[thread overview]
Message-ID: <54533E36.6070203@samsung.com> (raw)
In-Reply-To: <A2CA0424C0A6F04399FB9E1CD98E0304844E5C19-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>

Hello,

On 2014-10-25 03:23, Paul Zimmerman wrote:
>> From: Marek Szyprowski [mailto:m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org]
>> Sent: Monday, October 20, 2014 3:46 AM
>>
>> This patch adds a call to s3c_hsotg_disconnect() from 'end session'
>> interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem
>> about unplugged usb cable. 'disconnected' interrupt (DISCONNINT) might
>> look a bit more suitable for this event, but it is asserted only in
>> host mode, so in device mode we need to use something else.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>> ---
>>   drivers/usb/dwc2/gadget.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>> index 7b5856fadd93..119c8a3effc2 100644
>> --- a/drivers/usb/dwc2/gadget.c
>> +++ b/drivers/usb/dwc2/gadget.c
>> @@ -2279,6 +2279,12 @@ irq_retry:
>>   		dev_info(hsotg->dev, "OTGInt: %08x\n", otgint);
>>
>>   		writel(otgint, hsotg->regs + GOTGINT);
>> +
>> +		if (otgint & GOTGINT_SES_END_DET) {
>> +			if (hsotg->gadget.speed != USB_SPEED_UNKNOWN)
>> +				s3c_hsotg_disconnect(hsotg);
>> +			hsotg->gadget.speed = USB_SPEED_UNKNOWN;
>> +		}
>>   	}
>>
>>   	if (gintsts & GINTSTS_SESSREQINT) {
> Does this mean we can get rid of the call to s3c_hsotg_disconnect in
> s3c_hsotg_process_control after a SET_ADDRESS is received? If not,
> then s3c_hsotg_disconnect will be called twice, once here after the
> disconnect, and once again after the reconnect and SET_ADDRESS.

Nope, we cannot get rid of that call, because it is needed got get gadget
operational when device has been re-enumerated. The simplest way to 
reproduce
such case is to connect dwc2 to externally powered hub and then unplug cable
between hub and usb host. In such case the 'end session' interrupt is not
asserted, so the additional s3c_hsotg_disconnect() call before setting new
address is needed. I will rework this patch and add a code to ensures that
the gadget->disconnect() will be called only once.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

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

  parent reply	other threads:[~2014-10-31  7:45 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 10:45 [PATCH v2 00/10] more dwc2/gadget fixes Marek Szyprowski
2014-10-20 10:45 ` [PATCH v2 01/10] usb: dwc2/gadget: report disconnect event from 'end session' irq Marek Szyprowski
     [not found]   ` <1413801940-31086-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-25  1:23     ` Paul Zimmerman
     [not found]       ` <A2CA0424C0A6F04399FB9E1CD98E0304844E5C19-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>
2014-10-31  7:45         ` Marek Szyprowski [this message]
2014-10-31  8:04   ` [PATCH v3] " Marek Szyprowski
2014-10-31 18:15     ` Paul Zimmerman
2014-11-13 13:39       ` Marek Szyprowski
     [not found]         ` <5464B496.9010000-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-13 20:50           ` Paul Zimmerman
2014-11-14 10:31             ` Marek Szyprowski
2014-11-14 12:00             ` Marek Szyprowski
     [not found]               ` <5465EEF3.7060902-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-14 12:20                 ` [PATCH v4] usb: dwc2/gadget: rework disconnect event handling Marek Szyprowski
     [not found]                   ` <1415967607-6174-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-14 19:01                     ` Paul Zimmerman
2014-11-14 19:04                       ` Felipe Balbi
2014-11-14 21:21                         ` Paul Zimmerman
2014-11-14 22:09                         ` Paul Zimmerman
2014-11-17  6:27                           ` Marek Szyprowski
2014-11-17  8:59                             ` [PATCH v5] " Marek Szyprowski
     [not found]                               ` <1416214782-13911-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-18 20:56                                 ` Paul Zimmerman
2014-11-20 19:53                               ` Felipe Balbi
     [not found] ` <1413801940-31086-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-20 10:45   ` [PATCH v2 02/10] usb: dwc2/gadget: fix enumeration issues Marek Szyprowski
     [not found]     ` <1413801940-31086-3-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-25  0:21       ` Paul Zimmerman
2014-10-20 10:45   ` [PATCH v2 03/10] usb: dwc2/gadget: fix gadget unregistration in udc_stop() function Marek Szyprowski
     [not found]     ` <1413801940-31086-4-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-23 15:01       ` Felipe Balbi
2014-10-23 18:18         ` Paul Zimmerman
     [not found]           ` <A2CA0424C0A6F04399FB9E1CD98E0304844E5483-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>
2014-10-23 18:56             ` Felipe Balbi
2014-10-20 10:45   ` [PATCH v2 04/10] usb: dwc2/gadget: disable phy before turning off power regulators Marek Szyprowski
     [not found]     ` <1413801940-31086-5-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-23 15:01       ` Felipe Balbi
2014-10-23 18:15         ` Paul Zimmerman
2014-10-23 18:58           ` Felipe Balbi
2014-10-20 10:45   ` [PATCH v2 06/10] usb: dwc2/gadget: decouple setting soft-disconnect from s3c_hsotg_core_init Marek Szyprowski
2014-10-25  0:35     ` Paul Zimmerman
2014-10-27 13:52       ` Marek Szyprowski
2014-10-20 10:45   ` [PATCH v2 09/10] usb: dwc2/gadget: fix calls to phy control functions in suspend/resume code Marek Szyprowski
2014-10-25  0:45     ` Paul Zimmerman
2014-10-20 10:45   ` [PATCH v2 10/10] usb: dwc2/gadget: rework suspend/resume code to correctly restore gadget state Marek Szyprowski
2014-10-25  1:16     ` Paul Zimmerman
2014-10-27  7:18       ` Marek Szyprowski
2014-10-31 10:08         ` Marek Szyprowski
2014-10-31 10:12           ` [PATCH v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls Marek Szyprowski
2014-10-31 10:12             ` [PATCH v3 2/2] usb: dwc2/gadget: rework suspend/resume code to correctly restore gadget state Marek Szyprowski
2014-10-31 18:46             ` [PATCH v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls Paul Zimmerman
     [not found]               ` <A2CA0424C0A6F04399FB9E1CD98E0304844E7FDD-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>
2014-11-13 15:17                 ` Marek Szyprowski
2014-11-13 20:55                   ` Paul Zimmerman
2014-11-14  9:19                     ` Marek Szyprowski
2014-11-14 19:43                       ` Paul Zimmerman
2014-11-14 19:51                         ` Felipe Balbi
     [not found]             ` <1414750354-19571-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-18 21:00               ` Paul Zimmerman
2014-11-20 19:53             ` Felipe Balbi
2014-10-20 10:45 ` [PATCH v2 05/10] usb: dwc2/gadget: move setting last reset time to s3c_hsotg_core_init Marek Szyprowski
     [not found]   ` <1413801940-31086-6-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-25  0:23     ` Paul Zimmerman
2014-10-20 10:45 ` [PATCH v2 07/10] usb: dwc2/gadget: move phy control calls out of pullup() method Marek Szyprowski
2014-10-25  0:36   ` Paul Zimmerman
2014-10-20 10:45 ` [PATCH v2 08/10] usb: dwc2/gadget: use soft-disconnect udc feature in " Marek Szyprowski
2014-10-25  0:43   ` Paul Zimmerman

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=54533E36.6070203@samsung.com \
    --to=m.szyprowski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=Paul.Zimmerman-HKixBCOQz3hWk0Htik3J/w@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.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.