-/* $OpenBSD: rkusbphy.c,v 1.3 2023/09/29 15:51:48 kettenis Exp $ */
+/* $OpenBSD: rkusbphy.c,v 1.4 2023/09/29 17:30:35 kettenis Exp $ */
/*
* Copyright (c) 2023 David Gwynne <dlg@openbsd.org>
const struct rkusbphy_regs *c_regs;
};
-/*
- * Since OpenBSD only supports USB ports in host mode, this driver
- * actually powers down the OTG part of the PHY when it is enabled.
- * This is why the OTG values in the tables below differ from this in
- * (for example) Linux.
- */
-
-/*
- * RK3399 has two USB2PHY nodes that share a GRF.
- */
-
-static const struct rkusbphy_regs rkusbphy_rk3399_usb0_regs = {
- /* shift, mask, set */
- .clk_enable = { 0xe450, 4, 0x1, 0x0 },
-
- .otg = {
- .phy_enable = { 0xe454, 0, 0x3, 0x2 },
- },
-
- .host = {
- .phy_enable = { 0xe458, 0, 0x3, 0x1 },
- },
-};
-
-static const struct rkusbphy_regs rkusbphy_rk3399_usb1_regs = {
- /* shift, mask, set */
- .clk_enable = { 0xe460, 4, 0x1, 0x0 },
-
- .otg = {
- .phy_enable = { 0xe464, 0, 0x3, 0x2 },
- },
-
- .host = {
- .phy_enable = { 0xe468, 0, 0x3, 0x1 },
- },
-};
-
-static const struct rkusbphy_chip rkusbphy_rk3399[] = {
- {
- .c_base_addr = 0xe450,
- .c_regs = &rkusbphy_rk3399_usb0_regs,
- },
- {
- .c_base_addr = 0xe460,
- .c_regs = &rkusbphy_rk3399_usb1_regs,
- },
-};
-
/*
* RK3568 has two USB2PHY nodes that have a GRF each. Each GRF has
* the same register layout.
#define RKUSBPHY_ID(_n, _c) { _n, _c, nitems(_c) }
static const struct rkusbphy_id rkusbphy_ids[] = {
- RKUSBPHY_ID("rockchip,rk3399-usb2phy", rkusbphy_rk3399),
RKUSBPHY_ID("rockchip,rk3568-usb2phy", rkusbphy_rk3568),
};
sc->sc_node = faa->fa_node;
grfph = OF_getpropint(sc->sc_node, "rockchip,usbgrf", 0);
- if (grfph)
- sc->sc_grf = regmap_byphandle(grfph);
- else
- sc->sc_grf = regmap_bynode(OF_parent(sc->sc_node));
+ sc->sc_grf = regmap_byphandle(grfph);
if (sc->sc_grf == NULL) {
printf("%s: rockchip,usbgrf 0x%x not found\n", DEVNAME(sc),
grfph);