linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
@ 2019-01-13 18:18 Anand Moon
  2019-01-13 18:18 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning Anand Moon
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Anand Moon @ 2019-01-13 18:18 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel
  Cc: Neil Armstrong, Martin Blumenstingl, Kevin Hilman, Rob Herring,
	Emiliano Ingrassia, Jerome Brunet

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 <martin.blumenstingl@googlemail.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
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
    MaxPower                0mA
---
 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 = <5000000>;
 	};
 
+	usb_vbus: regulator-usb-vbus {
+		compatible = "regulator-fixed";
+
+		regulator-name = "USB_VBUS";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+
+		vin-supply = <&p5v0>;
+
+		gpio = <&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";
 };
 
+&usb0_phy {
+	status = "okay";
+	vbus-supply = <&usb_vbus>;
+};
+
 &usb1_phy {
 	status = "okay";
+	vbus-supply = <&usb_vbus>;
+};
+
+&usb0 {
+	status = "okay";
 };
 
 &usb1 {
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning
  2019-01-13 18:18 [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Anand Moon
@ 2019-01-13 18:18 ` Anand Moon
  2019-01-18 22:06   ` Martin Blumenstingl
  2019-01-18 22:29 ` [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Martin Blumenstingl
  2019-01-23 16:49 ` Kevin Hilman
  2 siblings, 1 reply; 13+ messages in thread
From: Anand Moon @ 2019-01-13 18:18 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-amlogic, linux-kernel
  Cc: Neil Armstrong, Martin Blumenstingl, Kevin Hilman, Rob Herring,
	Emiliano Ingrassia, Jerome Brunet

Override the dr_mode from "host" to "peripheral" for dwc2
usb_phy0->usb0 initialization of OTG Micro-B type.
Changes fix the below warning for phy poweron failed --> -22

This fix the initialization of c9040000.usb phy.

[    1.639706] phy phy-c1108800.phy.0: USB ID detect failed!
[    1.643850] phy phy-c1108800.phy.0: phy poweron failed --> -22
[    1.649706] ------------[ cut here ]------------
[    1.654273] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
[    1.663400] Modules linked in:
[    1.666439] CPU: 0 PID: 29 Comm: kworker/0:1 Not tainted 4.20.0-xc1ml #11
[    1.673192] Hardware name: Amlogic Meson platform
[    1.677894] Workqueue: events deferred_probe_work_func
[    1.683027] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
[    1.690746] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
[    1.697953] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
[    1.705418] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
[    1.713579] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
[    1.722437] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
[    1.730859] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
[    1.739112] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
[    1.747537] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
[    1.755350] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
[    1.763599] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
[    1.772110] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
[    1.780359] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
[    1.788522] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
[    1.797470] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
[    1.806585] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
[    1.814748] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
[    1.822128] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
[    1.829331] Exception stack(0xee0ebfb0 to 0xee0ebff8)
[    1.834369] bfa0:                                     00000000 00000000 00000000 00000000
[    1.842534] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.850695] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.857311] ---[ end trace e28bbc26874282a4 ]---
[    1.861984] ------------[ cut here ]------------
[    1.866524] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
[    1.875629] Modules linked in:
[    1.878658] CPU: 0 PID: 29 Comm: kworker/0:1 Tainted: GW         4.20.0-xc1ml #11
[    1.886817] Hardware name: Amlogic Meson platform
[    1.891513] Workqueue: events deferred_probe_work_func
[    1.896641] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
[    1.904366] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
[    1.911573] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
[    1.919041] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
[    1.927203] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
[    1.936060] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
[    1.944483] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
[    1.952734] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
[    1.961159] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
[    1.968974] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
[    1.977224] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
[    1.985734] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
[    1.993984] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
[    2.002147] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
[    2.011092] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
[    2.020209] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
[    2.028371] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
[    2.035752] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
[    2.042955] Exception stack(0xee0ebfb0 to 0xee0ebff8)
[    2.047993] bfa0:                                     00000000 00000000 00000000 00000000
[    2.056158] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.064320] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    2.070934] ---[ end trace e28bbc26874282a5 ]---

Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
Rebased on Kevin's amlogic/v5.0/fixes branch
Note the warning is not getting produced on the latest kernel.
---
 arch/arm/boot/dts/meson8b-odroidc1.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index a49a8509b288..9d7f725cfe35 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -318,6 +318,7 @@
 
 &usb0 {
 	status = "okay";
+	dr_mode = "peripheral";
 };
 
 &usb1 {
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning
  2019-01-13 18:18 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning Anand Moon
@ 2019-01-18 22:06   ` Martin Blumenstingl
  2019-01-20 18:46     ` Anand Moon
  2019-01-21 17:51     ` Anand Moon
  0 siblings, 2 replies; 13+ messages in thread
From: Martin Blumenstingl @ 2019-01-18 22:06 UTC (permalink / raw)
  To: Anand Moon
  Cc: devicetree, Neil Armstrong, Kevin Hilman, linux-kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Anand,

On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> wrote:
>
> Override the dr_mode from "host" to "peripheral" for dwc2
> usb_phy0->usb0 initialization of OTG Micro-B type.
> Changes fix the below warning for phy poweron failed --> -22
>
> This fix the initialization of c9040000.usb phy.
>
> [    1.639706] phy phy-c1108800.phy.0: USB ID detect failed!
> [    1.643850] phy phy-c1108800.phy.0: phy poweron failed --> -22
> [    1.649706] ------------[ cut here ]------------
> [    1.654273] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
> [    1.663400] Modules linked in:
> [    1.666439] CPU: 0 PID: 29 Comm: kworker/0:1 Not tainted 4.20.0-xc1ml #11
> [    1.673192] Hardware name: Amlogic Meson platform
> [    1.677894] Workqueue: events deferred_probe_work_func
> [    1.683027] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
> [    1.690746] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
> [    1.697953] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
> [    1.705418] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
> [    1.713579] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
> [    1.722437] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
> [    1.730859] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
> [    1.739112] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
> [    1.747537] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
> [    1.755350] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
> [    1.763599] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
> [    1.772110] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
> [    1.780359] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
> [    1.788522] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
> [    1.797470] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
> [    1.806585] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
> [    1.814748] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
> [    1.822128] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
> [    1.829331] Exception stack(0xee0ebfb0 to 0xee0ebff8)
> [    1.834369] bfa0:                                     00000000 00000000 00000000 00000000
> [    1.842534] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    1.850695] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [    1.857311] ---[ end trace e28bbc26874282a4 ]---
> [    1.861984] ------------[ cut here ]------------
> [    1.866524] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
> [    1.875629] Modules linked in:
> [    1.878658] CPU: 0 PID: 29 Comm: kworker/0:1 Tainted: GW         4.20.0-xc1ml #11
> [    1.886817] Hardware name: Amlogic Meson platform
> [    1.891513] Workqueue: events deferred_probe_work_func
> [    1.896641] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
> [    1.904366] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
> [    1.911573] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
> [    1.919041] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
> [    1.927203] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
> [    1.936060] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
> [    1.944483] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
> [    1.952734] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
> [    1.961159] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
> [    1.968974] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
> [    1.977224] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
> [    1.985734] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
> [    1.993984] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
> [    2.002147] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
> [    2.011092] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
> [    2.020209] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
> [    2.028371] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
> [    2.035752] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
> [    2.042955] Exception stack(0xee0ebfb0 to 0xee0ebff8)
> [    2.047993] bfa0:                                     00000000 00000000 00000000 00000000
> [    2.056158] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    2.064320] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [    2.070934] ---[ end trace e28bbc26874282a5 ]---
>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> Rebased on Kevin's amlogic/v5.0/fixes branch
> Note the warning is not getting produced on the latest kernel.
> ---
>  arch/arm/boot/dts/meson8b-odroidc1.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
> index a49a8509b288..9d7f725cfe35 100644
> --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> @@ -318,6 +318,7 @@
>
>  &usb0 {
>         status = "okay";
> +       dr_mode = "peripheral";
>  };
with this change I get the following message during boot:
  dwc2 c9040000.usb: Configuration mismatch. dr_mode forced to host

as far as I understand your original problem is the following error
from the USB2 PHY driver:
  phy phy-c1108800.phy.0: USB ID detect failed!
  phy phy-c1108800.phy.0: phy poweron failed --> -22
maybe we should fix that instead?


Regards
Martin

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-13 18:18 [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Anand Moon
  2019-01-13 18:18 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning Anand Moon
@ 2019-01-18 22:29 ` Martin Blumenstingl
  2019-01-20 18:44   ` Anand Moon
  2019-01-23 16:49 ` Kevin Hilman
  2 siblings, 1 reply; 13+ messages in thread
From: Martin Blumenstingl @ 2019-01-18 22:29 UTC (permalink / raw)
  To: Anand Moon
  Cc: devicetree, Neil Armstrong, Kevin Hilman, linux-kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Anand,

thank you for this patch!

On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> 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 <martin.blumenstingl@googlemail.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> 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
>     MaxPower                0mA
> ---
>  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 = <5000000>;
>         };
>
> +       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 = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +
> +               vin-supply = <&p5v0>;
> +
> +               gpio = <&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";
>  };
>
> +&usb0_phy {
> +       status = "okay";
> +       vbus-supply = <&usb_vbus>;
> +};
> +
>  &usb1_phy {
>         status = "okay";
> +       vbus-supply = <&usb_vbus>;
> +};
> +
> +&usb0 {
> +       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                      0    0      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                      1    1      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 my findings already back in December, see "USB
issues on Odroid-C1" [0]
help on that would be highly appreciated :)

