diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-08-13 11:08:59 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-08-13 11:08:59 +0000 |
commit | 0bf647f06b80aa92957371ed246b712684a2b2e3 (patch) | |
tree | 487bdb2d9bf05602014978962d93ae8b01dea88b /sys/arch/armv7/imx/imxehci.c | |
parent | 996f5f1a5ffa0bdedab3502101a06bdc574b4a0d (diff) |
Use regulalator API instead of private functions.
Diffstat (limited to 'sys/arch/armv7/imx/imxehci.c')
-rw-r--r-- | sys/arch/armv7/imx/imxehci.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/sys/arch/armv7/imx/imxehci.c b/sys/arch/armv7/imx/imxehci.c index 26e09fee39d..89fe44d0edd 100644 --- a/sys/arch/armv7/imx/imxehci.c +++ b/sys/arch/armv7/imx/imxehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxehci.c,v 1.16 2016/08/06 17:18:38 kettenis Exp $ */ +/* $OpenBSD: imxehci.c,v 1.17 2016/08/13 11:08:58 kettenis Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * @@ -37,6 +37,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> #include <dev/ofw/ofw_pinctrl.h> +#include <dev/ofw/ofw_regulator.h> #include <dev/ofw/fdt.h> #include <dev/usb/ehcireg.h> @@ -75,8 +76,6 @@ int imxehci_match(struct device *, void *, void *); void imxehci_attach(struct device *, struct device *, void *); int imxehci_detach(struct device *, int); -void imxehci_enable_vbus(uint32_t); - struct imxehci_softc { struct ehci_softc sc; void *sc_ih; @@ -180,7 +179,7 @@ imxehci_attach(struct device *parent, struct device *self, void *aux) /* enable usb bus power */ vbus = OF_getpropint(faa->fa_node, "vbus-supply", 0); if (vbus) - imxehci_enable_vbus(vbus); + regulator_enable(vbus); switch (misc[1]) { case 0: @@ -310,32 +309,3 @@ imxehci_detach(struct device *self, int flags) return (0); } - -void -imxehci_enable_vbus(uint32_t phandle) -{ - uint32_t gpio[3]; - int active; - int node; - - node = OF_getnodebyphandle(phandle); - if (node == 0) - return; - - if (!OF_is_compatible(node, "regulator-fixed")) - return; - - pinctrl_byname(node, "default"); - - if (OF_getproplen(node, "enable-active-high") == 0) - active = 1; - else - active = 0; - - if (OF_getpropintarray(node, "gpio", gpio, - sizeof(gpio)) != sizeof(gpio)) - return; - - gpio_controller_config_pin(gpio, GPIO_CONFIG_OUTPUT); - gpio_controller_set_pin(gpio, active); -} |