linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] arm64: dts: rockchip: Correct regulator for USB host
@ 2021-09-16 19:09 Chris Morgan
  2021-09-20 14:28 ` Heiko Stuebner
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Morgan @ 2021-09-16 19:09 UTC (permalink / raw)
  To: linux-rockchip; +Cc: devicetree, heiko, robh+dt, maccraft123mc, Chris Morgan

From: Chris Morgan <macromorgan@hotmail.com>

When writing a battery driver, I noticed that the USB voltage was ~3.7V
while running off of battery on a mainline kernel. After consulting the
schematics for the Odroid Go Advance, it appears that the BOOST
regulator is involved in the process of powering the USB host. Power
for the USB host goes from the vccsys regulator into the PMIC, then out
from the PMIC BOOST regulator into the FC9516A (which is controlled by
GPIO), which then feeds power into the USB host. I named the regulator
usb_midu because on the datasheet the pin is described as "MIDU/BOOST -
middle point of USB power supply / boost output". Making these changes
solved the USB power issue on battery and I'm now reading approximately
5v.

Note that on my board at least there is a difference in time from the
USB PHY probing and the regulators being powered on. This causes the
USB port to be undervolted for a few seconds during boot up. The
solutions to this problem are either 1) to add the proper phy-supply
on the host port, or to 2) add regulator-boot-on to the regulator. I
chose to add regulator-boot-on because there is an issue with the phy
clk that causes a warning when booting (see v1 of this patch series).
Basically the clock usb480m is a child of the usb480m_phy clock (used
by the USB PHY) and also a critical clock. Setting the phy-supply
causes this driver to be EPROBE_DEFERed until the regulator is ready,
however upon unregistering the driver to be probed later the system
cannot remove the usb480m_phy clock due to a child being marked
critical.

Changes since v2:
 - Added notes about clk problem and regulator voltage at boot.
 - Added regulator-boot-on as a workaround for the voltage at boot.
 - Removed note about fixed regulator warning, as that has been
   fixed upstream.

Changes since v1:
 - Removed phy-supply, as this generated a warning in dmesg.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts
index 7fc674a99a6c..8985efccbb4d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts
@@ -207,7 +207,8 @@ vcc_host: vcc_host {
 		gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 		regulator-always-on;
-		vin-supply = <&vccsys>;
+		regulator-boot-on;
+		vin-supply = <&usb_midu>;
 	};
 };
 
@@ -311,6 +312,7 @@ rk817: pmic@20 {
 		vcc5-supply = <&vccsys>;
 		vcc6-supply = <&vccsys>;
 		vcc7-supply = <&vccsys>;
+		vcc8-supply = <&vccsys>;
 
 		regulators {
 			vdd_logic: DCDC_REG1 {
@@ -460,6 +462,14 @@ regulator-state-mem {
 					regulator-suspend-microvolt = <3000000>;
 				};
 			};
+
+			usb_midu: BOOST {
+				regulator-name = "usb_midu";
+				regulator-min-microvolt = <5000000>;
+				regulator-max-microvolt = <5400000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
 		};
 
 		rk817_codec: codec {
-- 
2.25.1


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

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

* Re: [PATCH v3] arm64: dts: rockchip: Correct regulator for USB host
  2021-09-16 19:09 [PATCH v3] arm64: dts: rockchip: Correct regulator for USB host Chris Morgan
@ 2021-09-20 14:28 ` Heiko Stuebner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stuebner @ 2021-09-20 14:28 UTC (permalink / raw)
  To: linux-rockchip, Chris Morgan
  Cc: Heiko Stuebner, robh+dt, Chris Morgan, devicetree, maccraft123mc

On Thu, 16 Sep 2021 14:09:38 -0500, Chris Morgan wrote:
> When writing a battery driver, I noticed that the USB voltage was ~3.7V
> while running off of battery on a mainline kernel. After consulting the
> schematics for the Odroid Go Advance, it appears that the BOOST
> regulator is involved in the process of powering the USB host. Power
> for the USB host goes from the vccsys regulator into the PMIC, then out
> from the PMIC BOOST regulator into the FC9516A (which is controlled by
> GPIO), which then feeds power into the USB host. I named the regulator
> usb_midu because on the datasheet the pin is described as "MIDU/BOOST -
> middle point of USB power supply / boost output". Making these changes
> solved the USB power issue on battery and I'm now reading approximately
> 5v.
> 
> [...]

Applied, thanks!

[1/1] arm64: dts: rockchip: Correct regulator for USB host
      commit: 4b90e34d9a3ba25a62e4ea42d63fbe6c7fb11ed1

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

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

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

end of thread, other threads:[~2021-09-20 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 19:09 [PATCH v3] arm64: dts: rockchip: Correct regulator for USB host Chris Morgan
2021-09-20 14:28 ` Heiko Stuebner

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).