Skip to contentSkip to conversation

Odroid c2 usb fixs

PATCH In review Anand Moon 2 participants 7 messages Aug 24, 2019 – Aug 27, 2019

Subsystems (2)
lore
Share & tools
lore

Anand Moon

author
#0 lore raw

v4 cover Odroid c2 usb fixs

Some time ago I had tired to enable usb bus 1 for Odroid C2/C1 but it's look like some more work is needed to u-boot and usb_phy driver to initialize this port.

Below patches tries to address the issue regarding usb bus 2 (4 port) while disable the usb bus 1 on this board.

Prevoius patch
[0] https://lkml.org/lkml/2019/1/29/325
I have tried to split the patchs for now.

Anand Moon (3):
arm64: dts: meson: odroid-c2: p5v0 is the main 5V power input
arm64: dts: meson: odroid-c2: Add missing linking regulator to usb bus
arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power
failed warning

 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 20 +++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
Signature · 1 line
2.23.0
author
#1 lore raw

PATCH v4 1/3 arm64: dts: meson: odroid-c2: p5v0 is the main 5V power input

As per the schematic Monolithic Power Systems MP2161GJ-C499 supply a fixed output voltage of 5.0V. This supplies linked to VDD_EE, HDMI_P5V0, USB_POWER, VCCK, VDDIO_AO1V8, DDR_VDDC according to the schematics.

Cc Martin Blumenstingl <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc Neil Armstrong <[email protected]>

---
Changes from my previous attempt below
[1] https://lore.kernel.org/patchwork/patch/1031243/

New patch and fix the commit message.
Added regulator-always-on since this is core input regulator. Split the linking on regulator and usb node in separate patch.

Later more patchs will follow linking more core regulator as per shematics.

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +9 -0
index 9972b1515da6..41d5fa370eb3 100644
@@ -50,6 +50,15 @@
 		};
 	};
 
