mbox series

[RFCv1,0/3] Odroid c1+ usb fixs

Message ID 20190123151209.2080-1-linux.amoon@gmail.com (mailing list archive)
Headers show
Series Odroid c1+ usb fixs | expand

Message

Anand Moon Jan. 23, 2019, 3:12 p.m. UTC
This is follow up on my previous patches.

[0] https://lore.kernel.org/patchwork/patch/1031616/
[1] https://lore.kernel.org/patchwork/patch/1031617/

As per Martin's suggestion and input I have tried to fix below issue.

Fixed the phy power issue on the usb port.
# cat /sys/kernel/debug/regulator/regulator_summary
    USB_VBUS                      4    2      0 unknown  5000mV     0mA  5000mV  5000mV
       phy-c1108820.phy.1         2                                 0mA     0mV     0mV
       phy-c1108800.phy.0         2                                 0mA     0mV     0mV

Fixed the OTG phy warning and initilizaion of usb0_phy 
# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
        |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
        |__ Port 3: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 4, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 4, If 3, Class=Audio, Driver=snd-usb-audio, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
 
Now hotpluing of usb device is working on odroid c1+ boards.
TODO: need to initialize the otg usb port to accept usb device.

Any input are welcome 

Best Regards
-Anand

Anand Moon (3):
  phy: meson8b-usb2: Enable otg phy controller on Meson8b SoCs
  ARM: dts: meson8b: odroidc1: fix USB power supplies for phy
  ARM: dts: meson8b: odroidc1: enable the OTG capable USB controller

 arch/arm/boot/dts/meson8b-odroidc1.dts | 27 ++++++++++++++++++++++++++
 drivers/phy/amlogic/phy-meson8b-usb2.c | 15 ++++++++++++++
 2 files changed, 42 insertions(+)

Comments

Martin Blumenstingl Feb. 4, 2019, 1:51 p.m. UTC | #1
Hi Anand,

On Wed, Jan 23, 2019 at 4:12 PM Anand Moon <linux.amoon@gmail.com> wrote:
>
> This is follow up on my previous patches.
>
> [0] https://lore.kernel.org/patchwork/patch/1031616/
> [1] https://lore.kernel.org/patchwork/patch/1031617/
>
> As per Martin's suggestion and input I have tried to fix below issue.
>
> Fixed the phy power issue on the usb port.
> # cat /sys/kernel/debug/regulator/regulator_summary
>     USB_VBUS                      4    2      0 unknown  5000mV     0mA  5000mV  5000mV
>        phy-c1108820.phy.1         2                                 0mA     0mV     0mV
>        phy-c1108800.phy.0         2                                 0mA     0mV     0mV
>
> Fixed the OTG phy warning and initilizaion of usb0_phy
> # lsusb -t
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
>     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
>         |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
>         |__ Port 3: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
>         |__ Port 3: Dev 4, If 2, Class=Audio, Driver=snd-usb-audio, 480M
>         |__ Port 3: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
>         |__ Port 3: Dev 4, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
>
> Now hotpluing of usb device is working on odroid c1+ boards.
unfortunately it's still not working for me :(

all following descriptions are seen when looking at the PCB with the
40-pin connector on the bottom, USB ports on the left, micro USB
connector on the top right.

my test-case is:
- power-cycle the board
- enter u-boot command prompt
- gset GPIOAO_5 out high (or replace high with low)
- measure

I checked the voltage at RT9715EGB (U19) with a volt meter:
GPIOAO_5 HIGH:
- EN pin (bottom, left): 3.3V
- VOUT pin (top right): 5V
GPIOAO_5 LOW:
- EN pin (bottom, left). 0V
- VOUT pin (top right): 5V (not sure why...)

I also checked the voltage at Q5 2N7002W with a volt meter:
- gate (bottom, right): 0V
- source (top, right): 3.3V
- drain (left): 0V
this is always the same, regardless of whether GPIOAO_5 is HIGH or LOW.
however, with Armbian booted (which uses some Amlogic 3.10 kernel
where USB works) I get:
- gate (bottom, right): 0V
- source (top, right): 0V
- drain (left): 3.3V

what do you get on your board?


Regards
Martin
Anand Moon Feb. 4, 2019, 8:04 p.m. UTC | #2
Hi Martin,

