Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-23 Thread Anand Moon
Hi Kevin,
On Wed, 23 Jan 2019 at 22:20, Kevin Hilman  wrote:
>
> Anand Moon  writes:
>
> > Add missing vbus-supply link to phy controller for usb_phy0
> > and usb_phy1 nodes, this changes fixed the power issue
> > on usb ports usb, changes help fix usb reset warning.
> >
> > [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> >
> > Fixes: 2eb79a4d15ff (ARM: dts: meson: enabling the USB Host controller on 
> > Odroid-C1/C1+ board)
> > Cc: Martin Blumenstingl 
> > Cc: Jerome Brunet 
> > Cc: Neil Armstrong 
> > Signed-off-by: Anand Moon 
> > ---
> > Rebased on Kevin's amlogic/v5.0/fixes branch
>
> As requested, dropping this series from the fixes branch pending further
> debug and testing.
>
> Kevin

[snip]

Thanks your very much.

Best Regards
-Anand


Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-23 Thread Kevin Hilman
Anand Moon  writes:

> Add missing vbus-supply link to phy controller for usb_phy0
> and usb_phy1 nodes, this changes fixed the power issue
> on usb ports usb, changes help fix usb reset warning.
>
> [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using dwc2
>
> Fixes: 2eb79a4d15ff (ARM: dts: meson: enabling the USB Host controller on 
> Odroid-C1/C1+ board)
> Cc: Martin Blumenstingl 
> Cc: Jerome Brunet 
> Cc: Neil Armstrong 
> Signed-off-by: Anand Moon 
> ---
> Rebased on Kevin's amlogic/v5.0/fixes branch

As requested, dropping this series from the fixes branch pending further
debug and testing.

Kevin

> [alarm@archl-c1t ~]$ lsusb -t
> /:  Bus 01.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 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
> |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> [alarm@archl-c1t ~]$
> [alarm@archl-c1t ~]$ lsusb -v|egrep "^Bus|MaxPower"
> Couldn't open device, some information will be missing
> Bus 001 Device 003: ID 1b71:0056 Fushicai
> MaxPower  500mA
> Couldn't open device, some information will be missing
> Bus 001 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 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
> MaxPower  100mA
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> MaxPower0mA
> ---
>  arch/arm/boot/dts/meson8b-odroidc1.dts | 23 +++
>  1 file changed, 23 insertions(+)
>
> diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts 
> b/arch/arm/boot/dts/meson8b-odroidc1.dts
> index 0f0a46ddf3ff..a49a8509b288 100644
> --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> @@ -83,6 +83,19 @@
>   regulator-max-microvolt = <500>;
>   };
>  
> + usb_vbus: regulator-usb-vbus {
> + compatible = "regulator-fixed";
> +
> + regulator-name = "USB_VBUS";
> + regulator-min-microvolt = <500>;
> + regulator-max-microvolt = <500>;
> +
> + vin-supply = <>;
> +
> + gpio = <_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + };
> +
>   tflash_vdd: regulator-tflash_vdd {
>   /*
>* signal name from schematics: TFLASH_VDD_EN
> @@ -293,8 +306,18 @@
>   pinctrl-names = "default";
>  };
>  
> +_phy {
> + status = "okay";
> + vbus-supply = <_vbus>;
> +};
> +
>  _phy {
>   status = "okay";
> + vbus-supply = <_vbus>;
> +};
> +
> + {
> + status = "okay";
>  };
>  
>   {
> -- 
> 2.20.1


Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-23 Thread Anand Moon
Hi Martin,

On Tue, 22 Jan 2019 at 00:22, Martin Blumenstingl
 wrote:
>
> Hi Anand,
>
> On Mon, Jan 21, 2019 at 7:37 AM Anand Moon  wrote:
> >
> > Hi Martin,
> >
> > Thanks for you comments.
> >
> > On Mon, 21 Jan 2019 at 03:21, Martin Blumenstingl
> >  wrote:
> > >
> > > Hi Anand,
> > >
> > > On Sun, Jan 20, 2019 at 7:44 PM Anand Moon  wrote:
> > > >
> > > > Hi Martin,
> > > >
> > > > Thanks for your review comments.
> > > >
> > > > On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> > > >  wrote:
> > > > >
> > > > > Hi Anand,
> > > > >
> > > > > thank you for this patch!
> > > > >
> > > > > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon  
> > > > > wrote:
> > > > > >
> > > > > > Add missing vbus-supply link to phy controller for usb_phy0
> > > > > > and usb_phy1 nodes, this changes fixed the power issue
> > > > > > on usb ports usb, changes help fix usb reset warning.
> > > > > I trust you on the fact that GPIOAO_5 controls VBUS of USB0 and USB1
> > > > >
> > > > > to me the schematics are not 100% clear or I'm bad at interpreting 
> > > > > them:
> > > > > - I'll refer to odroid-c1+_rev0.4_20150615.pdf
> > > > > - page 1 lists GPIOAO.BIT5 as input for the PWREN signal of the
> > > > > USB_OTG controller (usb0)
> > > > > - page 1 also shows a PWREN signal in the USB_HOST controller (usb1)
> > > > > but not it's input
> > > > > - based on your patch I assume that PWREN is the same signal for both
> > > > > USB controllers
> > > > >
> > > > As per the schematics odroid-c1+_rev0.4_20150615.pdf
> > > >
> > > > It seem that their  vbus setting for *OTG* port. *Bus 01.Port 1* using
> > > > *GPIOAO.BIT5* gpio
> > > that matches my interpretation of the schematics
> >
> > Yep, I feel that GPIOAO.BIT5 enable the PWREN power on  Bus 02.Port (usb1)
> > But I could not get this to enable on Bus 01.Port (usb0).
> >
> > usb hot-plug of devices is working fine on *usb1* but not on *usb0*.
> > I have tried different combination but it's not working for me.
> >
> > I am attaching small changes to phy which enables the Bus 01.Port
> > (usb0) on Odroid C1+/Odroidc2.
> > we need to set dr_mode="otg" to enable this bus in dts.
> I need to get my multimeter out and measure on my own Odroid-C1
> I *believe* to have observed that toggling GPIOAO.BIT5 changes the
> voltage at at the OTG port, but it's been a few weeks since then...
> let me know if you want me to do the measurements on my Odroid-C1+ again
>
> > > > But we also need set power supply for *USB_B* port. *Bus 02.Port 1* ?
> > > > I don't know but I will try to find solution.
> > > I assume we also have to enable VBUS for the host only port, but I
> > > don't know how
> > >
> > > > We need to enable some bit in phy driver ?
> > > I'm not aware of any bit in the PHY driver which can toggle VBUS
> > >
> > > (trying to be creative here) maybe the GPIO is incorrectly configured
> > > to pull up or down?
> >
> > I have tried this but no luck.
> OK, too bad
>
> [...]
> > > > After fix the phy driver code and dts changes I am getting this changes.
> > > > # cat /sys/kernel/debug/regulator/regulator_summary | grep USB_VBUS
> > > > USB_VBUS  12  0 unknown  5000mV
> > > > 0mA  5000mV  5000mV
> > > >
> > > > Now I am able to enable both *Bus 01.Port 1* and *Bus 02.Port 1*
> > > >
> > > > # 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 4, If 0, Class=Mass Storage, 
> > > > Driver=usb-storage, 480M
> > > > |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> > > > |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> > > > |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> > > > |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> > > so this is the host-only controller (usb1) and it's working fine for
> > > you - very nice!
> > >
> > > > /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
> > > >
> > > > But not usb device are getting enable on *Bus 01.Port 1*
> > > so you have something plugged into the OTG capable controller (usb0)
> > > using an OTG cable?
> >
> > Yes I have connected USB-OTG cable with storage device attached,
> > led lights on the device is blinking, but no power to the port is enable.
> > so not hotplug of device is working on this port.
> thanks for confirming this!
> can you please send an updated version of both patches? if you want
> someone else to test and/or review the patches before they are applied
> you can use the subject prefix "RFT PATCH n/m" or "RFC PATCH n/m" (RFT
> means "request for testing", "RFC" means "request for comments")
>

I have tried to address the issue in the next series of patches.

> > > I've not tried this before on my Odroid-C1 because I'm using the micro
> > > USB connector to power the board
> >
> > Correct me if I am wrong, we need to tune USB phy driver to enable as
> > 

Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-21 Thread Martin Blumenstingl
Hi Anand,

On Mon, Jan 21, 2019 at 7:37 AM Anand Moon  wrote:
>
> Hi Martin,
>
> Thanks for you comments.
>
> On Mon, 21 Jan 2019 at 03:21, Martin Blumenstingl
>  wrote:
> >
> > Hi Anand,
> >
> > On Sun, Jan 20, 2019 at 7:44 PM Anand Moon  wrote:
> > >
> > > Hi Martin,
> > >
> > > Thanks for your review comments.
> > >
> > > On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> > >  wrote:
> > > >
> > > > Hi Anand,
> > > >
> > > > thank you for this patch!
> > > >
> > > > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon  
> > > > wrote:
> > > > >
> > > > > Add missing vbus-supply link to phy controller for usb_phy0
> > > > > and usb_phy1 nodes, this changes fixed the power issue
> > > > > on usb ports usb, changes help fix usb reset warning.
> > > > I trust you on the fact that GPIOAO_5 controls VBUS of USB0 and USB1
> > > >
> > > > to me the schematics are not 100% clear or I'm bad at interpreting them:
> > > > - I'll refer to odroid-c1+_rev0.4_20150615.pdf
> > > > - page 1 lists GPIOAO.BIT5 as input for the PWREN signal of the
> > > > USB_OTG controller (usb0)
> > > > - page 1 also shows a PWREN signal in the USB_HOST controller (usb1)
> > > > but not it's input
> > > > - based on your patch I assume that PWREN is the same signal for both
> > > > USB controllers
> > > >
> > > As per the schematics odroid-c1+_rev0.4_20150615.pdf
> > >
> > > It seem that their  vbus setting for *OTG* port. *Bus 01.Port 1* using
> > > *GPIOAO.BIT5* gpio
> > that matches my interpretation of the schematics
>
> Yep, I feel that GPIOAO.BIT5 enable the PWREN power on  Bus 02.Port (usb1)
> But I could not get this to enable on Bus 01.Port (usb0).
>
> usb hot-plug of devices is working fine on *usb1* but not on *usb0*.
> I have tried different combination but it's not working for me.
>
> I am attaching small changes to phy which enables the Bus 01.Port
> (usb0) on Odroid C1+/Odroidc2.
> we need to set dr_mode="otg" to enable this bus in dts.
I need to get my multimeter out and measure on my own Odroid-C1
I *believe* to have observed that toggling GPIOAO.BIT5 changes the
voltage at at the OTG port, but it's been a few weeks since then...
let me know if you want me to do the measurements on my Odroid-C1+ again

> > > But we also need set power supply for *USB_B* port. *Bus 02.Port 1* ?
> > > I don't know but I will try to find solution.
> > I assume we also have to enable VBUS for the host only port, but I
> > don't know how
> >
> > > We need to enable some bit in phy driver ?
> > I'm not aware of any bit in the PHY driver which can toggle VBUS
> >
> > (trying to be creative here) maybe the GPIO is incorrectly configured
> > to pull up or down?
>
> I have tried this but no luck.
OK, too bad

[...]
> > > After fix the phy driver code and dts changes I am getting this changes.
> > > # cat /sys/kernel/debug/regulator/regulator_summary | grep USB_VBUS
> > > USB_VBUS  12  0 unknown  5000mV
> > > 0mA  5000mV  5000mV
> > >
> > > Now I am able to enable both *Bus 01.Port 1* and *Bus 02.Port 1*
> > >
> > > # 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 4, If 0, Class=Mass Storage, Driver=usb-storage, 
> > > 480M
> > > |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> > > |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> > > |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> > > |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> > so this is the host-only controller (usb1) and it's working fine for
> > you - very nice!
> >
> > > /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
> > >
> > > But not usb device are getting enable on *Bus 01.Port 1*
> > so you have something plugged into the OTG capable controller (usb0)
> > using an OTG cable?
>
> Yes I have connected USB-OTG cable with storage device attached,
> led lights on the device is blinking, but no power to the port is enable.
> so not hotplug of device is working on this port.
thanks for confirming this!
can you please send an updated version of both patches? if you want
someone else to test and/or review the patches before they are applied
you can use the subject prefix "RFT PATCH n/m" or "RFC PATCH n/m" (RFT
means "request for testing", "RFC" means "request for comments")

> > I've not tried this before on my Odroid-C1 because I'm using the micro
> > USB connector to power the board
>
> Correct me if I am wrong, we need to tune USB phy driver to enable as
> power the board ?
so far I have seen two designs on Amlogic boards:
- VBUS is hardwired to +5V
- VBUS is controlled by a regulator/current limiting switch/etc. which
can be toggled using a GPIO

the PHY is involved in this because for the OTG port it senses the ID
line to decide whether the controller has to go into host or device
(peripheral) mode.
however, this part is not 

Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-20 Thread Martin Blumenstingl
Hi Anand,

On Sun, Jan 20, 2019 at 7:44 PM Anand Moon  wrote:
>
> Hi Martin,
>
> Thanks for your review comments.
>
> On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
>  wrote:
> >
> > Hi Anand,
> >
> > thank you for this patch!
> >
> > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon  wrote:
> > >
> > > Add missing vbus-supply link to phy controller for usb_phy0
> > > and usb_phy1 nodes, this changes fixed the power issue
> > > on usb ports usb, changes help fix usb reset warning.
> > I trust you on the fact that GPIOAO_5 controls VBUS of USB0 and USB1
> >
> > to me the schematics are not 100% clear or I'm bad at interpreting them:
> > - I'll refer to odroid-c1+_rev0.4_20150615.pdf
> > - page 1 lists GPIOAO.BIT5 as input for the PWREN signal of the
> > USB_OTG controller (usb0)
> > - page 1 also shows a PWREN signal in the USB_HOST controller (usb1)
> > but not it's input
> > - based on your patch I assume that PWREN is the same signal for both
> > USB controllers
> >
> As per the schematics odroid-c1+_rev0.4_20150615.pdf
>
> It seem that their  vbus setting for *OTG* port. *Bus 01.Port 1* using
> *GPIOAO.BIT5* gpio
that matches my interpretation of the schematics

> But we also need set power supply for *USB_B* port. *Bus 02.Port 1* ?
> I don't know but I will try to find solution.
I assume we also have to enable VBUS for the host only port, but I
don't know how

> We need to enable some bit in phy driver ?
I'm not aware of any bit in the PHY driver which can toggle VBUS

(trying to be creative here) maybe the GPIO is incorrectly configured
to pull up or down?
if you want me to compare anything: there's some Armbian image (where
the USB host ports are working fine) on the eMMC of my Odroid-C1 so I
can get you the values you're looking for

> > > [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > > [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > > [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > > [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > >
> > > Fixes: 2eb79a4d15ff (ARM: dts: meson: enabling the USB Host controller on 
> > > Odroid-C1/C1+ board)
> > you already split your original patch into two, however I suggest
> > splitting these patches differently:
> > - this one (personally I would choose "ARM: dts: meson8b: odroidc1:
> > fix USB VBUS supplies" as title), which contains the Fixes tag, adds
> > the "usb_vbus" and references it in the "usb0" and "usb1" nodes
> > - enables usb0_phy and usb0 as part of your second patch (I would call
> > that "ARM: dts: meson8b: odroidc1: enable the OTG capable USB
> > controller")
>
> Ok I will fix this as per you suggestion in the next version.
>
> >
> > > Cc: Martin Blumenstingl 
> > > Cc: Jerome Brunet 
> > > Cc: Neil Armstrong 
> > > Signed-off-by: Anand Moon 
> > > ---
> > > Rebased on Kevin's amlogic/v5.0/fixes branch
> > >
> > > [alarm@archl-c1t ~]$ lsusb -t
> > > /:  Bus 01.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 4, If 0, Class=Mass Storage, Driver=usb-storage, 
> > > 480M
> > > |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> > > |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> > > |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> > > |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> > > [alarm@archl-c1t ~]$
> > > [alarm@archl-c1t ~]$ lsusb -v|egrep "^Bus|MaxPower"
> > > Couldn't open device, some information will be missing
> > > Bus 001 Device 003: ID 1b71:0056 Fushicai
> > > MaxPower  500mA
> > > Couldn't open device, some information will be missing
> > > Bus 001 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 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
> > > MaxPower  100mA
> > > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> > > MaxPower0mA
> > > ---
> > >  arch/arm/boot/dts/meson8b-odroidc1.dts | 23 +++
> > >  1 file changed, 23 insertions(+)
> > >
> > > diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts 
> > > b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > > index 0f0a46ddf3ff..a49a8509b288 100644
> > > --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> > > +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > > @@ -83,6 +83,19 @@
> > > regulator-max-microvolt = <500>;
> > > };
> > >
> > > +   usb_vbus: regulator-usb-vbus {
> > please add a comment here with some details about the regulator and
> > add a hint that the signal in the schematics is called "PWREN"
> Ok I will add this 

Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-20 Thread Anand Moon
Hi Martin,

Thanks for you comments.

On Mon, 21 Jan 2019 at 03:21, Martin Blumenstingl
 wrote:
>
> Hi Anand,
>
> On Sun, Jan 20, 2019 at 7:44 PM Anand Moon  wrote:
> >
> > Hi Martin,
> >
> > Thanks for your review comments.
> >
> > On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> >  wrote:
> > >
> > > Hi Anand,
> > >
> > > thank you for this patch!
> > >
> > > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon  wrote:
> > > >
> > > > Add missing vbus-supply link to phy controller for usb_phy0
> > > > and usb_phy1 nodes, this changes fixed the power issue
> > > > on usb ports usb, changes help fix usb reset warning.
> > > I trust you on the fact that GPIOAO_5 controls VBUS of USB0 and USB1
> > >
> > > to me the schematics are not 100% clear or I'm bad at interpreting them:
> > > - I'll refer to odroid-c1+_rev0.4_20150615.pdf
> > > - page 1 lists GPIOAO.BIT5 as input for the PWREN signal of the
> > > USB_OTG controller (usb0)
> > > - page 1 also shows a PWREN signal in the USB_HOST controller (usb1)
> > > but not it's input
> > > - based on your patch I assume that PWREN is the same signal for both
> > > USB controllers
> > >
> > As per the schematics odroid-c1+_rev0.4_20150615.pdf
> >
> > It seem that their  vbus setting for *OTG* port. *Bus 01.Port 1* using
> > *GPIOAO.BIT5* gpio
> that matches my interpretation of the schematics

Yep, I feel that GPIOAO.BIT5 enable the PWREN power on  Bus 02.Port (usb1)
But I could not get this to enable on Bus 01.Port (usb0).

usb hot-plug of devices is working fine on *usb1* but not on *usb0*.
I have tried different combination but it's not working for me.

I am attaching small changes to phy which enables the Bus 01.Port
(usb0) on Odroid C1+/Odroidc2.
we need to set dr_mode="otg" to enable this bus in dts.

>
> > But we also need set power supply for *USB_B* port. *Bus 02.Port 1* ?
> > I don't know but I will try to find solution.
> I assume we also have to enable VBUS for the host only port, but I
> don't know how
>
> > We need to enable some bit in phy driver ?
> I'm not aware of any bit in the PHY driver which can toggle VBUS
>
> (trying to be creative here) maybe the GPIO is incorrectly configured
> to pull up or down?

I have tried this but no luck.

> if you want me to compare anything: there's some Armbian image (where
> the USB host ports are working fine) on the eMMC of my Odroid-C1 so I
> can get you the values you're looking for
>
> > > > [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using 
> > > > dwc2
> > > > [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using 
> > > > dwc2
> > > > [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using 
> > > > dwc2
> > > > [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using 
> > > > dwc2
> > > >
> > > > Fixes: 2eb79a4d15ff (ARM: dts: meson: enabling the USB Host controller 
> > > > on Odroid-C1/C1+ board)
> > > you already split your original patch into two, however I suggest
> > > splitting these patches differently:
> > > - this one (personally I would choose "ARM: dts: meson8b: odroidc1:
> > > fix USB VBUS supplies" as title), which contains the Fixes tag, adds
> > > the "usb_vbus" and references it in the "usb0" and "usb1" nodes
> > > - enables usb0_phy and usb0 as part of your second patch (I would call
> > > that "ARM: dts: meson8b: odroidc1: enable the OTG capable USB
> > > controller")
> >
> > Ok I will fix this as per you suggestion in the next version.
> >
> > >
> > > > Cc: Martin Blumenstingl 
> > > > Cc: Jerome Brunet 
> > > > Cc: Neil Armstrong 
> > > > Signed-off-by: Anand Moon 
> > > > ---
> > > > Rebased on Kevin's amlogic/v5.0/fixes branch
> > > >
> > > > [alarm@archl-c1t ~]$ lsusb -t
> > > > /:  Bus 01.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 4, If 0, Class=Mass Storage, 
> > > > Driver=usb-storage, 480M
> > > > |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> > > > |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> > > > |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> > > > |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> > > > [alarm@archl-c1t ~]$
> > > > [alarm@archl-c1t ~]$ lsusb -v|egrep "^Bus|MaxPower"
> > > > Couldn't open device, some information will be missing
> > > > Bus 001 Device 003: ID 1b71:0056 Fushicai
> > > > MaxPower  500mA
> > > > Couldn't open device, some information will be missing
> > > > Bus 001 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 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
> > > > MaxPower  100mA
> > > > Bus 001 Device 

Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-20 Thread Anand Moon
Hi Martin,

Thanks for your review comments.

On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
 wrote:
>
> Hi Anand,
>
> thank you for this patch!
>
> On Sun, Jan 13, 2019 at 7:18 PM Anand Moon  wrote:
> >
> > Add missing vbus-supply link to phy controller for usb_phy0
> > and usb_phy1 nodes, this changes fixed the power issue
> > on usb ports usb, changes help fix usb reset warning.
> I trust you on the fact that GPIOAO_5 controls VBUS of USB0 and USB1
>
> to me the schematics are not 100% clear or I'm bad at interpreting them:
> - I'll refer to odroid-c1+_rev0.4_20150615.pdf
> - page 1 lists GPIOAO.BIT5 as input for the PWREN signal of the
> USB_OTG controller (usb0)
> - page 1 also shows a PWREN signal in the USB_HOST controller (usb1)
> but not it's input
> - based on your patch I assume that PWREN is the same signal for both
> USB controllers
>
As per the schematics odroid-c1+_rev0.4_20150615.pdf

It seem that their  vbus setting for *OTG* port. *Bus 01.Port 1* using
*GPIOAO.BIT5* gpio
But we also need set power supply for *USB_B* port. *Bus 02.Port 1* ?
I don't know but I will try to find solution.
We need to enable some bit in phy driver ?

> > [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> > [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> >
> > Fixes: 2eb79a4d15ff (ARM: dts: meson: enabling the USB Host controller on 
> > Odroid-C1/C1+ board)
> you already split your original patch into two, however I suggest
> splitting these patches differently:
> - this one (personally I would choose "ARM: dts: meson8b: odroidc1:
> fix USB VBUS supplies" as title), which contains the Fixes tag, adds
> the "usb_vbus" and references it in the "usb0" and "usb1" nodes
> - enables usb0_phy and usb0 as part of your second patch (I would call
> that "ARM: dts: meson8b: odroidc1: enable the OTG capable USB
> controller")

Ok I will fix this as per you suggestion in the next version.

>
> > Cc: Martin Blumenstingl 
> > Cc: Jerome Brunet 
> > Cc: Neil Armstrong 
> > Signed-off-by: Anand Moon 
> > ---
> > Rebased on Kevin's amlogic/v5.0/fixes branch
> >
> > [alarm@archl-c1t ~]$ lsusb -t
> > /:  Bus 01.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 4, If 0, Class=Mass Storage, Driver=usb-storage, 
> > 480M
> > |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> > |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> > |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> > |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> > [alarm@archl-c1t ~]$
> > [alarm@archl-c1t ~]$ lsusb -v|egrep "^Bus|MaxPower"
> > Couldn't open device, some information will be missing
> > Bus 001 Device 003: ID 1b71:0056 Fushicai
> > MaxPower  500mA
> > Couldn't open device, some information will be missing
> > Bus 001 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 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
> > MaxPower  100mA
> > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> > MaxPower0mA
> > ---
> >  arch/arm/boot/dts/meson8b-odroidc1.dts | 23 +++
> >  1 file changed, 23 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts 
> > b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > index 0f0a46ddf3ff..a49a8509b288 100644
> > --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> > +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > @@ -83,6 +83,19 @@
> > regulator-max-microvolt = <500>;
> > };
> >
> > +   usb_vbus: regulator-usb-vbus {
> please add a comment here with some details about the regulator and
> add a hint that the signal in the schematics is called "PWREN"
Ok I will add this comment in the next patch.
>
> > +   compatible = "regulator-fixed";
> > +
> > +   regulator-name = "USB_VBUS";
> > +   regulator-min-microvolt = <500>;
> > +   regulator-max-microvolt = <500>;
> > +
> > +   vin-supply = <>;
> > +
> > +   gpio = <_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
> > +   enable-active-high;
> > +   };
> > +
> > tflash_vdd: regulator-tflash_vdd {
> > /*
> >  * signal name from schematics: TFLASH_VDD_EN
> > @@ -293,8 +306,18 @@
> > pinctrl-names = "default";
> >  };
> >
> > +_phy {
> > +   status = "okay";
> > +   vbus-supply = <_vbus>;
> > +};
> > +
> >  _phy {

Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node

2019-01-18 Thread Martin Blumenstingl
Hi Anand,

thank you for this patch!

On Sun, Jan 13, 2019 at 7:18 PM Anand Moon  wrote:
>
> Add missing vbus-supply link to phy controller for usb_phy0
> and usb_phy1 nodes, this changes fixed the power issue
> on usb ports usb, changes help fix usb reset warning.
I trust you on the fact that GPIOAO_5 controls VBUS of USB0 and USB1

to me the schematics are not 100% clear or I'm bad at interpreting them:
- I'll refer to odroid-c1+_rev0.4_20150615.pdf
- page 1 lists GPIOAO.BIT5 as input for the PWREN signal of the
USB_OTG controller (usb0)
- page 1 also shows a PWREN signal in the USB_HOST controller (usb1)
but not it's input
- based on your patch I assume that PWREN is the same signal for both
USB controllers

> [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using dwc2
> [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using dwc2
>
> Fixes: 2eb79a4d15ff (ARM: dts: meson: enabling the USB Host controller on 
> Odroid-C1/C1+ board)
you already split your original patch into two, however I suggest
splitting these patches differently:
- this one (personally I would choose "ARM: dts: meson8b: odroidc1:
fix USB VBUS supplies" as title), which contains the Fixes tag, adds
the "usb_vbus" and references it in the "usb0" and "usb1" nodes
- enables usb0_phy and usb0 as part of your second patch (I would call
that "ARM: dts: meson8b: odroidc1: enable the OTG capable USB
controller")

> Cc: Martin Blumenstingl 
> Cc: Jerome Brunet 
> Cc: Neil Armstrong 
> Signed-off-by: Anand Moon 
> ---
> Rebased on Kevin's amlogic/v5.0/fixes branch
>
> [alarm@archl-c1t ~]$ lsusb -t
> /:  Bus 01.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 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
> |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
> |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
> |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
> |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> [alarm@archl-c1t ~]$
> [alarm@archl-c1t ~]$ lsusb -v|egrep "^Bus|MaxPower"
> Couldn't open device, some information will be missing
> Bus 001 Device 003: ID 1b71:0056 Fushicai
> MaxPower  500mA
> Couldn't open device, some information will be missing
> Bus 001 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 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
> MaxPower  100mA
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> MaxPower0mA
> ---
>  arch/arm/boot/dts/meson8b-odroidc1.dts | 23 +++
>  1 file changed, 23 insertions(+)
>
> diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts 
> b/arch/arm/boot/dts/meson8b-odroidc1.dts
> index 0f0a46ddf3ff..a49a8509b288 100644
> --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> @@ -83,6 +83,19 @@
> regulator-max-microvolt = <500>;
> };
>
> +   usb_vbus: regulator-usb-vbus {
please add a comment here with some details about the regulator and
add a hint that the signal in the schematics is called "PWREN"

> +   compatible = "regulator-fixed";
> +
> +   regulator-name = "USB_VBUS";
> +   regulator-min-microvolt = <500>;
> +   regulator-max-microvolt = <500>;
> +
> +   vin-supply = <>;
> +
> +   gpio = <_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
> +   enable-active-high;
> +   };
> +
> tflash_vdd: regulator-tflash_vdd {
> /*
>  * signal name from schematics: TFLASH_VDD_EN
> @@ -293,8 +306,18 @@
> pinctrl-names = "default";
>  };
>
> +_phy {
> +   status = "okay";
> +   vbus-supply = <_vbus>;
> +};
> +
>  _phy {
> status = "okay";
> +   vbus-supply = <_vbus>;
> +};
> +
> + {
> +   status = "okay";
>  };
I believe there's a problem with the usb/usb_phy nodes here. on my
Odroid-C1 this results in:
# cat /sys/kernel/debug/regulator/regulator_summary | grep USB_VBUS
   USB_VBUS  00  0 unknown  5000mV 0mA
 5000mV  5000mV
(open count is 0)

if I move "vbus-supply" to the "usb1" node (just as an example) then I get:
# cat /sys/kernel/debug/regulator/regulator_summary | grep USB_VBUS
   USB_VBUS  11  0 unknown  5000mV 0mA
 5000mV  5000mV

unfortunately neither your original patch nor the modified version
seem to enable USB VBUS on my Odroid-C1.
I have documented