From: Pavel Hofman <pavel.hofman@ivitera.com>
To: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: usb: dwc2: Detecting cable disconnection in OTG mode?
Date: Sat, 11 Dec 2021 10:59:32 +0100 [thread overview]
Message-ID: <ace0e7e0-bf55-e2e4-a17f-c411de8a5266@ivitera.com> (raw)
In-Reply-To: <7cce9f05-d659-1fe8-2862-aeca75693808@ivitera.com>
Dne 11. 12. 21 v 10:55 Pavel Hofman napsal(a):
> Hi Minas,
>
> I am trying to find if dwc2 in OTG mode can pass information to gadget
> functions that the host has been disconnected. I am testing on RPi4. In
> a datasheet for a different dwc2 implementation
> https://www.mouser.cn/datasheet/2/196/Infineon-xmc4500_rm_v1.6_2016-UM-v01_06-EN-598157.pdf
> - chapter "16.8.3 Device Disconnection" I found:
>
>
> ===========
> The device session ends when the USB cable is disconnected or if the
> VBUS is switched off by the host.
> The device disconnect flow is as follows:
>
> 1. When the USB cable is unplugged or when the VBUS is switched off by
> the host, the device core triggers GINTSTS.OTGInt [bit 2] interrupt bit
> ============
>
> I put a printk to core_intr.c:dwc2_handle_otg_intr() which is called
> only from handling the OTGInt interrupt
> https://elixir.bootlin.com/linux/v5.1.9/source/drivers/usb/dwc2/core_intr.c#L803
> . But this method is not called at all when disconnecting the USB cable
> on RPi4 in gadget mode.
>
To add, the method dwc2_hsotg_disconnect is called, but after
reconnecting the cable, as part of the gadget reset when handling
reset interrupts (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) here
https://elixir.bootlin.com/linux/v5.1.9/source/drivers/usb/dwc2/gadget.c#L3653
Thanks a lot,
Pavel.
next prev parent reply other threads:[~2021-12-11 9:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-11 9:55 usb: dwc2: Detecting cable disconnection in OTG mode? Pavel Hofman
2021-12-11 9:59 ` Pavel Hofman [this message]
2021-12-12 13:47 ` Pavel Hofman
2021-12-13 10:58 ` Minas Harutyunyan
2021-12-13 13:38 ` Pavel Hofman
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=ace0e7e0-bf55-e2e4-a17f-c411de8a5266@ivitera.com \
--to=pavel.hofman@ivitera.com \
--cc=Minas.Harutyunyan@synopsys.com \
--cc=linux-usb@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox