From 59c02d0f6877012e01cd5c54b5f1dc7009aa4aa3 Mon Sep 17 00:00:00 2001 From: kettenis Date: Fri, 26 Jan 2024 17:11:50 +0000 Subject: [PATCH] Add support for the Allwinner D1 USB PHY. ok dlg@, jca@ --- sys/dev/fdt/ehci_fdt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/fdt/ehci_fdt.c b/sys/dev/fdt/ehci_fdt.c index 21bf20a9e25..a94b94c825a 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.10 2023/04/03 01:57:41 dlg Exp $ */ +/* $OpenBSD: ehci_fdt.c,v 1.11 2024/01/26 17:11:50 kettenis Exp $ */ /* * Copyright (c) 2005 David Gwynne @@ -205,6 +205,7 @@ struct ehci_phy ehci_phys[] = { { "allwinner,sun8i-h3-usb-phy", sun4i_phy_init }, { "allwinner,sun8i-r40-usb-phy", sun4i_phy_init }, { "allwinner,sun8i-v3s-usb-phy", sun4i_phy_init }, + { "allwinner,sun20i-d1-usb-phy", sun4i_phy_init }, { "allwinner,sun50i-h6-usb-phy", sun4i_phy_init }, { "allwinner,sun50i-a64-usb-phy", sun4i_phy_init }, { "allwinner,sun9i-a80-usb-phy", sun9i_phy_init }, @@ -305,7 +306,7 @@ sun4i_phy_init(struct ehci_fdt_softc *sc, uint32_t *cells) /* * We need to poke an undocumented register to make the PHY - * work on Allwinner A64/H3/H5/R40. + * work on Allwinner A64/D1/H3/H5/R40. */ if (OF_is_compatible(node, "allwinner,sun8i-h3-usb-phy") || OF_is_compatible(node, "allwinner,sun8i-r40-usb-phy") || @@ -314,6 +315,10 @@ sun4i_phy_init(struct ehci_fdt_softc *sc, uint32_t *cells) 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); + } else if (OF_is_compatible(node, "allwinner,sun20i-d1-usb-phy")) { + val = bus_space_read_4(sc->sc.iot, sc->sc.ioh, 0x810); + val &= ~(1 << 3); + bus_space_write_4(sc->sc.iot, sc->sc.ioh, 0x810, val); } pinctrl_byname(node, "default"); -- 2.20.1