on which board revision have you tested this patch?


Regards
Martin


[0] http://lists.infradead.org/pipermail/linux-amlogic/2018-December/009451.html

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-18 22:29 ` [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Martin Blumenstingl
@ 2019-01-20 18:44   ` Anand Moon
  2019-01-20 21:51     ` Martin Blumenstingl
  0 siblings, 1 reply; 13+ messages in thread
From: Anand Moon @ 2019-01-20 18:44 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Martin,

Thanks for your review comments.

On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> thank you for this patch!
>
> On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> 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 <martin.blumenstingl@googlemail.com>
> > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > 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
> >     MaxPower                0mA
> > ---
> >  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 = <5000000>;
> >         };
> >
> > +       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 = <5000000>;
> > +               regulator-max-microvolt = <5000000>;
> > +
> > +               vin-supply = <&p5v0>;
> > +
> > +               gpio = <&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";
> >  };
> >
> > +&usb0_phy {
> > +       status = "okay";
> > +       vbus-supply = <&usb_vbus>;
> > +};
> > +
> >  &usb1_phy {
> >         status = "okay";
> > +       vbus-supply = <&usb_vbus>;
> > +};
> > +
> > +&usb0 {
> > +       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                      0    0      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                      1    1      0 unknown  5000mV     0mA
>  5000mV  5000mV

Sorry for the mixing the vbus-supply node.

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                      1    2      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
/:  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*

>
> unfortunately neither your original patch nor the modified version
> seem to enable USB VBUS on my Odroid-C1.
> I have documented my findings already back in December, see "USB
> issues on Odroid-C1" [0]
> help on that would be highly appreciated :)
>
> on which board revision have you tested this patch?
>

I have with me for testing

ODROID-C0 REV 0.4 20151217
ODROID-C1+ REV 0.4 20150615 ----> current testing on
ODROID-C1+ REV 0.4 20160226

>
> Regards
> Martin
>
>
> [0] http://lists.infradead.org/pipermail/linux-amlogic/2018-December/009451.html

Best Regards

-Anand

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning
  2019-01-18 22:06   ` Martin Blumenstingl
