Re: [linux-sunxi] Re: [PATCH 1/4] phy: sun4i-usb: support PHY0 on H3 in MUSB mode

From: Karsten Merker
Date: Thu Jan 19 2017 - 15:40:25 EST


On Thu, Jan 19, 2017 at 11:10:08PM +0800, Icenowy Zheng wrote:
> 19.01.2017, 22:34, "Maxime Ripard" <maxime.ripard@xxxxxxxxxxxxxxxxxx>:
> > On Wed, Jan 18, 2017 at 04:09:32AM +0800, Chen-Yu Tsai wrote:
> >> ÂOn Wed, Jan 18, 2017 at 4:06 AM, Maxime Ripard
> >> Â<maxime.ripard@xxxxxxxxxxxxxxxxxx> wrote:
> >> Â> On Wed, Jan 18, 2017 at 12:57:08AM +0800, Icenowy Zheng wrote:
> >> Â>> 17.01.2017, 16:06, "Maxime Ripard" <maxime.ripard@xxxxxxxxxxxxxxxxxx>:
> >> Â>> > On Tue, Jan 17, 2017 at 03:14:46AM +0800, Icenowy Zheng wrote:
> >> Â>> >> The PHY0 on H3 can be wired either to MUSB controller or OHCI/EHCI
> >> Â>> >> controller.
> >> Â>> >>
> >> Â>> >> The original driver wired it to OHCI/EHCI controller; however, as the
> >> Â>> >> code to use PHY0 as OHCI/EHCI is missing, it makes the PHY fully
> >> Â>> >> unusable.
> >> Â>> >>
> >> Â>> >> Rename the register (according to its function and the name in BSP
> >> Â>> >> driver), and remove the code which wires the PHY0 to OHCI/EHCI, as MUSB
> >> Â>> >> can support both peripheral and host mode (although the host mode of
> >> Â>> >> MUSB is buggy).
> >> Â>> >
> >> Â>> > Can you elaborate on that? What's wrong with it?
> >> Â>>
> >> Â>> The configuration is at bit 0 of register 0x20 in PHY.
> >> Â>>
> >> Â>> When the PHY is reseted, it defaults as MUSB mode.
> >> Â>>
> >> Â>> However, the original author of the H3 PHY code seems to be lack of
> >> Â>> this knowledge (He named it PHY_UNK_H3), and changed the PHY to HCI
> >> Â>> mode.
> >> Â>>
> >> Â>> I just removed the code that wires it to HCI mode, thus it will work
> >> Â>> in MUSB mode, with my sun8i-h3-musb patch.
> >> Â>
> >> Â> I have no idea what you mean by MUSB mode.
> >> Â>
> >> Â> Do you mean that the previous code was only working in host mode, and
> >> Â> now it only works in peripheral?
> >>
> >> ÂFrom what I understand, with the H3, Allwinner has put a mux
> >> Âin front of the MUSB controller. The mux can send the USB data
> >> Âto/from the MUSB controller, or a standard EHCI/OHCI pair.
> >> ÂThis register controls said mux.
> >>
> >> ÂThis means we can use a proper USB host for host mode,
> >> Âinstead of the limited support in MUSB.
> >
> > But musb can still operate as a host, right?
>
> Yes!

Hello,

I don't know how the MUSB implementation in the H3 behaves as I
don't have any H3-based systems, but if it should happen to be
similar to the one in the A31s, it probably isn't a full-fledged
alternative to using an OHCI/EHCI controller.

>From my practical experiments with the MUSB in the A31s in host
mode I can report that I hadn't been able to get multiple HIDs
(in my case keyboard and mouse) working at the same time. The
keyboard alone worked without problems, the mouse alone worked
without problems, but when both were connected, only one of them
worked.

I had at that time talked to Hans de Goede about the problem and
if I remenber correctly, he had mentioned that the MUSB has
problems servicing more than one device that does interrupt
transfers (as HIDs do).

Hans, can you perhaps shed some light on this?

Regards,
Karsten
--
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten fÃr Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.