Skip to contentSkip to conversation

regulator: axp20x: add drivevbus support for axp803

PATCH In review Jagan Teki 3 participants 7 messages Dec 7, 2017 – Dec 8, 2017

Subsystems (5)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH v2 1/3 regulator: axp20x: add drivevbus support for axp803

Like axp221, axp223, axp813 the axp803 is also supporting external regulator to drive the OTG VBus through N_VBUSEN PMIC pin.

Add support for it.

---
Changes for v2:
- New patch

 Documentation/devicetree/bindings/mfd/axp20x.txt | 2 +-
 drivers/regulator/axp20x-regulator.c             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/axp20x.txt +1 -1
index 9455503..34f24a2 100644
@@ -43,7 +43,7 @@ Optional properties:
 			  regulator to drive the OTG VBus, rather then
 			  as an input pin which signals whether the
 			  board is driving OTG VBus or not.
-			  (axp221 / axp223 / axp813 only)
+			  (axp221 / axp223 / axp803/ axp813 only)
 
 - x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is
 			wired for master mode. The default is slave mode.
drivers/regulator/axp20x-regulator.c +2 -0
index 181622b..91b8ff8 100644
@@ -721,6 +721,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 	case AXP803_ID:
 		regulators = axp803_regulators;
 		nregulators = AXP803_REG_ID_MAX;
+		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
+						  "x-powers,drive-vbus-en");
 		break;
 	case AXP806_ID:
 		regulators = axp806_regulators;
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 2/3 arm64: allwinner: axp803: Add drivevbus regulator

Add reg_drivevbus regualtor for boards which are using external regulator to drive the OTG VBus through N_VBUSEN PMIC pin.

---
Changes for v2:
- New patch

 arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/allwinner/axp803.dtsi +5 -0
index ff8af52..e5eae8b 100644
@@ -146,5 +146,10 @@
 			regulator-max-microvolt = <3000000>;
 			regulator-name = "rtc-ldo";
 		};
+
+		reg_drivevbus: drivevbus {
+			regulator-name = "drivevbus";
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 3/3 arm64: allwinner: a64: bananapi-m64: add usb otg

In reply to Jagan Teki

Add usb otg support for bananapi-m64 board,
- USB-ID connected with PH9
- USB-DRVVBUS controlled by N_VBUSEN pin from PMIC

---
Changes for v2:
- add drvvbus regulator
- add N_VBUSEN pin

 .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts  | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +21 -0
index 4a8d3f8..e4b2d8e 100644
@@ -66,6 +66,10 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 &ehci1 {
 	status = "okay";
 };
@@ -136,6 +140,10 @@
 	status = "okay";
 };
 
+&ohci0 {
+	status = "okay";
+};
+
 &ohci1 {
 	status = "okay";
 };
@@ -148,6 +156,7 @@
 		reg = <0x3a3>;
 		interrupt-parent = <&r_intc>;
 		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
 	};
 };
 
@@ -243,6 +252,11 @@
 	regulator-name = "vdd-cpus";
 };
 
+&reg_drivevbus {
+	regulator-name = "usb0-vbus";
+	status = "okay";
+};
+
 &reg_rtc_ldo {
 	regulator-name = "vcc-rtc";
 };
@@ -259,6 +273,13 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
 &usbphy {
+	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+	usb0_vbus-supply = <&reg_drivevbus>;
 	status = "okay";
 };
Signature · 1 line
2.7.4
maintainer Reviewed-by on v2 1/3
#5 lore raw
In reply to Jagan Teki
Quoted 5 lines · Jagan Teki

Like axp221, axp223, axp813 the axp803 is also supporting external regulator to drive the OTG VBus through N_VBUSEN PMIC pin.

Add support for it.

Quoted 8 lines

---
Changes for v2:
- New patch

 Documentation/devicetree/bindings/mfd/axp20x.txt | 2 +-
 drivers/regulator/axp20x-regulator.c             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
#6 lore raw
In reply to Jagan Teki
Quoted 19 lines · Jagan Teki

Like axp221, axp223, axp813 the axp803 is also supporting external regulator to drive the OTG VBus through N_VBUSEN PMIC pin.

Add support for it.

---
Changes for v2:
- New patch

 Documentation/devicetree/bindings/mfd/axp20x.txt | 2 +-
 drivers/regulator/axp20x-regulator.c             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/axp20x.txt +0 -0
index 9455503..34f24a2 100644

Documentation/devicetree/bindings/mfd/axp20x.txt Optional properties: · line 46

Quoted 5 lines
Documentation/devicetree/bindings/mfd/axp20x.txt +1 -1
@@ -43,7 +43,7 @@ Optional properties:
                          regulator to drive the OTG VBus, rather then
                          as an input pin which signals whether the
                          board is driving OTG VBus or not.
-                         (axp221 / axp223 / axp813 only)
+                         (axp221 / axp223 / axp803/ axp813 only)

There is also a table of regulators in that file. Please update it.

ChenYu

Quoted 19 lines
Documentation/devicetree/bindings/mfd/axp20x.txt +0 -0
 - x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is
                        wired for master mode. The default is slave mode.
drivers/regulator/axp20x-regulator.c +2 -1
index 181622b..91b8ff8 100644
@@ -721,6 +721,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
        case AXP803_ID:
                regulators = axp803_regulators;
                nregulators = AXP803_REG_ID_MAX;
+               drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
+                                                 "x-powers,drive-vbus-en");
                break;
        case AXP806_ID:
                regulators = axp806_regulators;
--

2.7.4

#2 lore raw

Re: [PATCH v2 2/3] arm64: allwinner: axp803: Add drivevbus regulator

In reply to Jagan Teki
Quoted 17 lines · Jagan Teki

Add reg_drivevbus regualtor for boards which are using external regulator to drive the OTG VBus through N_VBUSEN PMIC pin.

---
Changes for v2:
- New patch

 arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/allwinner/axp803.dtsi +0 -0
index ff8af52..e5eae8b 100644

arch/arm64/boot/dts/allwinner/axp803.dtsi line 150

Quoted 5 lines
arch/arm64/boot/dts/allwinner/axp803.dtsi +2 -0
@@ -146,5 +146,10 @@
                        regulator-max-microvolt = <3000000>;
                        regulator-name = "rtc-ldo";
                };
+
+               reg_drivevbus: drivevbus {

Could you keep the nodes in alphabetical order please?

Thanks
ChenYu

Quoted 8 lines
arch/arm64/boot/dts/allwinner/axp803.dtsi +3 -1
+                       regulator-name = "drivevbus";
+                       status = "disabled";
+               };
        };
 };
--

2.7.4

author
#3 lore raw

Re: [PATCH v2 2/3] arm64: allwinner: axp803: Add drivevbus regulator

Quoted 13 lines · Chen-Yu Tsai
Quoted 12 lines · Jagan Teki

Add reg_drivevbus regualtor for boards which are using external regulator to drive the OTG VBus through N_VBUSEN PMIC pin.

---
Changes for v2:
- New patch

 arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 12 lines

arch/arm64/boot/dts/allwinner/axp803.dtsi line 150

Quoted 10 lines
arch/arm64/boot/dts/allwinner/axp803.dtsi +2 -0
index ff8af52..e5eae8b 100644
@@ -146,5 +146,10 @@
                        regulator-max-microvolt = <3000000>;
                        regulator-name = "rtc-ldo";
                };
+
+               reg_drivevbus: drivevbus {

Could you keep the nodes in alphabetical order please?

thought the same, but this seems to be different regulator from above AXP_DESC regulators and even binding documentation follow this order.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.