@ 2019-01-20 18:46     ` Anand Moon
  2019-01-21 17:51     ` Anand Moon
  1 sibling, 0 replies; 13+ messages in thread
From: Anand Moon @ 2019-01-20 18:46 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Martin,

On Sat, 19 Jan 2019 at 03:36, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Override the dr_mode from "host" to "peripheral" for dwc2
> > usb_phy0->usb0 initialization of OTG Micro-B type.
> > Changes fix the below warning for phy poweron failed --> -22
> >
> > This fix the initialization of c9040000.usb phy.
> >
> > [    1.639706] phy phy-c1108800.phy.0: USB ID detect failed!
> > [    1.643850] phy phy-c1108800.phy.0: phy poweron failed --> -22
> > [    1.649706] ------------[ cut here ]------------
> > [    1.654273] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
> > [    1.663400] Modules linked in:
> > [    1.666439] CPU: 0 PID: 29 Comm: kworker/0:1 Not tainted 4.20.0-xc1ml #11
> > [    1.673192] Hardware name: Amlogic Meson platform
> > [    1.677894] Workqueue: events deferred_probe_work_func
> > [    1.683027] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
> > [    1.690746] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
> > [    1.697953] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
> > [    1.705418] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
> > [    1.713579] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
> > [    1.722437] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
> > [    1.730859] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
> > [    1.739112] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
> > [    1.747537] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
> > [    1.755350] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
> > [    1.763599] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
> > [    1.772110] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
> > [    1.780359] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
> > [    1.788522] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
> > [    1.797470] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
> > [    1.806585] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
> > [    1.814748] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
> > [    1.822128] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
> > [    1.829331] Exception stack(0xee0ebfb0 to 0xee0ebff8)
> > [    1.834369] bfa0:                                     00000000 00000000 00000000 00000000
> > [    1.842534] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [    1.850695] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [    1.857311] ---[ end trace e28bbc26874282a4 ]---
> > [    1.861984] ------------[ cut here ]------------
> > [    1.866524] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
> > [    1.875629] Modules linked in:
> > [    1.878658] CPU: 0 PID: 29 Comm: kworker/0:1 Tainted: GW         4.20.0-xc1ml #11
> > [    1.886817] Hardware name: Amlogic Meson platform
> > [    1.891513] Workqueue: events deferred_probe_work_func
> > [    1.896641] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
> > [    1.904366] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
> > [    1.911573] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
> > [    1.919041] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
> > [    1.927203] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
> > [    1.936060] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
> > [    1.944483] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
> > [    1.952734] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
> > [    1.961159] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
> > [    1.968974] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
> > [    1.977224] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
> > [    1.985734] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
> > [    1.993984] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
> > [    2.002147] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
> > [    2.011092] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
> > [    2.020209] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
> > [    2.028371] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
> > [    2.035752] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
> > [    2.042955] Exception stack(0xee0ebfb0 to 0xee0ebff8)
> > [    2.047993] bfa0:                                     00000000 00000000 00000000 00000000
> > [    2.056158] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [    2.064320] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [    2.070934] ---[ end trace e28bbc26874282a5 ]---
> >
> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > Rebased on Kevin's amlogic/v5.0/fixes branch
> > Note the warning is not getting produced on the latest kernel.
> > ---
> >  arch/arm/boot/dts/meson8b-odroidc1.dts | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > index a49a8509b288..9d7f725cfe35 100644
> > --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> > +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > @@ -318,6 +318,7 @@
> >
> >  &usb0 {
> >         status = "okay";
> > +       dr_mode = "peripheral";
> >  };
> with this change I get the following message during boot:
>   dwc2 c9040000.usb: Configuration mismatch. dr_mode forced to host
>
> as far as I understand your original problem is the following error
> from the USB2 PHY driver:
>   phy phy-c1108800.phy.0: USB ID detect failed!
>   phy phy-c1108800.phy.0: phy poweron failed --> -22
> maybe we should fix that instead?
I could not fix the phy reg setting for c1108800 setting in dts to look into.
>
>
> Regards
> Martin

