diff options
author | 2017-12-17 13:23:03 +0000 | |
---|---|---|
committer | 2017-12-17 13:23:03 +0000 | |
commit | bf50f09fa97f919a415a01514a6852e2d06a15f5 (patch) | |
tree | bc6431e33358d5e7a9e7c699146941a70c4626f4 | |
parent | Add wsdisplay options needed for X and VT switching. (diff) | |
download | wireguard-openbsd-bf50f09fa97f919a415a01514a6852e2d06a15f5.tar.xz wireguard-openbsd-bf50f09fa97f919a415a01514a6852e2d06a15f5.zip |
Add magic to make USB PYs work on Allwinner H3/H5/A64.
-rw-r--r-- | sys/dev/fdt/ehci_fdt.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/dev/fdt/ehci_fdt.c b/sys/dev/fdt/ehci_fdt.c index 55fe75f1a9c..75f6fba1fe4 100644 --- a/sys/dev/fdt/ehci_fdt.c +++ b/sys/dev/fdt/ehci_fdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci_fdt.c,v 1.1 2017/04/29 20:49:09 kettenis Exp $ */ +/* $OpenBSD: ehci_fdt.c,v 1.2 2017/12/17 13:23:03 kettenis Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -261,15 +261,26 @@ sun4i_phy_init(struct ehci_fdt_softc *sc, uint32_t *cells) uint32_t val; int node; + node = OF_getnodebyphandle(cells[0]); + if (node == -1) + return; + val = bus_space_read_4(sc->sc.iot, sc->sc.ioh, SUNXI_HCI_ICR); val |= SUNXI_AHB_INCR8 | SUNXI_AHB_INCR4; val |= SUNXI_AHB_INCRX_ALIGN; val |= SUNXI_ULPI_BYPASS; bus_space_write_4(sc->sc.iot, sc->sc.ioh, SUNXI_HCI_ICR, val); - node = OF_getnodebyphandle(cells[0]); - if (node == -1) - return; + /* + * We need to poke an undocumented register to make the PHY + * work on Allwinner H3/H5/A64. + */ + if (OF_is_compatible(node, "allwinner,sun8i-h3-usb-phy") || + OF_is_compatible(node, "allwinner,sun50i-a64-usb-phy")) { + val = bus_space_read_4(sc->sc.iot, sc->sc.ioh, 0x810); + val &= ~(1 << 1); + bus_space_write_4(sc->sc.iot, sc->sc.ioh, 0x810, val); + } pinctrl_byname(node, "default"); |