Skip to contentSkip to conversation

ARM: dts: sunxi: Enable otg support on a23/a33 boards

PATCH New Hans de Goede 3 participants 10 messages Jun 11, 2016 – Jun 13, 2016

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

cover ARM: dts: sunxi: Enable otg support on a23/a33 boards

Hi All,

All the necessary bits for this have been merged in the various foo-next tree-s, so lets merge the dts bits and enable full otg support on these boards.

Note that we cannot yet do this for a31 based boards as the axp221 pmic has a quirk where it will not generate interrupts for vbus state changes when it itself is driving vbus. I've a patch to work around this, but this patch is part of a larger set which still needs to be merged.

Regards,

Hans

#1 lore raw

PATCH 1/6 ARM: dts: axp22x.dtsi: Disable axp22x ldo_io# regulators by default

Use of these as regulators conflicts with use of the gpio pins as gpios, so disabled the ldo_io# regulators by default, this avoids the regulator core touching them when the pins are used as gpios.

---
 arch/arm/boot/dts/axp22x.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/axp22x.dtsi +2 -0
index 76302f5..0cfec50 100644
@@ -126,10 +126,12 @@
 
 		reg_ldo_io0: ldo_io0 {
 			regulator-name = "ldo_io0";
+			status = "disabled";
 		};
 
 		reg_ldo_io1: ldo_io1 {
 			regulator-name = "ldo_io1";
+			status = "disabled";
 		};
 
 		reg_rtc_ldo: rtc_ldo {
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 ARM: dts: axp22x.dtsi: Add usb_power_supply node

In reply to Hans de Goede

Add a node describing the (optional) usbpower-supply of the axp221 / axp223 pmic.

---
 arch/arm/boot/dts/axp22x.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/axp22x.dtsi +5 -0
index 0cfec50..0401787 100644
@@ -142,4 +142,9 @@
 			regulator-name = "rtc_ldo";
 		};
 	};
+
+	usb_power_supply: usb_power_supply {
+		compatible = "x-powers,axp221-usb-power-supply";
+		status = "disabled";
+	};
 };
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/6 ARM: dts: axp22x.dtsi: Add reg_drivebus node

In reply to Hans de Goede

Add a node describing the drivebus regulator which is an (optional) part of the axp221/axp223 pmic. Since this regulator may not be available at all depending on the board, mark it as disabled by default.

---
 arch/arm/boot/dts/axp22x.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/axp22x.dtsi +5 -0
index 0401787..458b668 100644
@@ -141,6 +141,11 @@
 			regulator-max-microvolt = <3000000>;
 			regulator-name = "rtc_ldo";
 		};
+
+		reg_drivevbus: drivevbus {
+			regulator-name = "drivevbus";
+			status = "disabled";
+		};
 	};
 
 	usb_power_supply: usb_power_supply {
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/6 ARM: dts: sun8i-a?3-q8-tablet.dts: Add full otg support

In reply to Hans de Goede

Now that we've all the necessary bits in place we can enable full otg support on these tablets.

---
 arch/arm/boot/dts/sun8i-a23-q8-tablet.dts | 15 ---------------
 arch/arm/boot/dts/sun8i-a33-q8-tablet.dts | 15 ---------------
 arch/arm/boot/dts/sun8i-q8-common.dtsi    | 31 +++++++++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 30 deletions(-)
arch/arm/boot/dts/sun8i-a23-q8-tablet.dts +0 -15
index 6062ea7..956320a 100644
@@ -48,18 +48,3 @@
 	model = "Q8 A23 Tablet";
 	compatible = "allwinner,q8-a23", "allwinner,sun8i-a23";
 };
