diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2024-11-24 22:46:55 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2024-11-24 22:46:55 +0000 |
commit | e13f88cc2227f13cec2aab76a0cfb8ff66b52fcc (patch) | |
tree | 7b941e1ba34fc6d0bf8b2f5083d76301e64e45a2 | |
parent | 8a61d1362e94a9f665b782bbaa69678b7a3ca8d3 (diff) |
Add RK3399 support.
From Paul Fertser.
ok dlg@
-rw-r--r-- | sys/dev/fdt/rkusbphy.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/sys/dev/fdt/rkusbphy.c b/sys/dev/fdt/rkusbphy.c index 3807be0d674..d69d36ea825 100644 --- a/sys/dev/fdt/rkusbphy.c +++ b/sys/dev/fdt/rkusbphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkusbphy.c,v 1.5 2024/06/23 10:18:11 kettenis Exp $ */ +/* $OpenBSD: rkusbphy.c,v 1.6 2024/11/24 22:46:54 kettenis Exp $ */ /* * Copyright (c) 2023 David Gwynne <dlg@openbsd.org> @@ -62,6 +62,47 @@ struct rkusbphy_chip { }; /* + * 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, 0x2 }, + }, +}; + +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, 0x2 }, + }, + }; + +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. */ @@ -190,6 +231,7 @@ struct rkusbphy_id { #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), RKUSBPHY_ID("rockchip,rk3588-usb2phy", rkusbphy_rk3588), }; |