Thanks for pointing my mistake.

Actually the dr_mode = "otg"; seem to be correct solution.
with this changes we need to fix the phy-meson8b-usb2.c to enable the
OTG bus port.

Best Regards


-Anand

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-20 18:44   ` Anand Moon
@ 2019-01-20 21:51     ` Martin Blumenstingl
  2019-01-21  6:37       ` Anand Moon
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Blumenstingl @ 2019-01-20 21:51 UTC (permalink / raw)
  To: Anand Moon
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Anand,

On Sun, Jan 20, 2019 at 7:44 PM Anand Moon <linux.amoon@gmail.com> wrote:
>
> Hi Martin,
>
> Thanks for your review comments.
>
> On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> <martin.blumenstingl@googlemail.com> wrote:
> >
> > Hi Anand,
> >
> > thank you for this patch!
> >
> > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> 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 <martin.blumenstingl@googlemail.com>
> > > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > > ---
> > > 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
> > >     MaxPower                0mA
> > > ---
> > >  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 = <5000000>;
> > >         };
> > >
> > > +       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 = <5000000>;
> > > +               regulator-max-microvolt = <5000000>;
> > > +
> > > +               vin-supply = <&p5v0>;
> > > +
> > > +               gpio = <&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";
> > >  };
> > >
> > > +&usb0_phy {
> > > +       status = "okay";
> > > +       vbus-supply = <&usb_vbus>;
> > > +};
> > > +
> > >  &usb1_phy {
> > >         status = "okay";
> > > +       vbus-supply = <&usb_vbus>;
> > > +};
> > > +
> > > +&usb0 {
> > > +       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                      0    0      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                      1    1      0 unknown  5000mV     0mA
> >  5000mV  5000mV
>
> Sorry for the mixing the vbus-supply node.
>
> 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                      1    2      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?
I've not tried this before on my Odroid-C1 because I'm using the micro
USB connector to power the board

do you get VBUS (maybe you have a USB thumb drive with an LED which
lights up when you connect it)?
do you get any errors or warnings from the dwc2 driver during boot?

> >
> > unfortunately neither your original patch nor the modified version
> > seem to enable USB VBUS on my Odroid-C1.
> > I have documented my findings already back in December, see "USB
> > issues on Odroid-C1" [0]
> > help on that would be highly appreciated :)
> >
> > on which board revision have you tested this patch?
> >
>
> I have with me for testing
>
> ODROID-C0 REV 0.4 20151217
> ODROID-C1+ REV 0.4 20150615 ----> current testing on
I have the exact same Odroid-C1+ board revision
this is my u-boot version:
U-boot-00000-gb7b8dc2-dirty(odroidc@b7b8dc21) (Sep 01 2017 - 01:18:22)
-> b7b8dc21 is the lastest commit of the hardkernel odroidc-v2011.03
u-boot branch at the time of writing


Regards
Martin

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-20 21:51     ` Martin Blumenstingl
@ 2019-01-21  6:37       ` Anand Moon
  2019-01-21 18:51         ` Martin Blumenstingl
  0 siblings, 1 reply; 13+ messages in thread
From: Anand Moon @ 2019-01-21  6:37 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

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

