All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Moon <linux.amoon@gmail.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: devicetree <devicetree@vger.kernel.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [RFCv1 2/3] ARM: dts: meson8b: odroidc1: fix USB power supplies for phy
Date: Thu, 7 Feb 2019 12:02:50 +0530	[thread overview]
Message-ID: <CANAwSgRtBWzKiFLUV6twxv+TnvjLdHXv=U8+ppQ7=9uBBLEH+Q@mail.gmail.com> (raw)
In-Reply-To: <CAFBinCCFoBkbf-HvEoMk7mTYTBV27nJ9TF1X-DrLuHR9qDVDSA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3957 bytes --]

Hi Martin,

On Wed, 6 Feb 2019 at 16:58, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Tue, Feb 5, 2019 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > > my interpretationfor the Amlogic SoCs is:
> > > - vusb_a and vusb_d are generated internally, not sure if there's an
> > > external fixed regulator
> > > - there is no phy-supply (the PHY itself is powered by clock-gating
> > > using the CLKID_USB clock)
> > > - usb0 VBUS is controlled by GPIOAO_5
> > >
> >
> > But as per the device tree binding
> >
> > [0] https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt
> > [1] https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/phy/phy-bindings.txt
> >
> > its uses phy-supply to enable power to usb phy which seem to be correct option.
> phy-bindings.txt states that "phy-supply" is a "Phandle to a regulator
> that provides power to the PHY".
> I have written the example in meson8b-usb2-phy.txt and I think it's
> wrong (back when I wrote it I didn't know about the "vbus-supply"
> property on the controller and I didn't know about the VBUS
> constraints).
>
> I believe that the phy-supply property is intended for PHYs which need
> an external power supply (for example because they are not embedded
> into a SoC or if the SoC has separate voltage inputs for the PHY).
> I'm not aware of any PHY supply voltage on the Amlogic SoCs (I believe
> this is done internally within the SoC). instead they use clock gating
> to power down the PHY.
>
> as far as I understand the VBUS signal it depends on the USB mode:
> - host provides VBUS
> - peripheral devices are powered using this voltage
> - with OTG VBUS needs to be turned on or off depending on the current
> mode (host or peripheral)
> with the "phy-supply" property there's no way to manage the regulator
> depending on the USB mode (host or peripheral), it will always be
> "on".
>
>
> Regards
> Martin

Thanks for the clarification.
But this dose not work setting the usb1_phy to use vbus-supply.

 &usb1_phy {
        status = "okay";
+       vbus-supply = <&usb_vbus>;
 };

I am attaching a small patch for testing.
[0] usbvbus.patch

Here is the summary of the above patch.

1. hot-plugins of usb device is not working.
2. only cold/warm boot let the device come up.
3. not power is supplied to the usb ports.
4. no power module is registered with the regulator summary.

# cat /sys/kernel/debug/regulator/regulator_summary
 regulator                      use open bypass  opmode voltage
current     min     max
---------------------------------------------------------------------------------------
 regulator-dummy                  4    3      0 unknown     0mV
0mA     0mV     0mV
    c90c0000.usb                  1
0mA     0mV     0mV
    c90c0000.usb                  1
0mA     0mV     0mV
    VCCK                          1    1      0 unknown   860mV
0mA   860mV  1140mV
       cpu0                       0
0mA   860mV   860mV
 P5V0                             2    4      0 unknown  5000mV
0mA  5000mV  5000mV
    VCC1V8                        1    1      0 unknown  1800mV
0mA  1800mV  1800mV
       c1108680.adc               1
0mA     0mV     0mV
    VCC3V3                        1    2      0 unknown  3300mV
0mA  3300mV  3300mV
       VDD_RTC                    0    0      0 unknown   900mV
0mA   900mV   900mV
       TFLASH_VDD                 1    1      0 unknown  3300mV
0mA  3300mV  3300mV
          c1108c20.mmc:slot@1     1
0mA  3300mV  3400mV
    DDR_VDDC                      0    0      0 unknown  1500mV
0mA  1500mV  1500mV
    USB_VBUS                      0    0      0 unknown  5000mV
0mA  5000mV  5000mV
 TF_IO                            0    1      0 unknown  3300mV
0mA  1800mV  3300mV
    c1108c20.mmc:slot@1           0
0mA     0mV     0mV

*So from my side phy-supply is the correct option.*

Best Regards
-Anand

[-- Attachment #2: usbvbus.patch --]
[-- Type: application/octet-stream, Size: 818 bytes --]

diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index 58669abda259..a04f5633adcf 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -83,6 +83,20 @@
 		regulator-max-microvolt = <5000000>;
 	};
 
