Skip to contentSkip to conversation

ARM: dts: sunxi: Enable otg on more boards

PATCH New Hans de Goede 3 participants 12 messages Jun 20, 2015 – Jun 25, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ARM: dts: sunxi: Enable otg on more boards

Hi Maxime,

Here is a dts series with 1 fix + 3 patches enabling otg on more boards, this applies on top of my previous dts otg work.

Regards,

Hans

#1 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

---
 arch/arm/boot/dts/sunxi-common-regulators.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/sunxi-common-regulators.dtsi +2 -0
index 51cc838..f1953b0 100644
@@ -108,6 +108,7 @@
 		regulator-name = "usb1-vbus";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
+		regulator-boot-on;
 		enable-active-high;
 		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>;
 		status = "disabled";
@@ -120,6 +121,7 @@
 		regulator-name = "usb2-vbus";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
+		regulator-boot-on;
 		enable-active-high;
 		gpio = <&pio 7 3 GPIO_ACTIVE_HIGH>;
 		status = "disabled";
Signature · 1 line
2.4.3
#2 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

Hi Hans,

Quoted 4 lines · Hans de Goede

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

Stupid question: shouldn't u-boot set this property?

Thanks,

Signature · 4 lines
Julian Calaby

Email: julian.calaby at gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
#3 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

Hi,

Quoted 9 lines · Julian Calaby

Hi Hans,

Quoted 4 lines · Hans de Goede

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

Stupid question: shouldn't u-boot set this property?

We could make u-boot set this property but that will require a lot of code on u-boot's side which is simply not there atm. And traditionally this property is is simply a part of the dts files as shipped with the kernel.

Regards,

Hans

#4 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

Hi Hans,

Quoted 15 lines · Hans de Goede

Hi,

Quoted 12 lines · Julian Calaby

Hi Hans,

Quoted 5 lines · Hans de Goede

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

Quoted 7 lines
Quoted 1 line

Stupid question: shouldn't u-boot set this property?

We could make u-boot set this property but that will require a lot of code on
u-boot's side which is simply not there atm. And traditionally this property is is simply a part of the dts files as shipped with the kernel.

Fair enough.

Thanks,

Signature · 4 lines
Julian Calaby

Email: julian.calaby at gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
#5 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

In reply to Hans de Goede
Quoted 11 lines · Hans de Goede

Hi,

Quoted 8 lines · Julian Calaby

Hi Hans,

Quoted 4 lines · Hans de Goede

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

Quoted 5 lines
Quoted 1 line

Stupid question: shouldn't u-boot set this property?

We could make u-boot set this property but that will require a lot of code on u-boot's side which is simply not there atm. And traditionally this property is is simply a part of the dts files as shipped with the kernel.

What happens if the property is set but the regulator is not actually enabled?

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150623/87bae54c/attachment.sig>
#6 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

Hi,

Quoted 12 lines · Maxime Ripard
Quoted 11 lines · Hans de Goede

Hi,

Quoted 8 lines · Julian Calaby

Hi Hans,

Quoted 4 lines · Hans de Goede

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Stupid question: shouldn't u-boot set this property?

We could make u-boot set this property but that will require a lot of code on u-boot's side which is simply not there atm. And traditionally this property is is simply a part of the dts files as shipped with the kernel.

What happens if the property is set but the regulator is not actually enabled?

Then its gets enabled when the regulator loads, so assuming that the usb driver is enabled in the kernel config 0.5 (built-in) - 3 (module) seconds earlier then it otherwise would.

This is not a problem since usb-ports are normally always powered anyways, the only reason they can be turned off on embedded systems like sunxi is for powersaving during suspend (which actually goes against the usb spec, but usually works so most tablets / laptops do this).

Regards,

Hans

#7 lore raw

PATCH 1/4 ARM: dts: sunxi: Add regulator-boot-on to usb host port regulator nodes

Quoted 21 lines · Hans de Goede

Hi,

Quoted 18 lines · Maxime Ripard
Quoted 16 lines · Hans de Goede

Hi,

Quoted 9 lines · Julian Calaby

Hi Hans,

Quoted 4 lines · Hans de Goede

u-boot will have turned on the power to the usb host ports, so mark them as regulator-boot-on, this stops the power on the ports from temporarily getting turned off during boot, causing issues with e.g. usb powered harddisks.

Stupid question: shouldn't u-boot set this property?

We could make u-boot set this property but that will require a lot of code on u-boot's side which is simply not there atm. And traditionally this property is is simply a part of the dts files as shipped with the kernel.

Quoted 6 lines
Quoted 2 lines

What happens if the property is set but the regulator is not actually enabled?

Then its gets enabled when the regulator loads, so assuming that the usb driver is enabled in the kernel config 0.5 (built-in) - 3 (module) seconds earlier then it otherwise would.

Ok, perfect then.

Quoted 1 line

This is not a problem since usb-ports are normally always powered anyways

That might be true using mainline u-boot, but might not be on other bootloaders, hence why I asked that.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150625/3954901b/attachment-0001.sig>
#8 lore raw

PATCH 2/4 ARM: dts: sun4i: Enable otg controller on the ba10-tvbox

In reply to Hans de Goede

The ba10-tvbox has the otg controller connected to one of the 2 usb-A receptacles it has on the front, so enable the otg controller in host-only mode.

---
 arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts +15 -0
index 93d4356..f3cb297 100644
@@ -125,12 +125,21 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	usb2_vbus_pin_a: usb2_vbus_pin at 0 {
 		allwinner,pins = "PH12";
 	};
 };
 
+&reg_usb0_vbus {
+	regulator-boot-on;
+	status = "okay";
+};
+
 &reg_usb1_vbus {
 	status = "okay";
 };
@@ -146,7 +155,13 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usbphy {
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	usb2_vbus-supply = <&reg_usb2_vbus>;
 	status = "okay";
Signature · 1 line
2.4.3
#9 lore raw

PATCH 3/4 ARM: dts: sun4i: Enable otg controller on the mini-x

In reply to Hans de Goede

The mini-x has the otg controller connected to one of the 2 usb-A receptacles it has on the front, so enable the otg controller in host-only mode.

---
 arch/arm/boot/dts/sun4i-a10-mini-xplus.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun4i-a10-mini-xplus.dts +15 -0
index ebe2a04..a7dd86d 100644
@@ -114,6 +114,15 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
+&reg_usb0_vbus {
+	regulator-boot-on;
+	status = "okay";
+};
+
 &reg_usb1_vbus {
 	status = "okay";
 };
@@ -128,7 +137,13 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usbphy {
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	usb2_vbus-supply = <&reg_usb2_vbus>;
 	status = "okay";
Signature · 1 line
2.4.3
#10 lore raw

PATCH 4/4 ARM: dts: sun6i: Enable otg controller on the cs908

In reply to Hans de Goede

The cs908 has the otg controller connected to one of the 2 usb-A receptacles it has on the front, so enable the otg controller in host-only mode.

---
 arch/arm/boot/dts/sun6i-a31s-cs908.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sun6i-a31s-cs908.dts +5 -0
index 1e2411a..5e8f8c4 100644
@@ -93,6 +93,11 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usbphy {
 	status = "okay";
 };
Signature · 1 line
2.4.3
#11 lore raw

cover ARM: dts: sunxi: Enable otg on more boards

In reply to Hans de Goede
Quoted 4 lines · Hans de Goede

Hi Maxime,

Here is a dts series with 1 fix + 3 patches enabling otg on more boards, this applies on top of my previous dts otg work.

Merged all 4, thanks!

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150625/c61c4ef0/attachment-0001.sig>