summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/arm
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2020-03-05 14:33:30 +0100
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2020-04-15 16:32:34 +0200
commitc0f6606d477af0c531160f73f2d8c194f01b6489 (patch)
treecdea3f38b67420d3fab7b8f5d8ecf19c29ad6821 /freebsd/sys/arm
parentehci_imx: Set/clear ENHOSTDISCONNECT in USB PHY. (diff)
downloadrtems-libbsd-c0f6606d477af0c531160f73f2d8c194f01b6489.tar.bz2
imx6_usbphy: Add regulator (vbus-supply).
Update #3869.
Diffstat (limited to 'freebsd/sys/arm')
-rw-r--r--freebsd/sys/arm/freescale/imx/imx6_usbphy.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
index ad545601..7df2e124 100644
--- a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
+++ b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
@@ -52,6 +52,9 @@ __FBSDID("$FreeBSD$");
#include <arm/freescale/imx/imx_ccmvar.h>
#include <arm/freescale/imx/imx6_anatopreg.h>
#include <arm/freescale/imx/imx6_anatopvar.h>
+#ifdef __rtems__
+#include <dev/extres/regulator/regulator.h>
+#endif /* __rtems__ */
/*
* Hardware register defines.
@@ -70,6 +73,9 @@ struct usbphy_softc {
device_t dev;
struct resource *mem_res;
u_int phy_num;
+#ifdef __rtems__
+ regulator_t supply_vbus;
+#endif /* __rtems__ */
};
static struct ofw_compat_data compat_data[] = {
@@ -107,6 +113,10 @@ usbphy_attach(device_t dev)
{
struct usbphy_softc *sc;
int err, regoff, rid;
+#ifdef __rtems__
+ int rv;
+ phandle_t node;
+#endif /* __rtems__ */
sc = device_get_softc(dev);
err = 0;
@@ -121,6 +131,27 @@ usbphy_attach(device_t dev)
goto out;
}
+#ifdef __rtems__
+ node = ofw_bus_get_node(dev);
+ if (OF_hasprop(node, "vbus-supply")) {
+ rv = regulator_get_by_ofw_property(sc->dev, 0, "vbus-supply",
+ &sc->supply_vbus);
+ if (rv != 0) {
+ device_printf(sc->dev,
+ "Cannot get \"vbus\" regulator\n");
+ err = ENXIO;
+ goto out;
+ }
+ rv = regulator_enable(sc->supply_vbus);
+ if (rv != 0) {
+ device_printf(sc->dev,
+ "Cannot enable \"vbus\" regulator\n");
+ err = ENXIO;
+ goto out;
+ }
+ }
+
+#endif /* __rtems__ */
/*
* XXX Totally lame way to get the unit number (but not quite as lame as
* adding an ad-hoc property to the fdt data). This works as long as