Hi Martin,

Thanks for you comments.

On Mon, 21 Jan 2019 at 03:21, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sun, Jan 20, 2019 at 7:44 PM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Hi Martin,
> >
> > Thanks for your review comments.
> >
> > On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> > <martin.blumenstingl@googlemail.com> wrote:
> > >
> > > Hi Anand,
> > >
> > > thank you for this patch!
> > >
> > > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> 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 <martin.blumenstingl@googlemail.com>
> > > > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > > > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > > > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > > > ---
> > > > 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
> > > >     MaxPower                0mA
> > > > ---
> > > >  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 = <5000000>;
> > > >         };
> > > >
> > > > +       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 = <5000000>;
> > > > +               regulator-max-microvolt = <5000000>;
> > > > +
> > > > +               vin-supply = <&p5v0>;
> > > > +
> > > > +               gpio = <&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";
> > > >  };
> > > >
> > > > +&usb0_phy {
> > > > +       status = "okay";
> > > > +       vbus-supply = <&usb_vbus>;
> > > > +};
> > > > +
> > > >  &usb1_phy {
> > > >         status = "okay";
> > > > +       vbus-supply = <&usb_vbus>;
> > > > +};
> > > > +
> > > > +&usb0 {
> > > > +       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                      0    0      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                      1    1      0 unknown  5000mV     0mA
> > >  5000mV  5000mV
> >
> > Sorry for the mixing the vbus-supply node.
> >
> > 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                      1    2      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.

> 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 ?

>
> do you get VBUS (maybe you have a USB thumb drive with an LED which
> lights up when you connect it)?
> do you get any errors or warnings from the dwc2 driver during boot?
>

Please find the boot log of my Odroid C1+ here
[0]: https://pastebin.com/PiDmVmEC

I dont see any major error on usb side.

> > >
> > > unfortunately neither your original patch nor the modified version
> > > seem to enable USB VBUS on my Odroid-C1.
> > > I have documented my findings already back in December, see "USB
> > > issues on Odroid-C1" [0]
> > > help on that would be highly appreciated :)
> > >
> > > on which board revision have you tested this patch?
> > >
> >
> > I have with me for testing
> >
> > ODROID-C0 REV 0.4 20151217
> > ODROID-C1+ REV 0.4 20150615 ----> current testing on
> I have the exact same Odroid-C1+ board revision
> this is my u-boot version:
> U-boot-00000-gb7b8dc2-dirty(odroidc@b7b8dc21) (Sep 01 2017 - 01:18:22)
> -> b7b8dc21 is the lastest commit of the hardkernel odroidc-v2011.03
> u-boot branch at the time of writing
>

I am using the the u-boot from archlinux.
If their is another u-boot for Odroid c1 plz let me know, I will try
to install this on my system.

Thanks for your input.

>
> Regards
> Martin

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

diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c
index 9c01b7e19b06..1333c77e9172 100644
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
@@ -109,6 +109,7 @@
 
 #define RESET_COMPLETE_TIME				500
 #define ACA_ENABLE_COMPLETE_TIME			50