-
-/*
- * 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";
-};
arch/arm/boot/dts/sun8i-a33-q8-tablet.dts +0 -15
index 44b3229..b0bc236 100644
@@ -48,18 +48,3 @@
 	model = "Q8 A33 Tablet";
 	compatible = "allwinner,q8-a33", "allwinner,sun8i-a33";
 };
-
-/*
- * 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";
-};
arch/arm/boot/dts/sun8i-q8-common.dtsi +31 -0
index 346a49d..991087f 100644
@@ -87,6 +87,13 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
 	};
+
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PH8";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
 };
 
 &r_rsb {
@@ -98,6 +105,7 @@
 		interrupt-parent = <&nmi_intc>;
 		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
 		eldoin-supply = <&reg_dcdc1>;
+		x-powers,drive-vbus-en;
 	};
 };
 
@@ -163,6 +171,11 @@
 	regulator-name = "vcc-dram";
 };
 
+&reg_drivevbus {
+	regulator-name = "usb0-vbus";
+	status = "okay";
+};
+
 &reg_rtc_ldo {
 	regulator-name = "vcc-rtc";
 };
@@ -176,3 +189,21 @@
 &simplefb_lcd {
 	vcc-lcd-supply = <&reg_dc1sw>;
 };
+
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usb_power_supply {
+	status = "okay";
+};
+
+&usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>;
+	usb0_id_det-gpio = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+	usb0_vbus_power-supply = <&usb_power_supply>;
+	usb0_vbus-supply = <&reg_drivevbus>;
+	status = "okay";
+};
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/6 ARM: dts: sun8i-a?3-q8-tablet.dts: Add full otg support

Hi,

Quoted 83 lines · Hans de Goede

Now that we've all the necessary bits in place we can enable full otg support on these tablets.

---
 arch/arm/boot/dts/sun8i-a23-q8-tablet.dts | 15 ---------------
 arch/arm/boot/dts/sun8i-a33-q8-tablet.dts | 15 ---------------
 arch/arm/boot/dts/sun8i-q8-common.dtsi    | 31 +++++++++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 30 deletions(-)
arch/arm/boot/dts/sun8i-a23-q8-tablet.dts +0 -15
index 6062ea7..956320a 100644
@@ -48,18 +48,3 @@
        model = "Q8 A23 Tablet";
        compatible = "allwinner,q8-a23", "allwinner,sun8i-a23";
 };
-
-/*
- * 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";
-};
arch/arm/boot/dts/sun8i-a33-q8-tablet.dts +0 -15
index 44b3229..b0bc236 100644
@@ -48,18 +48,3 @@
        model = "Q8 A33 Tablet";
        compatible = "allwinner,q8-a33", "allwinner,sun8i-a33";
 };
-
-/*
- * 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";
-};
arch/arm/boot/dts/sun8i-q8-common.dtsi +8 -0
index 346a49d..991087f 100644
@@ -87,6 +87,13 @@
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
        };
+
+       usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+               allwinner,pins = "PH8";
+               allwinner,function = "gpio_in";
+               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+       };
 };
 
 &r_rsb {
@@ -98,6 +105,7 @@
                interrupt-parent = <&nmi_intc>;
                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
                eldoin-supply = <&reg_dcdc1>;
+               x-powers,drive-vbus-en;
        };
 };
 

arch/arm/boot/dts/sun8i-q8-common.dtsi line 176

Quoted 6 lines
arch/arm/boot/dts/sun8i-q8-common.dtsi +3 -0
@@ -163,6 +171,11 @@
        regulator-name = "vcc-dram";
 };
 
+&reg_drivevbus {
+       regulator-name = "usb0-vbus";
+       status = "okay";

Adding a drivevbus-supply referencing vcc_5v0 (in the axp node) so it doesn't show 0V would be nice.

Sorry for the late reply. I was out on vacation for a few days.

ChenYu

Quoted 30 lines
arch/arm/boot/dts/sun8i-q8-common.dtsi +20 -1
+};
+
 &reg_rtc_ldo {
        regulator-name = "vcc-rtc";
 };
@@ -176,3 +189,21 @@
 &simplefb_lcd {
        vcc-lcd-supply = <&reg_dc1sw>;
 };
+
+&usb_otg {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usb_power_supply {
+       status = "okay";
+};
+
+&usbphy {
+       pinctrl-names = "default";
+       pinctrl-0 = <&usb0_id_detect_pin>;
+       usb0_id_det-gpio = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+       usb0_vbus_power-supply = <&usb_power_supply>;
+       usb0_vbus-supply = <&reg_drivevbus>;
+       status = "okay";
+};
--

2.7.4

#6 lore raw

PATCH 4/6 ARM: dts: sun8i-a?3-q8-tablet.dts: Add full otg support

Hi,

Quoted 89 lines · Chen-Yu Tsai

Hi,

Quoted 86 lines · Hans de Goede

Now that we've all the necessary bits in place we can enable full otg support on these tablets.

---
 arch/arm/boot/dts/sun8i-a23-q8-tablet.dts | 15 ---------------
 arch/arm/boot/dts/sun8i-a33-q8-tablet.dts | 15 ---------------
 arch/arm/boot/dts/sun8i-q8-common.dtsi    | 31 +++++++++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 30 deletions(-)
arch/arm/boot/dts/sun8i-a23-q8-tablet.dts +0 -15
index 6062ea7..956320a 100644
@@ -48,18 +48,3 @@
        model = "Q8 A23 Tablet";
        compatible = "allwinner,q8-a23", "allwinner,sun8i-a23";
 };
-
-/*
- * 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";
-};
arch/arm/boot/dts/sun8i-a33-q8-tablet.dts +0 -15
index 44b3229..b0bc236 100644
@@ -48,18 +48,3 @@
        model = "Q8 A33 Tablet";
        compatible = "allwinner,q8-a33", "allwinner,sun8i-a33";
 };
-
-/*
- * 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";
-};
arch/arm/boot/dts/sun8i-q8-common.dtsi +8 -0
index 346a49d..991087f 100644
@@ -87,6 +87,13 @@
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
        };
+
+       usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+               allwinner,pins = "PH8";
+               allwinner,function = "gpio_in";
+               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+       };
 };
 
 &r_rsb {
@@ -98,6 +105,7 @@
                interrupt-parent = <&nmi_intc>;
                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
                eldoin-supply = <&reg_dcdc1>;
+               x-powers,drive-vbus-en;
        };
 };
 
@@ -163,6 +171,11 @@
        regulator-name = "vcc-dram";
 };
 
Quoted 6 lines

arch/arm/boot/dts/sun8i-q8-common.dtsi line 176

Quoted 3 lines
arch/arm/boot/dts/sun8i-q8-common.dtsi +3 -0
+&reg_drivevbus {
+       regulator-name = "usb0-vbus";
+       status = "okay";

Adding a drivevbus-supply referencing vcc_5v0 (in the axp node) so it doesn't show 0V would be nice.

Ack, given that you've just asked for this with a number of boards, I think that this belongs in axp22x.dtsi. I'll prepare a follow-up patch for this.

Regards,

Hans

Quoted 35 lines

Sorry for the late reply. I was out on vacation for a few days.

ChenYu

Quoted 30 lines
arch/arm/boot/dts/sun8i-q8-common.dtsi +20 -1
+};
+
 &reg_rtc_ldo {
        regulator-name = "vcc-rtc";
 };
@@ -176,3 +189,21 @@
 &simplefb_lcd {
        vcc-lcd-supply = <&reg_dc1sw>;
 };
+
+&usb_otg {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usb_power_supply {
+       status = "okay";
+};
+
+&usbphy {
+       pinctrl-names = "default";
+       pinctrl-0 = <&usb0_id_detect_pin>;
+       usb0_id_det-gpio = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+       usb0_vbus_power-supply = <&usb_power_supply>;
+       usb0_vbus-supply = <&reg_drivevbus>;
+       status = "okay";
+};
--

2.7.4

#7 lore raw

PATCH 5/6 ARM: dts: sun8i-a23-polaroid-mid2809pxe04: Add full otg support

In reply to Hans de Goede

Now that we've all the necessary bits in place we can enable full otg support on these tablets.

---
 .../boot/dts/sun8i-a23-polaroid-mid2809pxe04.dts   | 30 +++++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)
arch/arm/boot/dts/sun8i-a23-polaroid-mid2809pxe04.dts +23 -7
index cb5daaf..bae779f 100644
@@ -131,6 +131,13 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
 	};
+
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PH8";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
 };
 
 &pwm {
@@ -148,6 +155,7 @@
 		interrupt-parent = <&nmi_intc>;
 		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
 		eldoin-supply = <&reg_dcdc1>;
+		x-powers,drive-vbus-en;
 	};
 };
 
@@ -219,6 +227,11 @@
 	regulator-name = "vcc-dram";
 };
 
+&reg_drivevbus {
+	regulator-name = "usb0-vbus";
+	status = "okay";
+};
+
 &reg_rtc_ldo {
 	regulator-name = "vcc-rtc";
 };
@@ -227,17 +240,20 @@
 	vcc-lcd-supply = <&reg_dc1sw>;
 };
 
-/*
- * 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";
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usb_power_supply {
 	status = "okay";
 };
 
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>;
+	usb0_id_det-gpio = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+	usb0_vbus_power-supply = <&usb_power_supply>;
+	usb0_vbus-supply = <&reg_drivevbus>;
 	status = "okay";
 };
Signature · 1 line
2.7.4
#8 lore raw

PATCH 6/6 ARM: dts: sun8i-a23-polaroid-mid2809pxe04: Disable ehci0

In reply to Hans de Goede

The Polaroid mid2809pxe04 tablet uses an sdio esp8089 wifi chip, so ehci0 is not used and should be disabled.

---
 arch/arm/boot/dts/sun8i-a23-polaroid-mid2809pxe04.dts | 4 ----
 1 file changed, 4 deletions(-)
arch/arm/boot/dts/sun8i-a23-polaroid-mid2809pxe04.dts +0 -4
index bae779f..e8c3f21 100644
@@ -72,10 +72,6 @@
 	};
 };
 
-&ehci0 {
-	status = "okay";
-};
-
 &i2c0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c0_pins_a>;
Signature · 1 line
2.7.4
#9 lore raw

cover ARM: dts: sunxi: Enable otg support on a23/a33 boards

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

Hi All,

All the necessary bits for this have been merged in the various foo-next tree-s, so lets merge the dts bits and enable full otg support on these boards.

Note that we cannot yet do this for a31 based boards as the axp221 pmic has a quirk where it will not generate interrupts for vbus state changes when it itself is driving vbus. I've a patch to work around this, but this patch is part of a larger set which still needs to be merged.

Applied all of them, 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: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160611/f46f80f2/attachment.sig>