+	usb_vbus: regulator-usb-vbus {
+		compatible = "regulator-fixed";
+
+		regulator-name = "USB_VBUS";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		/*
+		 * signal name from schematics: PWREN
+		 */
+		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+		vin-supply = <&p5v0>;
+	};
+
 	tflash_vdd: regulator-tflash_vdd {
 		/*
 		 * signal name from schematics: TFLASH_VDD_EN
@@ -297,6 +311,7 @@
 
 &usb1_phy {
 	status = "okay";
+	vbus-supply = <&usb_vbus>;
 };
 
 &usb1 {

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Anand Moon <linux.amoon@gmail.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: devicetree <devicetree@vger.kernel.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [RFCv1 2/3] ARM: dts: meson8b: odroidc1: fix USB power supplies for phy
Date: Thu, 7 Feb 2019 12:02:50 +0530	[thread overview]
Message-ID: <CANAwSgRtBWzKiFLUV6twxv+TnvjLdHXv=U8+ppQ7=9uBBLEH+Q@mail.gmail.com> (raw)
In-Reply-To: <CAFBinCCFoBkbf-HvEoMk7mTYTBV27nJ9TF1X-DrLuHR9qDVDSA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3957 bytes --]

Hi Martin,

On Wed, 6 Feb 2019 at 16:58, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Tue, Feb 5, 2019 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > > my interpretationfor the Amlogic SoCs is:
> > > - vusb_a and vusb_d are generated internally, not sure if there's an
> > > external fixed regulator
> > > - there is no phy-supply (the PHY itself is powered by clock-gating
> > > using the CLKID_USB clock)
> > > - usb0 VBUS is controlled by GPIOAO_5
> > >
> >
> > But as per the device tree binding
> >
> > [0] https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt
> > [1] https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/phy/phy-bindings.txt
> >
> > its uses phy-supply to enable power to usb phy which seem to be correct option.
> phy-bindings.txt states that "phy-supply" is a "Phandle to a regulator
> that provides power to the PHY".
> I have written the example in meson8b-usb2-phy.txt and I think it's
> wrong (back when I wrote it I didn't know about the "vbus-supply"
> property on the controller and I didn't know about the VBUS
> constraints).
>
> I believe that the phy-supply property is intended for PHYs which need
> an external power supply (for example because they are not embedded
> into a SoC or if the SoC has separate voltage inputs for the PHY).
> I'm not aware of any PHY supply voltage on the Amlogic SoCs (I believe
> this is done internally within the SoC). instead they use clock gating
> to power down the PHY.
>
> as far as I understand the VBUS signal it depends on the USB mode:
> - host provides VBUS
> - peripheral devices are powered using this voltage
> - with OTG VBUS needs to be turned on or off depending on the current
> mode (host or peripheral)
> with the "phy-supply" property there's no way to manage the regulator
> depending on the USB mode (host or peripheral), it will always be
> "on".
>
>
> Regards
> Martin

Thanks for the clarification.
But this dose not work setting the usb1_phy to use vbus-supply.

 &usb1_phy {
        status = "okay";
+       vbus-supply = <&usb_vbus>;
 };

I am attaching a small patch for testing.
[0] usbvbus.patch

Here is the summary of the above patch.

1. hot-plugins of usb device is not working.
2. only cold/warm boot let the device come up.
3. not power is supplied to the usb ports.
4. no power module is registered with the regulator summary.

# cat /sys/kernel/debug/regulator/regulator_summary
 regulator                      use open bypass  opmode voltage
current     min     max
---------------------------------------------------------------------------------------
 regulator-dummy                  4    3      0 unknown     0mV
0mA     0mV     0mV
    c90c0000.usb                  1
0mA     0mV     0mV
    c90c0000.usb                  1
0mA     0mV     0mV
    VCCK                          1    1      0 unknown   860mV
0mA   860mV  1140mV
       cpu0                       0
0mA   860mV   860mV
 P5V0                             2    4      0 unknown  5000mV
0mA  5000mV  5000mV
    VCC1V8                        1    1      0 unknown  1800mV
0mA  1800mV  1800mV
       c1108680.adc               1
0mA     0mV     0mV
    VCC3V3                        1    2      0 unknown  3300mV
0mA  3300mV  3300mV
       VDD_RTC                    0    0      0 unknown   900mV
0mA   900mV   900mV
       TFLASH_VDD                 1    1      0 unknown  3300mV
0mA  3300mV  3300mV
          c1108c20.mmc:slot@1     1
0mA  3300mV  3400mV
    DDR_VDDC                      0    0      0 unknown  1500mV
0mA  1500mV  1500mV
    USB_VBUS                      0    0      0 unknown  5000mV
0mA  5000mV  5000mV
 TF_IO                            0    1      0 unknown  3300mV
0mA  1800mV  3300mV
    c1108c20.mmc:slot@1           0
0mA     0mV     0mV

*So from my side phy-supply is the correct option.*

Best Regards
-Anand

[-- Attachment #2: usbvbus.patch --]
[-- Type: application/octet-stream, Size: 818 bytes --]

diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index 58669abda259..a04f5633adcf 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -83,6 +83,20 @@
 		regulator-max-microvolt = <5000000>;
 	};
 
+	usb_vbus: regulator-usb-vbus {
+		compatible = "regulator-fixed";
+
+		regulator-name = "USB_VBUS";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		/*
+		 * signal name from schematics: PWREN
+		 */
+		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+		vin-supply = <&p5v0>;
+	};
+
 	tflash_vdd: regulator-tflash_vdd {
 		/*
 		 * signal name from schematics: TFLASH_VDD_EN
@@ -297,6 +311,7 @@
 
 &usb1_phy {
 	status = "okay";
+	vbus-supply = <&usb_vbus>;
 };
 
 &usb1 {

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2019-02-07  6:32 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 15:12 [RFCv1 0/3] Odroid c1+ usb fixs Anand Moon
2019-01-23 15:12 ` Anand Moon
2019-01-23 15:12 ` Anand Moon
2019-01-23 15:12 ` [RFCv1 1/3] phy: meson8b-usb2: Enable otg phy controller on Meson8b SoCs Anand Moon
2019-01-23 15:12   ` Anand Moon
2019-01-23 15:12   ` Anand Moon
2019-02-04 13:20   ` Martin Blumenstingl
2019-02-04 13:20     ` Martin Blumenstingl
2019-02-04 13:20     ` Martin Blumenstingl
2019-02-04 20:02     ` Anand Moon
2019-02-04 20:02       ` Anand Moon
2019-02-04 20:02       ` Anand Moon
2019-02-04 20:26       ` Martin Blumenstingl
2019-02-04 20:26         ` Martin Blumenstingl
2019-02-04 20:26         ` Martin Blumenstingl
2019-02-05 19:52         ` Anand Moon
2019-02-05 19:52           ` Anand Moon
2019-02-05 19:52           ` Anand Moon
2019-02-06 11:48           ` Martin Blumenstingl
2019-02-06 11:48             ` Martin Blumenstingl
2019-02-06 11:48             ` Martin Blumenstingl
2019-02-07  6:41             ` Anand Moon
2019-02-07  6:41               ` Anand Moon
2019-02-07  6:41               ` Anand Moon
2019-01-23 15:12 ` [RFCv1 2/3] ARM: dts: meson8b: odroidc1: fix USB power supplies for phy Anand Moon
2019-01-23 15:12   ` Anand Moon
2019-01-23 15:12   ` Anand Moon
2019-02-04 13:29   ` Martin Blumenstingl
2019-02-04 13:29     ` Martin Blumenstingl
2019-02-04 13:29     ` Martin Blumenstingl
2019-02-04 20:03     ` Anand Moon
2019-02-04 20:03       ` Anand Moon
2019-02-04 20:03       ` Anand Moon
2019-02-04 20:35       ` Martin Blumenstingl
2019-02-04 20:35         ` Martin Blumenstingl
2019-02-04 20:35         ` Martin Blumenstingl
2019-02-05 19:52         ` Anand Moon
2019-02-05 19:52           ` Anand Moon
2019-02-05 19:52           ` Anand Moon
2019-02-06 11:28           ` Martin Blumenstingl
2019-02-06 11:28             ` Martin Blumenstingl
2019-02-06 11:28             ` Martin Blumenstingl
2019-02-07  6:32             ` Anand Moon [this message]
2019-02-07  6:32               ` Anand Moon
2019-02-09  0:36               ` Martin Blumenstingl
2019-02-09  0:36                 ` Martin Blumenstingl
2019-02-09  0:36                 ` Martin Blumenstingl
2019-02-09 17:55                 ` Anand Moon
2019-02-09 17:55                   ` Anand Moon
2019-02-09 17:55                   ` Anand Moon
2019-02-10 22:21                   ` Martin Blumenstingl
2019-02-10 22:21                     ` Martin Blumenstingl
2019-02-11 15:08                     ` Anand Moon
2019-02-11 15:08                       ` Anand Moon
2019-02-11 15:08                       ` Anand Moon
2019-02-17 14:26                       ` Martin Blumenstingl
2019-02-17 14:26                         ` Martin Blumenstingl
2019-02-17 14:26                         ` Martin Blumenstingl
2019-01-23 15:12 ` [RFCv1 3/3] ARM: dts: meson8b: odroidc1: enable the OTG capable USB controller Anand Moon
2019-01-23 15:12   ` Anand Moon
2019-01-23 15:12   ` Anand Moon
2019-02-04 13:51 ` [RFCv1 0/3] Odroid c1+ usb fixs Martin Blumenstingl
2019-02-04 13:51   ` Martin Blumenstingl
2019-02-04 13:51   ` Martin Blumenstingl
2019-02-04 20:04   ` Anand Moon
2019-02-04 20:04     ` Anand Moon
2019-02-04 20:04     ` Anand Moon
2019-02-04 20:38     ` Martin Blumenstingl
2019-02-04 20:38       ` Martin Blumenstingl
2019-02-04 20:38       ` Martin Blumenstingl
2019-02-05 19:53       ` Anand Moon
2019-02-05 19:53         ` Anand Moon
2019-02-05 19:53         ` Anand Moon

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='CANAwSgRtBWzKiFLUV6twxv+TnvjLdHXv=U8+ppQ7=9uBBLEH+Q@mail.gmail.com' \
    --to=linux.amoon@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=kishon@ti.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    --cc=robh+dt@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.