diff mbox

[U-Boot,2/2] udc: dfu: s3c_udc: Provide function to check if USB reset was asserted

Message ID 1408716505-9013-2-git-send-email-l.majewski@samsung.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Ɓukasz Majewski Aug. 22, 2014, 2:08 p.m. UTC
New dfu_usb_get_reset() method is necessary to distinct two different
use cases of dfu-util program.
This method checks if the USB bus reset has been really performed after
DFU DETACH.

Without this function the previous DFU behavior is preserved.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
---
 drivers/usb/gadget/s3c_udc_otg.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stephen Warren Aug. 22, 2014, 6:06 p.m. UTC | #1
On 08/22/2014 08:08 AM, Lukasz Majewski wrote:
> New dfu_usb_get_reset() method is necessary to distinct two different
> use cases of dfu-util program.
> This method checks if the USB bus reset has been really performed after
> DFU DETACH.
>
> Without this function the previous DFU behavior is preserved.

Do you have HW that uses ci_udc, so you could implement/test this there 
too? If not, let me know and I'll see if I can.
Lukasz Majewski Aug. 22, 2014, 7:57 p.m. UTC | #2
On Fri, 22 Aug 2014 12:06:49 -0600
Stephen Warren <swarren@wwwdotorg.org> wrote:

> 
> On 08/22/2014 08:08 AM, Lukasz Majewski wrote:
> > New dfu_usb_get_reset() method is necessary to distinct two
> > different use cases of dfu-util program.
> > This method checks if the USB bus reset has been really performed
> > after DFU DETACH.
> >
> > Without this function the previous DFU behavior is preserved.
> 
> Do you have HW that uses ci_udc, so you could implement/test this
> there too? If not, let me know and I'll see if I can.

Unfortunately I'm using s3c_hsotg UDC. The function which you need only
must return true if your's UDC has detected USB bus reset (enforced by
dfu-util with -R switch).

Best regards,
Lukasz
diff mbox

Patch

diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 63d4487..ce2494c 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -149,6 +149,11 @@  struct s3c_usbotg_reg *reg;
 struct s3c_usbotg_phy *phy;
 static unsigned int usb_phy_ctrl;
 
+bool dfu_usb_get_reset(void)
+{
+	return !!(readl(&reg->gintsts) & INT_RESET);
+}
+
 void otg_phy_init(struct s3c_udc *dev)
 {
 	dev->pdata->phy_control(1);