summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-03-29 11:41:16 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-03-29 11:41:16 +0000
commita0f99895aa9d80a012b430b6965da6f58359abad (patch)
tree9295ed712c8d805823ed2863ce940a141c22f50b /sys/dev/fdt
parent5af3a324c2c343985ca226e9d032c18e447b5815 (diff)
Add support for legacy binding used in device trees for Marvell devices for
USB PHY support and add support for "usb-nop-xceiv" PHYs. ok patrick@, jsg@
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/xhci_fdt.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/sys/dev/fdt/xhci_fdt.c b/sys/dev/fdt/xhci_fdt.c
index 10526b8c857..c98dbf8368a 100644
--- a/sys/dev/fdt/xhci_fdt.c
+++ b/sys/dev/fdt/xhci_fdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xhci_fdt.c,v 1.6 2017/08/12 16:57:07 kettenis Exp $ */
+/* $OpenBSD: xhci_fdt.c,v 1.7 2018/03/29 11:41:15 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark kettenis <kettenis@openbsd.org>
*
@@ -25,6 +25,7 @@
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_misc.h>
+#include <dev/ofw/ofw_regulator.h>
#include <dev/ofw/fdt.h>
#include <dev/usb/usb.h>
@@ -180,10 +181,13 @@ struct xhci_phy {
};
void exynos5_usbdrd_init(struct xhci_fdt_softc *, uint32_t *);
+void nop_xceiv_init(struct xhci_fdt_softc *, uint32_t *);
struct xhci_phy xhci_phys[] = {
{ "samsung,exynos5250-usbdrd-phy", exynos5_usbdrd_init },
- { "samsung,exynos5420-usbdrd-phy", exynos5_usbdrd_init }
+ { "samsung,exynos5420-usbdrd-phy", exynos5_usbdrd_init },
+ { "usb-nop-xceiv", nop_xceiv_init },
+
};
uint32_t *
@@ -223,9 +227,21 @@ xhci_init_phys(struct xhci_fdt_softc *sc)
{
uint32_t *phys;
uint32_t *phy;
+ uint32_t usb_phy;
int len, idx;
- /* XXX Only initialize the USB 3 PHY for now. */
+ /*
+ * Legacy binding; assume there only is a single USB PHY.
+ */
+ usb_phy = OF_getpropint(sc->sc_node, "usb-phy", 0);
+ if (usb_phy) {
+ xhci_init_phy(sc, &usb_phy);
+ return;
+ }
+
+ /*
+ * Generic PHY binding; only initialize USB 3 PHY for now.
+ */
idx = OF_getindex(sc->sc_node, "usb3-phy", "phy-names");
if (idx < 0)
return;
@@ -330,3 +346,17 @@ exynos5_usbdrd_init(struct xhci_fdt_softc *sc, uint32_t *cells)
CLR(val, EXYNOS5_PHYCLKRST_PORTRESET);
bus_space_write_4(sc->sc.iot, sc->ph_ioh, EXYNOS5_PHYCLKRST, val);
}
+
+void
+nop_xceiv_init(struct xhci_fdt_softc *sc, uint32_t *cells)
+{
+ uint32_t vcc_supply;
+ int node;
+
+ node = OF_getnodebyphandle(cells[0]);
+ KASSERT(node != 0);
+
+ vcc_supply = OF_getpropint(node, "vcc-supply", 0);
+ if (vcc_supply)
+ regulator_enable(vcc_supply);
+}