+#define DCD_ENABLE_COMPLETE_TIME			10
 
 struct phy_meson8b_usb2_priv {
 	void __iomem		*regs;
@@ -188,6 +189,20 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
 
 		udelay(ACA_ENABLE_COMPLETE_TIME);
 
+		if (phy_meson8b_usb2_read(priv, REG_ADP_BC) &
+			REG_ADP_BC_ACA_PIN_FLOAT) {
+			dev_warn(&phy->dev, "USB ID detect failed!\n");
+			clk_disable_unprepare(priv->clk_usb);
+			clk_disable_unprepare(priv->clk_usb_general);
+			return -EINVAL;
+		}
+	} else if (priv->dr_mode == USB_DR_MODE_OTG) {
+		phy_meson8b_usb2_mask_bits(priv, REG_ADP_BC,
+					   REG_ADP_BC_DCD_ENABLE,
+					   REG_ADP_BC_DCD_ENABLE);
+
+		udelay(DCD_ENABLE_COMPLETE_TIME);
+
 		if (phy_meson8b_usb2_read(priv, REG_ADP_BC) &
 			REG_ADP_BC_ACA_PIN_FLOAT) {
 			dev_warn(&phy->dev, "USB ID detect failed!\n");

[-- 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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning
  2019-01-18 22:06   ` Martin Blumenstingl
  2019-01-20 18:46     ` Anand Moon
@ 2019-01-21 17:51     ` Anand Moon
  1 sibling, 0 replies; 13+ messages in thread
From: Anand Moon @ 2019-01-21 17:51 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Martin,

On Sat, 19 Jan 2019 at 03:36, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Override the dr_mode from "host" to "peripheral" for dwc2
> > usb_phy0->usb0 initialization of OTG Micro-B type.
> > Changes fix the below warning for phy poweron failed --> -22
> >
> > This fix the initialization of c9040000.usb phy.
> >
> > [    1.639706] phy phy-c1108800.phy.0: USB ID detect failed!
> > [    1.643850] phy phy-c1108800.phy.0: phy poweron failed --> -22
> > [    1.649706] ------------[ cut here ]------------
> > [    1.654273] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
> > [    1.663400] Modules linked in:
> > [    1.666439] CPU: 0 PID: 29 Comm: kworker/0:1 Not tainted 4.20.0-xc1ml #11
> > [    1.673192] Hardware name: Amlogic Meson platform
> > [    1.677894] Workqueue: events deferred_probe_work_func
> > [    1.683027] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
> > [    1.690746] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
> > [    1.697953] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
> > [    1.705418] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
> > [    1.713579] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
> > [    1.722437] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
> > [    1.730859] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
> > [    1.739112] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
> > [    1.747537] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
> > [    1.755350] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
> > [    1.763599] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
> > [    1.772110] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
> > [    1.780359] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
> > [    1.788522] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
> > [    1.797470] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
> > [    1.806585] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
> > [    1.814748] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
> > [    1.822128] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
> > [    1.829331] Exception stack(0xee0ebfb0 to 0xee0ebff8)
> > [    1.834369] bfa0:                                     00000000 00000000 00000000 00000000
> > [    1.842534] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [    1.850695] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [    1.857311] ---[ end trace e28bbc26874282a4 ]---
> > [    1.861984] ------------[ cut here ]------------
> > [    1.866524] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
> > [    1.875629] Modules linked in:
> > [    1.878658] CPU: 0 PID: 29 Comm: kworker/0:1 Tainted: GW         4.20.0-xc1ml #11
> > [    1.886817] Hardware name: Amlogic Meson platform
> > [    1.891513] Workqueue: events deferred_probe_work_func
> > [    1.896641] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
> > [    1.904366] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
> > [    1.911573] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
> > [    1.919041] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
> > [    1.927203] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
> > [    1.936060] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
> > [    1.944483] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
> > [    1.952734] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
> > [    1.961159] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
> > [    1.968974] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
> > [    1.977224] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
> > [    1.985734] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
> > [    1.993984] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
> > [    2.002147] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
> > [    2.011092] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
> > [    2.020209] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
> > [    2.028371] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
> > [    2.035752] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
> > [    2.042955] Exception stack(0xee0ebfb0 to 0xee0ebff8)
> > [    2.047993] bfa0:                                     00000000 00000000 00000000 00000000
> > [    2.056158] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [    2.064320] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [    2.070934] ---[ end trace e28bbc26874282a5 ]---
> >
> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > Rebased on Kevin's amlogic/v5.0/fixes branch
> > Note the warning is not getting produced on the latest kernel.
> > ---
> >  arch/arm/boot/dts/meson8b-odroidc1.dts | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > index a49a8509b288..9d7f725cfe35 100644
> > --- a/arch/arm/boot/dts/meson8b-odroidc1.dts
> > +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
> > @@ -318,6 +318,7 @@
> >
> >  &usb0 {
> >         status = "okay";
> > +       dr_mode = "peripheral";
> >  };
> with this change I get the following message during boot:
>   dwc2 c9040000.usb: Configuration mismatch. dr_mode forced to host
>
> as far as I understand your original problem is the following error
> from the USB2 PHY driver:
>   phy phy-c1108800.phy.0: USB ID detect failed!
>   phy phy-c1108800.phy.0: phy poweron failed --> -22
> maybe we should fix that instead?
>
>
> Regards
> Martin

I have tried to fix this bug using dts + phy changes. Please find the
details below.

# cat /sys/kernel/debug/regulator/regulator_summary
 regulator                      use open bypass  opmode voltage
current     min     max
---------------------------------------------------------------------------------------
 regulator-dummy                  6    5      0 unknown     0mV
0mA     0mV     0mV
    c90c0000.usb                  1
0mA     0mV     0mV
    c90c0000.usb                  1
0mA     0mV     0mV
    c9040000.usb                  1
0mA     0mV     0mV
    c9040000.usb                  1
0mA     0mV     0mV
    VCCK                          1    1      0 unknown   860mV
0mA   860mV  1140mV
       cpu0                       0
0mA   860mV   860mV
 P5V0                             3    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                      2    1      0 unknown  5000mV
0mA  5000mV  5000mV
       phy-c1108800.phy.0         2
0mA     0mV     0mV
 TF_IO                            0    1      0 unknown  3300mV
0mA  1800mV  3300mV
    c1108c20.mmc:slot@1           0
0mA     0mV     0mV

# 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 6, 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
        |__ Port 4: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M

Now I am trying to fix initialization of the Bus 01.Port (usb0) otg port fix.

Best Regards
-Anand

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-21  6:37       ` Anand Moon
@ 2019-01-21 18:51         ` Martin Blumenstingl
  2019-01-23 15:25           ` Anand Moon
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Blumenstingl @ 2019-01-21 18:51 UTC (permalink / raw)
  To: Anand Moon
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Anand,

On Mon, Jan 21, 2019 at 7:37 AM Anand Moon <linux.amoon@gmail.com> wrote:
>
> Hi Martin,
>
> Thanks for you comments.
>
> On Mon, 21 Jan 2019 at 03:21, Martin Blumenstingl
> <martin.blumenstingl@googlemail.com> wrote:
> >
> > Hi Anand,
> >
> > On Sun, Jan 20, 2019 at 7:44 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > >
> > > Hi Martin,
> > >
> > > Thanks for your review comments.
> > >
> > > On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> > > <martin.blumenstingl@googlemail.com> wrote:
> > > >
> > > > Hi Anand,
> > > >
> > > > thank you for this patch!
> > > >
> > > > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> 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                      1    2      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 implemented in the mainline phy-meson8b-usb2
driver yet

in case someone is interested in *why* dwc2 doesn't do OTG on the
Amlogic SoCs yet - here are the notes from the top of my head:
- the dwc2 controller doesn't get an interrupt when switching between
host and peripheral mode
- instead the Amlogic vendor kernel has a timer which polls the PHY registers
- if the timer handler detects a "mode change" in the PHY registers it
changes the dwc2 mode
- however, in mainline the PHY can't notify the USB controller driver
(dwc2) to change the mode (yet)

> >
> > do you get VBUS (maybe you have a USB thumb drive with an LED which
> > lights up when you connect it)?
> > do you get any errors or warnings from the dwc2 driver during boot?
> >
>
> Please find the boot log of my Odroid C1+ here
> [0]: https://pastebin.com/PiDmVmEC
>
> I dont see any major error on usb side.
that looks very good indeed. as I already mentioned above: please send
an updated version of the patches so I can try to reproduce your test
results!

> > > > on which board revision have you tested this patch?
> > > >
> > >
> > > I have with me for testing
> > >
> > > ODROID-C0 REV 0.4 20151217
> > > ODROID-C1+ REV 0.4 20150615 ----> current testing on
> > I have the exact same Odroid-C1+ board revision
> > this is my u-boot version:
> > U-boot-00000-gb7b8dc2-dirty(odroidc@b7b8dc21) (Sep 01 2017 - 01:18:22)
> > -> b7b8dc21 is the lastest commit of the hardkernel odroidc-v2011.03
> > u-boot branch at the time of writing
> >
>
> I am using the the u-boot from archlinux.
> If their is another u-boot for Odroid c1 plz let me know, I will try
> to install this on my system.
I don't remember where I got my u-boot version from.
maybe I should switch to the Arch Linux ARM one instead (so I'm back
to a well-known state). but let's wait for the test results from your
updated patches first.


Regards
Martin

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-21 18:51         ` Martin Blumenstingl
@ 2019-01-23 15:25           ` Anand Moon
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Moon @ 2019-01-23 15:25 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: devicetree, Neil Armstrong, Kevin Hilman, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Martin,

On Tue, 22 Jan 2019 at 00:22, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Mon, Jan 21, 2019 at 7:37 AM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Hi Martin,
> >
> > Thanks for you comments.
> >
> > On Mon, 21 Jan 2019 at 03:21, Martin Blumenstingl
> > <martin.blumenstingl@googlemail.com> wrote:
> > >
> > > Hi Anand,
> > >
> > > On Sun, Jan 20, 2019 at 7:44 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > > >
> > > > Hi Martin,
> > > >
> > > > Thanks for your review comments.
> > > >
> > > > On Sat, 19 Jan 2019 at 03:59, Martin Blumenstingl
> > > > <martin.blumenstingl@googlemail.com> wrote:
> > > > >
> > > > > Hi Anand,
> > > > >
> > > > > thank you for this patch!
> > > > >
> > > > > On Sun, Jan 13, 2019 at 7:18 PM Anand Moon <linux.amoon@gmail.com> 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                      1    2      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
> > 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 implemented in the mainline phy-meson8b-usb2
> driver yet
>
> in case someone is interested in *why* dwc2 doesn't do OTG on the
> Amlogic SoCs yet - here are the notes from the top of my head:
> - the dwc2 controller doesn't get an interrupt when switching between
> host and peripheral mode
> - instead the Amlogic vendor kernel has a timer which polls the PHY registers
> - if the timer handler detects a "mode change" in the PHY registers it
> changes the dwc2 mode
> - however, in mainline the PHY can't notify the USB controller driver
> (dwc2) to change the mode (yet)
>
Thanks for your input.

Yep I tired to study the code changes in the u-boot from amlogic.
I tried to enable few bit in the phy to test enable of usb otg port
but no success.
I have tested that otg port is used to power on the board.

> > >
> > > do you get VBUS (maybe you have a USB thumb drive with an LED which
> > > lights up when you connect it)?
> > > do you get any errors or warnings from the dwc2 driver during boot?
> > >
> >
> > Please find the boot log of my Odroid C1+ here
> > [0]: https://pastebin.com/PiDmVmEC
> >
> > I dont see any major error on usb side.
> that looks very good indeed. as I already mentioned above: please send
> an updated version of the patches so I can try to reproduce your test
> results!
>
> > > > > on which board revision have you tested this patch?
> > > > >
> > > >
> > > > I have with me for testing
> > > >
> > > > ODROID-C0 REV 0.4 20151217
> > > > ODROID-C1+ REV 0.4 20150615 ----> current testing on
> > > I have the exact same Odroid-C1+ board revision
> > > this is my u-boot version:
> > > U-boot-00000-gb7b8dc2-dirty(odroidc@b7b8dc21) (Sep 01 2017 - 01:18:22)
> > > -> b7b8dc21 is the lastest commit of the hardkernel odroidc-v2011.03
> > > u-boot branch at the time of writing
> > >
> >
> > I am using the the u-boot from archlinux.
> > If their is another u-boot for Odroid c1 plz let me know, I will try
> > to install this on my system.
> I don't remember where I got my u-boot version from.
> maybe I should switch to the Arch Linux ARM one instead (so I'm back
> to a well-known state). but let's wait for the test results from your
> updated patches first.
>
>
> Regards
> Martin

Best Regards
-Anand

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-13 18:18 [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Anand Moon
  2019-01-13 18:18 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning Anand Moon
  2019-01-18 22:29 ` [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Martin Blumenstingl
@ 2019-01-23 16:49 ` Kevin Hilman
  2019-01-23 18:25   ` Anand Moon
  2 siblings, 1 reply; 13+ messages in thread
From: Kevin Hilman @ 2019-01-23 16:49 UTC (permalink / raw)
  To: Anand Moon, devicetree, linux-arm-kernel, linux-amlogic, linux-kernel
  Cc: Martin Blumenstingl, Neil Armstrong, Rob Herring,
	Emiliano Ingrassia, Jerome Brunet

Anand Moon <linux.amoon@gmail.com> 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 <martin.blumenstingl@googlemail.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> 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
>     MaxPower                0mA
> ---
>  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 = <5000000>;
>  	};
>  
> +	usb_vbus: regulator-usb-vbus {
> +		compatible = "regulator-fixed";
> +
> +		regulator-name = "USB_VBUS";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +
> +		vin-supply = <&p5v0>;
> +
> +		gpio = <&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";
>  };
>  
> +&usb0_phy {
> +	status = "okay";
> +	vbus-supply = <&usb_vbus>;
> +};
> +
>  &usb1_phy {
>  	status = "okay";
> +	vbus-supply = <&usb_vbus>;
> +};
> +
> +&usb0 {
> +	status = "okay";
>  };
>  
>  &usb1 {
> -- 
> 2.20.1

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node
  2019-01-23 16:49 ` Kevin Hilman
@ 2019-01-23 18:25   ` Anand Moon
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Moon @ 2019-01-23 18:25 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: devicetree, Neil Armstrong, Martin Blumenstingl, Linux Kernel,
	Rob Herring, Emiliano Ingrassia, linux-amlogic, linux-arm-kernel,
	Jerome Brunet

Hi Kevin,
On Wed, 23 Jan 2019 at 22:20, Kevin Hilman <khilman@baylibre.com> wrote:
>
> Anand Moon <linux.amoon@gmail.com> 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 <martin.blumenstingl@googlemail.com>
> > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > 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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-01-23 18:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 18:18 [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Anand Moon
2019-01-13 18:18 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning Anand Moon
2019-01-18 22:06   ` Martin Blumenstingl
2019-01-20 18:46     ` Anand Moon
2019-01-21 17:51     ` Anand Moon
2019-01-18 22:29 ` [PATCH 1/2] ARM: dts: meson8b: odroidc1: Enable usb phy node Martin Blumenstingl
2019-01-20 18:44   ` Anand Moon
2019-01-20 21:51     ` Martin Blumenstingl
2019-01-21  6:37       ` Anand Moon
2019-01-21 18:51         ` Martin Blumenstingl
2019-01-23 15:25           ` Anand Moon
2019-01-23 16:49 ` Kevin Hilman
2019-01-23 18:25   ` Anand Moon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).