+	p5v0: regulator-p5v0 {
+		compatible = "regulator-fixed";
+
+		regulator-name = "P5V0";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
+
 	tflash_vdd: regulator-tflash_vdd {
 		/*
 		 * signal name from schematics: TFLASH_VDD_EN
Signature · 1 line
2.23.0
author
#2 lore raw

PATCH v4 2/3 arm64: dts: meson: odroid-c2: Add missing linking regulator to usb bus

In reply to Anand Moon

Add missing linking regulator node to usb bus for power usb devices.

Cc Martin Blumenstingl <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc Neil Armstrong <[email protected]>

---
Changes from previous patch
[1] https://lore.kernel.org/patchwork/patch/1031243/
split the changes and add the comments to power source

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +7 -0
index 41d5fa370eb3..f3dcabf97c63 100644
@@ -36,8 +36,15 @@
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 
+		/*
+		 * signal name from schematics: PWREN
+		 */
 		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
+		/*
+		 * signal name from sehematics: USB_POWER
+		 */
+		vin-supply = <&p5v0>;
 	};
 
 	leds {
Signature · 1 line
2.23.0
author
#3 lore raw

PATCH v4 3/3 arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power failed warning

In reply to Anand Moon

usb_otg bus needs to get initialize from the u-boot to be configured to used as power source to SBC or usb otg port will get configured as host device. Right now this support is missing in the u-boot and phy driver so to avoid power failed warning, we would disable this feature until proper fix is found.

[    2.716048] phy phy-c0000000.phy.0: USB ID detect failed!
[    2.720186] phy phy-c0000000.phy.0: phy poweron failed --> -22
[    2.726001] ------------[ cut here ]------------
[    2.730583] WARNING: CPU: 0 PID: 12 at drivers/regulator/core.c:2039 _regulator_put+0x3c/0xe8
[    2.738983] Modules linked in:
[    2.742005] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.2.9-1-ARCH #1
[    2.748643] Hardware name: Hardkernel ODROID-C2 (DT)
[    2.753566] Workqueue: events deferred_probe_work_func
[    2.758649] pstate: 60000005 (nZCv daif -PAN -UAO)
[    2.763394] pc : _regulator_put+0x3c/0xe8
[    2.767361] lr : _regulator_put+0x3c/0xe8
[    2.771326] sp : ffff000011aa3a50
[    2.774604] x29: ffff000011aa3a50 x28: ffff80007ed1b600
[    2.779865] x27: ffff80007f7036a8 x26: ffff80007f7036a8
[    2.785126] x25: 0000000000000000 x24: ffff000011a44458
[    2.790387] x23: ffff000011344218 x22: 0000000000000009
[    2.795649] x21: ffff000011aa3b68 x20: ffff80007ed1b500
[    2.800910] x19: ffff80007ed1b500 x18: 0000000000000010
[    2.806171] x17: 000000005be5943c x16: 00000000f1c73b29
[    2.811432] x15: ffffffffffffffff x14: ffff0000117396c8
[    2.816694] x13: ffff000091aa37a7 x12: ffff000011aa37af
[    2.821955] x11: ffff000011763000 x10: ffff000011aa3730
[    2.827216] x9 : 00000000ffffffd0 x8 : ffff000010871760
[    2.832477] x7 : 00000000000000d0 x6 : ffff0000119d151b
[    2.837739] x5 : 000000000000000f x4 : 0000000000000000
[    2.843000] x3 : 0000000000000000 x2 : 38104b2678c20100
[    2.848261] x1 : 0000000000000000 x0 : 0000000000000024
[    2.853523] Call trace:
[    2.855940]  _regulator_put+0x3c/0xe8
[    2.859562]  regulator_put+0x34/0x48
[    2.863098]  regulator_bulk_free+0x40/0x58
[    2.867153]  devm_regulator_bulk_release+0x24/0x30
[    2.871896]  release_nodes+0x1f0/0x2e0
[    2.875604]  devres_release_all+0x64/0xa4
[    2.879571]  really_probe+0x1c8/0x3e0
[    2.883194]  driver_probe_device+0xe4/0x138
[    2.887334]  __device_attach_driver+0x90/0x110
[    2.891733]  bus_for_each_drv+0x8c/0xd8
[    2.895527]  __device_attach+0xdc/0x160
[    2.899322]  device_initial_probe+0x24/0x30
[    2.903463]  bus_probe_device+0x9c/0xa8
[    2.907258]  deferred_probe_work_func+0xa0/0xf0
[    2.911745]  process_one_work+0x1b4/0x408
[    2.915711]  worker_thread+0x54/0x4b8
[    2.919334]  kthread+0x12c/0x130
[    2.922526]  ret_from_fork+0x10/0x1c
[    2.926060] ---[ end trace 51a68f4c0035d6c0 ]---
[    2.930691] ------------[ cut here ]------------
[    2.935242] WARNING: CPU: 0 PID: 12 at drivers/regulator/core.c:2039 _regulator_put+0x3c/0xe8
[    2.943653] Modules linked in:
[    2.946675] CPU: 0 PID: 12 Comm: kworker/0:1 Tainted: G        W         5.2.9-1-ARCH #1
[    2.954694] Hardware name: Hardkernel ODROID-C2 (DT)
[    2.959613] Workqueue: events deferred_probe_work_func
[    2.964700] pstate: 60000005 (nZCv daif -PAN -UAO)
[    2.969445] pc : _regulator_put+0x3c/0xe8
[    2.973412] lr : _regulator_put+0x3c/0xe8
[    2.977377] sp : ffff000011aa3a50
[    2.980655] x29: ffff000011aa3a50 x28: ffff80007ed1b600
[    2.985916] x27: ffff80007f7036a8 x26: ffff80007f7036a8
[    2.991177] x25: 0000000000000000 x24: ffff000011a44458
[    2.996439] x23: ffff000011344218 x22: 0000000000000009
[    3.001700] x21: ffff000011aa3b68 x20: ffff80007ed1bd00
[    3.006961] x19: ffff80007ed1bd00 x18: 0000000000000010
[    3.012222] x17: 000000005be5943c x16: 00000000f1c73b29
[    3.017484] x15: ffffffffffffffff x14: ffff0000117396c8
[    3.022745] x13: ffff000091aa37a7 x12: ffff000011aa37af
[    3.028006] x11: ffff000011763000 x10: ffff000011aa3730
[    3.033267] x9 : 00000000ffffffd0 x8 : ffff000010871760
[    3.038528] x7 : 00000000000000fd x6 : ffff0000119d151b
[    3.043790] x5 : 000000000000000f x4 : 0000000000000000
[    3.049051] x3 : 0000000000000000 x2 : 38104b2678c20100
[    3.054312] x1 : 0000000000000000 x0 : 0000000000000024
[    3.059574] Call trace:
[    3.061991]  _regulator_put+0x3c/0xe8
[    3.065613]  regulator_put+0x34/0x48
[    3.069149]  regulator_bulk_free+0x40/0x58
[    3.073203]  devm_regulator_bulk_release+0x24/0x30
[    3.077947]  release_nodes+0x1f0/0x2e0
[    3.081655]  devres_release_all+0x64/0xa4
[    3.085622]  really_probe+0x1c8/0x3e0
[    3.089245]  driver_probe_device+0xe4/0x138
[    3.093385]  __device_attach_driver+0x90/0x110
[    3.097784]  bus_for_each_drv+0x8c/0xd8
[    3.101578]  __device_attach+0xdc/0x160
[    3.105373]  device_initial_probe+0x24/0x30
[    3.109514]  bus_probe_device+0x9c/0xa8
[    3.113309]  deferred_probe_work_func+0xa0/0xf0
[    3.117796]  process_one_work+0x1b4/0x408
[    3.121762]  worker_thread+0x54/0x4b8
[    3.125384]  kthread+0x12c/0x130
[    3.128575]  ret_from_fork+0x10/0x1c
[    3.132110] ---[ end trace 51a68f4c0035d6c1 ]---
[    3.136753] dwc2: probe of c9000000.usb failed with error -22
Fixes 5a0803bd5ae2 ("ARM64: dts: meson-gxbb-odroidc2: Enable USB Nodes")
Cc Martin Blumenstingl <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc Neil Armstrong <[email protected]>

---

[0] https://patchwork.kernel.org/patch/10757569/
Earlier my approach to initialize the usb0 bus was limited, some more phy tuning is required both at driver and u-boot to get this feature working. So for now just disable this.

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +2 -2
index f3dcabf97c63..792698a60a12 100644
@@ -312,7 +312,7 @@
 };
 
 &usb0_phy {
-	status = "okay";
+	status = "disabled";
 	phy-supply = <&usb_otg_pwr>;
 };
 
@@ -322,7 +322,7 @@
 };
 
 &usb0 {
-	status = "okay";
+	status = "disabled";
 };
 
 &usb1 {
Signature · 1 line
2.23.0
reviewer Acked-by on the v4 series
#4 lore raw
In reply to Anand Moon

Hi Anand,

thank you for the patches

On Sat, Aug 24, 2019 at 8:49 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 5 lines

Anand Moon (3):
arm64: dts: meson: odroid-c2: p5v0 is the main 5V power input
arm64: dts: meson: odroid-c2: Add missing linking regulator to usb bus
arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power
failed warning

this whole series is:

author
#5 lore raw

Hi Martin,

Quoted 7 lines · Martin Blumenstingl

Hi Anand,

thank you for the patches

On Sat, Aug 24, 2019 at 8:49 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 7 lines
Quoted 5 lines

Anand Moon (3):
arm64: dts: meson: odroid-c2: p5v0 is the main 5V power input
arm64: dts: meson: odroid-c2: Add missing linking regulator to usb bus
arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power
failed warning

this whole series is:

Thanks, I have some more patch in line for this board.

Best Regards
-Anand

#6 lore raw
Quoted 17 lines · Anand Moon

Hi Martin,

Quoted 12 lines · Martin Blumenstingl

Hi Anand,

thank you for the patches

On Sat, Aug 24, 2019 at 8:49 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 5 lines

Anand Moon (3):
arm64: dts: meson: odroid-c2: p5v0 is the main 5V power input
arm64: dts: meson: odroid-c2: Add missing linking regulator to usb bus
arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power
failed warning

Quoted 4 lines
Quoted 2 lines

this whole series is:

Thanks, I have some more patch in line for this board.

great, any improvement counts (especially since most boards are derived from Amlogic reference designs, so it's likely that more than just the Odroid-C2 will benefit from your patches) :)