Skip to contentSkip to conversation

ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

PATCH New Hans de Goede 3 participants 8 messages Jul 31, 2015

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

PATCH v2 1/3 ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

Enable the otg/drc usb controller on the A10s OLinuxIno Micro.

Note the A10s OlinuxIno Micro always has some voltage on its otg power pin, even if the usb-vbus0-regulator is disabled, the leaked voltage is enough to make vbus-det always report 1, so we do not use vbus-det on this board.

---
Changes in v2:
-Address usb0_vbus_pin_a node by reference instead of by full path

---
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 30 +++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +29 -1
index 7b26e17..5a422c1 100644
@@ -196,6 +196,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	mmc0_cd_pin_olinuxino_micro: mmc0_cd_pin at 0 {
 		allwinner,pins = "PG1";
@@ -224,6 +228,18 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
+
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PG12";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+};
+
+&reg_usb0_vbus {
+	gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+	status = "okay";
 };
 
 &reg_usb1_vbus {
@@ -250,8 +266,20 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usb0_vbus_pin_a {
+	allwinner,pins = "PG11";
+};
+
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>;
+	usb0_id_det-gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	status = "okay";
 };
-
Signature · 1 line
2.4.3
#1 lore raw

PATCH v2 2/3 ARM: dts: sun5i: Enable USB DRC on A13 OLinuxIno

From: Mark Janssen <[email protected]>

Enable the otg/drc usb controller on the A13 OLinuxIno.

---
Changes in v2:
-Address usb0_vbus_pin_a node by reference instead of by full path

---
 arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 37 +++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm/boot/dts/sun5i-a13-olinuxino.dts +37 -0
index 4232400..b3c234c 100644
@@ -159,6 +159,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	mmc0_cd_pin_olinuxino: mmc0_cd_pin at 0 {
 		allwinner,pins = "PG0";
@@ -174,6 +178,20 @@
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
 
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PG2";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+
+	usb0_vbus_detect_pin: usb0_vbus_detect_pin at 0 {
+		allwinner,pins = "PG1";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
+	};
+
 	usb1_vbus_pin_olinuxino: usb1_vbus_pin at 0 {
 		allwinner,pins = "PG11";
 		allwinner,function = "gpio_out";
@@ -182,6 +200,11 @@
 	};
 };
 
+&reg_usb0_vbus {
+	status = "okay";
+	gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+};
+
 &reg_usb1_vbus {
 	pinctrl-0 = <&usb1_vbus_pin_olinuxino>;
 	gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>;
@@ -194,7 +217,21 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usb0_vbus_pin_a {
+	allwinner,pins = "PG12";
+};
+
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
+	usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+	usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	status = "okay";
 };
Signature · 1 line
2.4.3
#2 lore raw

PATCH v2 2/3 ARM: dts: sun5i: Enable USB DRC on A13 OLinuxIno

Quoted 6 lines · Hans de Goede

From: Mark Janssen <[email protected]>

Enable the otg/drc usb controller on the A13 OLinuxIno.

Applied, 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/20150731/01a8f2a3/attachment.sig>
#3 lore raw

PATCH v2 3/3 ARM: dts: sun8i: Enable USB DRC on Ippo Q8H-A33 tablet

In reply to Hans de Goede

Enable the otg/drc usb controller on the Ippo Q8H-A33 tablet, for now it is enabled in host-only mode, because true OTG support requires support for detecting and enabling Vbus through the axp221 pmic.

For this to work the Vbus on the port must be enabled by u-boot, or a powered hub must be used.

---
Changes in v2:
-Add a FIXME comment to the usb_otg block in the dts, pointing out the need
to add full otg support once we get axp22x pmic support for a33 based devices

---
 arch/arm/boot/dts/sun8i-a33-ippo-q8h-v1.2.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-a33-ippo-q8h-v1.2.dts +15 -0
index 8bb75ee..a438975 100644
@@ -116,3 +116,18 @@
 	pinctrl-0 = <&r_uart_pins_a>;
 	status = "okay";
 };
+
+/*
+ * FIXME for now we only support host mode and rely on u-boot to have
+ * turned on Vbus which is controlled by the axp223 pmic on the board.
+ *
+ * Once we have axp223 support we should switch to fully supporting otg.
+ */
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbphy {
+	status = "okay";
+};
Signature · 1 line
2.4.3
#4 lore raw

PATCH v2 3/3 ARM: dts: sun8i: Enable USB DRC on Ippo Q8H-A33 tablet

Quoted 8 lines · Hans de Goede

Enable the otg/drc usb controller on the Ippo Q8H-A33 tablet, for now it is enabled in host-only mode, because true OTG support requires support for detecting and enabling Vbus through the axp221 pmic.

For this to work the Vbus on the port must be enabled by u-boot, or a powered hub must be used.

Applied, 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/20150731/1605ac37/attachment.sig>
#5 lore raw

PATCH v2 1/3 ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

In reply to Hans de Goede

Hello,

Quoted 6 lines · Hans de Goede

Enable the otg/drc usb controller on the A10s OLinuxIno Micro.

Note the A10s OlinuxIno Micro always has some voltage on its otg power pin, even if the usb-vbus0-regulator is disabled, the leaked voltage is enough to make vbus-det always report 1, so we do not use vbus-det on this board.

What board revision do you have?

Also does this not go down when you connect a device which draws power?

It is useless for self-powered device detection, though :-s

Still the Olinuxino is not battery powered normally so powering the bus at all times is probably ok.

Thanks

Michal

#6 lore raw

PATCH v2 1/3 ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

Hi,

Quoted 11 lines · Michal Suchanek

Hello,

Quoted 6 lines · Hans de Goede

Enable the otg/drc usb controller on the A10s OLinuxIno Micro.

Note the A10s OlinuxIno Micro always has some voltage on its otg power pin, even if the usb-vbus0-regulator is disabled, the leaked voltage is enough to make vbus-det always report 1, so we do not use vbus-det on this board.

What board revision do you have?

Rev C.

Quoted 1 line

Also does this not go down when you connect a device which draws power?

No it does not, the leaked power is enough to fully power some USB devices (but not others, where as making the Vbus enable pin high results in enough power for all normal USB devices).

Quoted 4 lines

It is useless for self-powered device detection, though :-s

Still the Olinuxino is not battery powered normally so powering the bus at all times is probably ok.

We are note enabling the regulator there is simply some way for 5V DC to get to the otg connector even with the regulator disabled.

Regards,

Hans

#7 lore raw

PATCH v2 1/3 ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

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

Enable the otg/drc usb controller on the A10s OLinuxIno Micro.

Note the A10s OlinuxIno Micro always has some voltage on its otg power pin, even if the usb-vbus0-regulator is disabled, the leaked voltage is enough to make vbus-det always report 1, so we do not use vbus-det on this board.

Applied, 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/20150731/da603f5e/attachment.sig>