On Mon, 4 Feb 2019 at 19:21, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Wed, Jan 23, 2019 at 4:12 PM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > This is follow up on my previous patches.
> >
> > [0] https://lore.kernel.org/patchwork/patch/1031616/
> > [1] https://lore.kernel.org/patchwork/patch/1031617/
> >
> > As per Martin's suggestion and input I have tried to fix below issue.
> >
> > Fixed the phy power issue on the usb port.
> > # cat /sys/kernel/debug/regulator/regulator_summary
> >     USB_VBUS                      4    2      0 unknown  5000mV     0mA  5000mV  5000mV
> >        phy-c1108820.phy.1         2                                 0mA     0mV     0mV
> >        phy-c1108800.phy.0         2                                 0mA     0mV     0mV
> >
> > Fixed the OTG phy warning and initilizaion of usb0_phy
> > # lsusb -t
> > /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
> >     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
> >         |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
> >         |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
> >         |__ Port 3: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
> >         |__ Port 3: Dev 4, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> >         |__ Port 3: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
> >         |__ Port 3: Dev 4, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> > /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
> >
> > Now hotpluing of usb device is working on odroid c1+ boards.
> unfortunately it's still not working for me :(
>
> all following descriptions are seen when looking at the PCB with the
> 40-pin connector on the bottom, USB ports on the left, micro USB
> connector on the top right.
>
> my test-case is:
> - power-cycle the board
> - enter u-boot command prompt
> - gset GPIOAO_5 out high (or replace high with low)
> - measure
>
> I checked the voltage at RT9715EGB (U19) with a volt meter:
> GPIOAO_5 HIGH:
> - EN pin (bottom, left): 3.3V
> - VOUT pin (top right): 5V
> GPIOAO_5 LOW:
> - EN pin (bottom, left). 0V
> - VOUT pin (top right): 5V (not sure why...)
>
> I also checked the voltage at Q5 2N7002W with a volt meter:
> - gate (bottom, right): 0V
> - source (top, right): 3.3V
> - drain (left): 0V
> this is always the same, regardless of whether GPIOAO_5 is HIGH or LOW.
> however, with Armbian booted (which uses some Amlogic 3.10 kernel
> where USB works) I get:
> - gate (bottom, right): 0V
> - source (top, right): 0V
> - drain (left): 3.3V
>
> what do you get on your board?
>
I dont have multi-meter to check this out on old and new kernel.
As per my observation Amlogic 3.10 (32 bit) and 3.14 (64 bit)
both use some state machine the tune the usb port.

It's not clear that this will work with upstream kernel.

I just checked with board booted with usb device connected we are observing
the bus and is getting power up and hot plugging of usb device is working fine.

$ lsusb -v|egrep "^Bus|MaxPower"
Couldn't open device, some information will be missing
Bus 002 Device 003: ID 1b71:0056 Fushicai
    MaxPower              500mA
Couldn't open device, some information will be missing
Bus 002 Device 004: ID 152d:0578 JMicron Technology Corp. / JMicron
USA Technology Corp. JMS567 SATA 6Gb/s bridge
    MaxPower               30mA
Couldn't open device, some information will be missing
Couldn't open device, some information will be missing
Bus 002 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
    MaxPower              100mA
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Couldn't open device, some information will be missing
    MaxPower                0mA
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA

>
> Regards
> Martin

Best Regards

-Anand
Martin Blumenstingl Feb. 4, 2019, 8:38 p.m. UTC | #3
Hi Anand,

On Mon, Feb 4, 2019 at 9:04 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> I dont have multi-meter to check this out on old and new kernel.
> As per my observation Amlogic 3.10 (32 bit) and 3.14 (64 bit)
> both use some state machine the tune the usb port.
>
> It's not clear that this will work with upstream kernel.
do you have a filename / line number in Amlogic's kernel regarding
this state machine and / or tuning logic?

> I just checked with board booted with usb device connected we are observing
> the bus and is getting power up and hot plugging of usb device is working fine.
>
> $ lsusb -v|egrep "^Bus|MaxPower"
> Couldn't open device, some information will be missing
> Bus 002 Device 003: ID 1b71:0056 Fushicai
>     MaxPower              500mA
> Couldn't open device, some information will be missing
> Bus 002 Device 004: ID 152d:0578 JMicron Technology Corp. / JMicron
> USA Technology Corp. JMS567 SATA 6Gb/s bridge
>     MaxPower               30mA
> Couldn't open device, some information will be missing
> Couldn't open device, some information will be missing
> Bus 002 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
>     MaxPower              100mA
> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Couldn't open device, some information will be missing
>     MaxPower                0mA
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>     MaxPower                0mA
for me it stops at the Genesys Logic, Inc. 4-port hub (I see the root
hub, the 4-port hub and then nothing more) using the mainline kernel
(with or without your patches)

I'm not sure what to do with this information though.
currently we have no reliable way to tell if GPIOAO_5 is only for the
OTG port (usb0) or also for the host-only port (usb1).


Regards
Martin
Anand Moon Feb. 5, 2019, 7:53 p.m. UTC | #4
Hi Martin,

