diff mbox series

sunxi: USB gadget does not work on H2+ after 92a30692b2b18f45aae6fdaae38d67ed03dd2d11

Message ID CAEXMXLTm9bhX7aAub+MaZGBdw2cCsoO3nE6ep7dbm8mMryaQeg@mail.gmail.com
State New
Headers show
Series sunxi: USB gadget does not work on H2+ after 92a30692b2b18f45aae6fdaae38d67ed03dd2d11 | expand

Commit Message

Nuno Gonçalves Aug. 13, 2018, 10:29 a.m. UTC
After this commit usb gadget does not work anymore for me on the Orange Pi
Zero (H2+).

Thanks,
Nuno

commit 92a30692b2b18f45aae6fdaae38d67ed03dd2d11
Author: Jagan Teki <jagan@amarulasolutions.com>
Date:   Fri Jul 20 12:34:20 2018 +0530

    phy: sun4i-usb: Call phy_passby even for PHY#0

    On newer Allwinner SoC, there is a pair of EHCI/OHCI USB hosts
    for OTG host mode. USB PHY passby must be configured for its
    corresponding PHY. so we can call for PHY#0. on the other hand
    in past usb-phy code the same thing can be restricted for
    Lower SoC's, other than H3/H5/A64.

    Now there is no need to restrict usb passby since the phy driver
    is DT enabled, and the respective phy calls will trigger based
    DT information initiated by the drivers.

    Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
    Tested-by: Jagan Teki <jagan@amarulasolutions.com>

Comments

Jagan Teki Aug. 17, 2018, 11:38 a.m. UTC | #1
On Mon, Aug 13, 2018 at 3:59 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> After this commit usb gadget does not work anymore for me on the Orange Pi
> Zero (H2+).

Please send log or full information?

Jagan.
Nuno Gonçalves Aug. 17, 2018, 12:02 p.m. UTC | #2
This test is on 2018.09-rc2 with UMS enabled.

With your patch, I get this dmesg on the host:

[20121.718226] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
[20122.578151] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
[20122.578320] usb 1-4-port4: attempt power cycle
[20123.750104] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
[20124.602034] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
[20124.602190] usb 1-4-port4: unable to enumerate USB device

u-boot console is the same, including loading the gadget:

Allwinner mUSB OTG (Peripheral)

If you tell me how you tested USB Gadget to work, I will reproduce your
test locally to confirm the issue.

Thanks,
Nuno


On Fri, Aug 17, 2018 at 1:38 PM Jagan Teki <jagan@amarulasolutions.com>
wrote:

> On Mon, Aug 13, 2018 at 3:59 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> > After this commit usb gadget does not work anymore for me on the Orange
> Pi
> > Zero (H2+).
>
> Please send log or full information?
>
> Jagan.
>
Nuno Gonçalves Aug. 17, 2018, 12:19 p.m. UTC | #3
This can be because UMS is not DM aware?

On Fri, Aug 17, 2018 at 2:02 PM Nuno Gonçalves <nunojpg@gmail.com> wrote:

> This test is on 2018.09-rc2 with UMS enabled.
>
> With your patch, I get this dmesg on the host:
>
> [20121.718226] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
> [20122.578151] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
> [20122.578320] usb 1-4-port4: attempt power cycle
> [20123.750104] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
> [20124.602034] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
> [20124.602190] usb 1-4-port4: unable to enumerate USB device
>
> u-boot console is the same, including loading the gadget:
>
> Allwinner mUSB OTG (Peripheral)
>
> If you tell me how you tested USB Gadget to work, I will reproduce your
> test locally to confirm the issue.
>
> Thanks,
> Nuno
>
>
> On Fri, Aug 17, 2018 at 1:38 PM Jagan Teki <jagan@amarulasolutions.com>
> wrote:
>
>> On Mon, Aug 13, 2018 at 3:59 PM, Nuno Gonçalves <nunojpg@gmail.com>
>> wrote:
>> > After this commit usb gadget does not work anymore for me on the Orange
>> Pi
>> > Zero (H2+).
>>
>> Please send log or full information?
>>
>> Jagan.
>>
>
Jagan Teki Aug. 18, 2018, 11:41 a.m. UTC | #4
On Fri, Aug 17, 2018 at 5:49 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> This can be because UMS is not DM aware?
>
> On Fri, Aug 17, 2018 at 2:02 PM Nuno Gonçalves <nunojpg@gmail.com> wrote:
>>
>> This test is on 2018.09-rc2 with UMS enabled.
>>
>> With your patch, I get this dmesg on the host:
>>
>> [20121.718226] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
>> [20122.578151] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
>> [20122.578320] usb 1-4-port4: attempt power cycle
>> [20123.750104] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
>> [20124.602034] usb 1-4-port4: Cannot enable. Maybe the USB cable is bad?
>> [20124.602190] usb 1-4-port4: unable to enumerate USB device
>>
>> u-boot console is the same, including loading the gadget:
>>
>> Allwinner mUSB OTG (Peripheral)
>>
>> If you tell me how you tested USB Gadget to work, I will reproduce your
>> test locally to confirm the issue.

Here is the steps with UMS on BPI-M2+ which is H3 board (USB is similar to H2+)

on target:
=> mmc list
SUNXI SD/MMC: 0
SUNXI SD/MMC: 1 (eMMC)
=> mmc dev 1
switch to partitions #0, OK
mmc1(part 0) is current device
=> ums 0 mmc 1
UMS: LUN 0, dev 1, hwpart 0, sector 0x0, count 0xe90000
\musb-hdrc: peripheral reset irq lost!

