ramips: mir3g dts define usb port Vcc volt regulator GPIO
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Thu, 7 Jun 2018 16:33:57 +0000 (16:33 +0000)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 16:32:19 +0000 (17:32 +0100)
Define USB port power on/off GPO as voltage regulator type instead of
exposing as a normal GPIO.

The GPO is now controlled by the USB driver via the voltage regulator
definition.  The regulator is of fixed output type (5V for USB) hence the
GPO switches power on/off to USB pin 1 (Vcc)

USB port power is enabled on driver load and disabled on driver unload.

Enable kernel support for fixed voltage regulator types on mt7621.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(backported from 8110bf18f4c1d04e8dfe94438caeadf78ceac892)

target/linux/ramips/dts/MIR3G.dts
target/linux/ramips/mt7621/config-4.14

index efe98b0e100ee3157e9b93cecf744bfb0caf0f2b..44dfc1796c2251a63a317d156901f0a03f0182ef 100644 (file)
                };
        };
 
-       gpio_export {
-               compatible = "gpio-export";
-               #size-cells = <0>;
-
-               usbpower {
-                       gpio-export,name = "usbpower";
-                       gpio-export,output = <1>;
-                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-               };
+       reg_usb_vbus: reg_usb_vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
        };
+
+};
+
+&xhci {
+       vbus-supply = <&reg_usb_vbus>;
 };
 
 &nand {
index 2ea80a3ab0c174374fa8febc19031ff5a4dae4c3..0e060237802f2b1d6918f65894368934c225cb17 100644 (file)
@@ -228,6 +228,8 @@ CONFIG_RCU_STALL_COMMON=y
 CONFIG_REGMAP=y
 CONFIG_REGMAP_I2C=y
 CONFIG_REGMAP_SPI=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_RESET_CONTROLLER=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RPS=y