On Tue, 5 Feb 2019 at 02:08, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Mon, Feb 4, 2019 at 9:04 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > I dont have multi-meter to check this out on old and new kernel.
> > As per my observation Amlogic 3.10 (32 bit) and 3.14 (64 bit)
> > both use some state machine the tune the usb port.
> >
> > It's not clear that this will work with upstream kernel.
> do you have a filename / line number in Amlogic's kernel regarding
> this state machine and / or tuning logic?
>
> > I just checked with board booted with usb device connected we are observing
> > the bus and is getting power up and hot plugging of usb device is working fine.
> >
> > $ lsusb -v|egrep "^Bus|MaxPower"
> > Couldn't open device, some information will be missing
> > Bus 002 Device 003: ID 1b71:0056 Fushicai
> >     MaxPower              500mA
> > Couldn't open device, some information will be missing
> > Bus 002 Device 004: ID 152d:0578 JMicron Technology Corp. / JMicron
> > USA Technology Corp. JMS567 SATA 6Gb/s bridge
> >     MaxPower               30mA
> > Couldn't open device, some information will be missing
> > Couldn't open device, some information will be missing
> > Bus 002 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
> >     MaxPower              100mA
> > Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> > Couldn't open device, some information will be missing
> >     MaxPower                0mA
> > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> >     MaxPower                0mA
> for me it stops at the Genesys Logic, Inc. 4-port hub (I see the root
> hub, the 4-port hub and then nothing more) using the mainline kernel
> (with or without your patches)
>
> I'm not sure what to do with this information though.
> currently we have no reliable way to tell if GPIOAO_5 is only for the
> OTG port (usb0) or also for the host-only port (usb1).
>

In order to enable usb debug verbose output we need to compile the
kernel with following option.

CONFIG_DYNAMIC_DEBUG=y
CONFIG_USB_DWC2_DEBUG=y
CONFIG_USB_DWC2_VERBOSE=y

to get more in sight into usb initialization and low level hand shake.
-----------------------------
[    1.796436] dwc2 c90c0000.usb: mapped PA c90c0000 to VA (ptrval)
[    1.796481] dwc2 c90c0000.usb: c90c0000.usb supply vusb_d not
found, using dummy regulator
[    1.799183] dwc2 c90c0000.usb: Linked as a consumer to regulator.0
[    1.805320] dwc2 c90c0000.usb: c90c0000.usb supply vusb_a not
found, using dummy regulator
[    1.813600] dwc2 c90c0000.usb: registering common handler for irq26
[    1.814794] dwc2 c90c0000.usb: Core Release: 3.10a (snpsid=4f54310a)
[    1.814803] dwc2 c90c0000.usb: Forcing mode to host
[    1.883383] dwc2 c90c0000.usb: dwc2_check_params: Invalid parameter lpm=1
[    1.884534] dwc2 c90c0000.usb: dwc2_check_params: Invalid parameter
lpm_clock_gating=1
[    1.892435] dwc2 c90c0000.usb: dwc2_check_params: Invalid parameter besl=1
[    1.899318] dwc2 c90c0000.usb: dwc2_check_params: Invalid parameter
hird_threshold_en=1
[    1.907300] dwc2 c90c0000.usb: DWC OTG HCD INIT
[    1.907306] dwc2 c90c0000.usb: hcfg=00000200
[    1.907319] dwc2 c90c0000.usb: dwc2_core_init((ptrval))
[    1.907324] dwc2 c90c0000.usb: HS UTMI+ PHY selected
[    1.907330] dwc2 c90c0000.usb: Internal DMA Mode
[    1.907337] dwc2 c90c0000.usb: Host Mode
[    1.907599] dwc2 c90c0000.usb: DWC OTG Controller
[    1.911994] dwc2 c90c0000.usb: new USB bus registered, assigned bus number 1
[    1.919060] dwc2 c90c0000.usb: irq 26, io mem 0xc90c0000
[    1.924323] dwc2 c90c0000.usb: DWC OTG HCD START
[    1.924335] dwc2 c90c0000.usb: dwc2_core_host_init((ptrval))
[    1.924342] dwc2 c90c0000.usb: Initializing HCFG.FSLSPClkSel to 00000000
[    1.924349] dwc2 c90c0000.usb: initial grxfsiz=00000800
[    1.924354] dwc2 c90c0000.usb: new grxfsiz=00000200
[    1.924360] dwc2 c90c0000.usb: initial gnptxfsiz=08000800
[    1.924365] dwc2 c90c0000.usb: new gnptxfsiz=01f40200
[    1.924370] dwc2 c90c0000.usb: initial hptxfsiz=08000000
[    1.924375] dwc2 c90c0000.usb: new hptxfsiz=01f403f4
[    1.924389] dwc2 c90c0000.usb: dwc2_core_host_init: Halt channel 0
[    1.924396] dwc2 c90c0000.usb: dwc2_core_host_init: Halt channel 1
[    1.924401] dwc2 c90c0000.usb: dwc2_core_host_init: Halt channel 2
[    1.924406] dwc2 c90c0000.usb: dwc2_core_host_init: Halt channel 3
[    1.924412] dwc2 c90c0000.usb: dwc2_core_host_init: Halt channel 4
[    1.924417] dwc2 c90c0000.usb: dwc2_core_host_init: Halt channel 5

Best Regards

-Anand