on host:
$ sudo dmesg
[25593.969620] usb 1-1: new high-speed USB device number 7 using xhci_hcd
[25594.118084] usb 1-1: New USB device found, idVendor=1f3a, idProduct=1010
[25594.118092] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[25594.118097] usb 1-1: Product: USB download gadget
[25594.118102] usb 1-1: Manufacturer: Allwinner Technology
[25594.118107] usb 1-1: SerialNumber: 02c0008196cc4467
[25594.159273] usb-storage 1-1:1.0: USB Mass Storage device detected

fastboot also look fine.

Jagan.
Nuno Gonçalves Aug. 18, 2018, 12:31 p.m. UTC | #5
On Sat, Aug 18, 2018 at 1:41 PM Jagan Teki <jagan@amarulasolutions.com>
wrote:

> Here is the steps with UMS on BPI-M2+ which is H3 board (USB is similar to
> H2+)
>

What defconfig are you using for this test?

Thanks!
Jagan Teki Aug. 18, 2018, 4:29 p.m. UTC | #6
On Sat, Aug 18, 2018 at 6:01 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
>
>
> On Sat, Aug 18, 2018 at 1:41 PM Jagan Teki <jagan@amarulasolutions.com>
> wrote:
>>
>> Here is the steps with UMS on BPI-M2+ which is H3 board (USB is similar to
>> H2+)

See the board I've mentioned, it's Sinovoip_BPI_M2_Plus_defconfig
Nuno Gonçalves Aug. 18, 2018, 4:35 p.m. UTC | #7
On Sat, Aug 18, 2018 at 6:29 PM Jagan Teki <jagan@amarulasolutions.com>
wrote:

> See the board I've mentioned, it's Sinovoip_BPI_M2_Plus_defconfig
>

That is the reason I asked, since that defconfig does not
have CONFIG_CMD_USB_MASS_STORAGE. Your test is done with something else.
Jagan Teki Aug. 18, 2018, 5:42 p.m. UTC | #8
On Sat, Aug 18, 2018 at 10:05 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> On Sat, Aug 18, 2018 at 6:29 PM Jagan Teki <jagan@amarulasolutions.com>
> wrote:
>>
>> See the board I've mentioned, it's Sinovoip_BPI_M2_Plus_defconfig
>
>
> That is the reason I asked, since that defconfig does not have
> CONFIG_CMD_USB_MASS_STORAGE. Your test is done with something else.

We, sunxi treated this CONFIG as user defined, not giving room to add
it on defconfig. I enabled via menuconfig.
Nuno Gonçalves Aug. 18, 2018, 6:05 p.m. UTC | #9
With the basic defconfig + CMD_USB_MASS_STORAGE, I don't get the driver to load:

Controller uninitialized
g_dnl_register: failed!, error: -6
g_dnl_register failed

I just would like to confirm you have nothing else added...

Thanks!
On Sat, Aug 18, 2018 at 7:42 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Sat, Aug 18, 2018 at 10:05 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> > On Sat, Aug 18, 2018 at 6:29 PM Jagan Teki <jagan@amarulasolutions.com>
> > wrote:
> >>
> >> See the board I've mentioned, it's Sinovoip_BPI_M2_Plus_defconfig
> >
> >
> > That is the reason I asked, since that defconfig does not have
> > CONFIG_CMD_USB_MASS_STORAGE. Your test is done with something else.
>
> We, sunxi treated this CONFIG as user defined, not giving room to add
> it on defconfig. I enabled via menuconfig.
Jagan Teki Aug. 18, 2018, 6:08 p.m. UTC | #10
On Sat, Aug 18, 2018 at 11:35 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> With the basic defconfig + CMD_USB_MASS_STORAGE, I don't get the driver to load:
>
> Controller uninitialized
> g_dnl_register: failed!, error: -6
> g_dnl_register failed

Are you using mainline? is your defconfig has MUSB? try to see
existing H3 defconfigs for reference.
Nuno Gonçalves Aug. 20, 2018, 7:59 a.m. UTC | #11
On Sat, Aug 18, 2018 at 8:08 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Sat, Aug 18, 2018 at 11:35 PM, Nuno Gonçalves <nunojpg@gmail.com> wrote:
> > With the basic defconfig + CMD_USB_MASS_STORAGE, I don't get the driver to load:
> >
> > Controller uninitialized
> > g_dnl_register: failed!, error: -6
> > g_dnl_register failed

This error appears when CONFIG_USB_ETHER is not set. For some reason I
can't enable UMS without USB_ETHER (probably because UMS is not DM
aware).

Regarding the bug reported, it happens because after your commit
USB_EHCI_HCD and USB_KEYBOARD are required to be set.

So, with USB_ETHER, USB_KEYBOARD and USB_EHCI_HCD, it works. Except
for the last not sure if this is as expected.

Thanks,
Nuno
diff mbox series

Patch

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
b/drivers/phy/allwinner/phy-sun4i-usb.c
index 2b3cf48025..01f585a283 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -300,8 +300,7 @@  static int sun4i_usb_phy_init(struct phy *phy)
                                    data->cfg->disc_thresh,
PHY_DISCON_TH_LEN);
        }

-       if (usb_phy->id != 0)
-               sun4i_usb_phy_passby(phy, true);
+       sun4i_usb_phy_passby(phy, true);

        sun4i_usb_phy0_reroute(data, true);