public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Paul Kocialkowski <contact@paulk.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/2] sunxi: musb: Fix "usb reset" handling
Date: Mon, 15 Jun 2015 21:21:46 +0200	[thread overview]
Message-ID: <1434396106.2324.53.camel@collins> (raw)
In-Reply-To: <1434278413-21157-1-git-send-email-hdegoede@redhat.com>

Le dimanche 14 juin 2015 ? 12:40 +0200, Hans de Goede a ?crit :
> Hi Ian, Paul,
> 
> Here is a patch to fix the problems where most usb devices will no longer
> work after a "usb reset ", when connected to the otg controller in host
> mode + a related cleanup patch.

This works fine for an USB storage device and an USB2 keyboard but does
not work with an USB1 keyboard, with error:

sunxi# usb reset
resetting USB...
USB0:   scanning bus 0 for devices... USB device descriptor short read
(expected 8, got 0)
No USB Device found

> Paul, can you test these with gadget mode? Specifically if they help the
> problem you were seeing when switching roles?

It doesn't fix the problem as-is, I still get enumerating problems from
the host. Also, note that musb_stop is not called from the gadget code,
so sunxi_musb_disable (musb_platform_disable) is not called either. I
had to add a dirty call in usb_gadget_unregister_driver to test the
code.

> Also this bit from the kernel code for the sunxi glue may be relevant
> to your problems:
> 
>         if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
>                 /* ep0 FADDR must be 0 when (re)entering peripheral mode */
>                 musb_ep_select(musb->mregs, 0);
>                 musb_writeb(musb->mregs, MUSB_FADDR, 0);
>         }
> 
> This is from the interrupt handler in the sunxi-musb glue in the kernel,
> maybe we can do the same, and/or maybe we need to do:
> 
> 	/* ep0 FADDR must be 0 when (re)entering peripheral mode */
> 	musb_ep_select(musb->mregs, 0);
> 	musb_writeb(musb->mregs, MUSB_FADDR, 0);
> 
> From sunxi_musb_disable?

Thanks for those pointers, I'll try to look into that when I have time
to properly debug the issue.

> From my experience sofar we should avoid doing a full reset from musb_stop /
> sunxi_musb_disable as musb_init_controller never gets re-run, so doing a
> full reset leaves things in a bad state where only ep0 still seems to work,
> this may be what you were seeing before.

That makes sense, but what is done currently doesn't seem to be enough
to bring everything back up. Hopefully, setting the EP0 FADDR will help.

Thanks a lot for your work, as usual!

-- 
Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.

Website: http://www.replicant.us/
Blog: http://blog.replicant.us/
Wiki/tracker/forums: http://redmine.replicant.us/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150615/20439ba4/attachment.sig>

  parent reply	other threads:[~2015-06-15 19:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-14 10:40 [U-Boot] [PATCH 0/2] sunxi: musb: Fix "usb reset" handling Hans de Goede
2015-06-14 10:40 ` [U-Boot] [PATCH 1/2] sunxi: musb: Do not fully reset the controler from sunxi_musb_disable Hans de Goede
2015-06-14 11:46   ` Ian Campbell
2015-06-14 17:21     ` Hans de Goede
2015-06-14 10:40 ` [U-Boot] [PATCH 2/2] sunxi: musb: Remove unused sunxi_musb_exit method Hans de Goede
2015-06-14 11:47   ` Ian Campbell
2015-06-15 19:21 ` Paul Kocialkowski [this message]
2015-06-17 13:39   ` [U-Boot] [PATCH 0/2] sunxi: musb: Fix "usb reset" handling Hans de Goede
2015-06-19  9:11     ` Paul Kocialkowski
2015-06-19 12:35 ` Marek Vasut
2015-06-19 13:07   ` Hans de Goede
2015-06-19 13:08     ` Marek Vasut
2015-06-26 10:20 ` Maxime Ripard
2015-06-26 11:01   ` Hans de Goede
2015-06-28 20:42     ` Maxime Ripard
2015-06-26 11:02   ` Hans de Goede
2015-06-26 11:11     ` Maxime Ripard

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=1434396106.2324.53.camel@collins \
    --to=contact@paulk.fr \
    --cc=u-boot@lists.denx.de \
    /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