The rk3328 uses a usb phy simulair to rk3399 with only
1 instead of 2 usb ports. Reuse existing U-boot driver and
add basic rk3328 support to phy-rockchip-inno-usb2.c

Signed-off-by: Johan Jonker <jbx6...@gmail.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 29 +++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 
b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 62b8ba3a4a..bfb531d3cd 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -243,6 +243,31 @@ static int rockchip_usb2phy_bind(struct udevice *dev)
        return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
+       {
+               .reg            = 0x100,
+               .port_cfgs      = {
+                       [USB2PHY_PORT_OTG] = {
+                               .phy_sus        = { 0x0100, 8, 0, 0, 0x1d1 },
+                               .bvalid_det_en  = { 0x0110, 2, 2, 0, 1 },
+                               .bvalid_det_st  = { 0x0114, 2, 2, 0, 1 },
+                               .bvalid_det_clr = { 0x0118, 2, 2, 0, 1 },
+                               .utmi_avalid    = { 0x0120, 10, 10, 0, 1 },
+                               .utmi_bvalid    = { 0x0120, 9, 9, 0, 1 },
+                       },
+                       [USB2PHY_PORT_HOST] = {
+                               .phy_sus        = { 0x104, 8, 0, 0, 0x1d1 },
+                               .ls_det_en      = { 0x110, 1, 1, 0, 1 },
+                               .ls_det_st      = { 0x114, 1, 1, 0, 1 },
+                               .ls_det_clr     = { 0x118, 1, 1, 0, 1 },
+                               .utmi_ls        = { 0x120, 17, 16, 0, 1 },
+                               .utmi_hstdet    = { 0x120, 19, 19, 0, 1 }
+                       }
+               },
+       },
+       { /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
        {
                .reg            = 0xe450,
@@ -291,6 +316,10 @@ static const struct rockchip_usb2phy_cfg 
rk3399_usb2phy_cfgs[] = {
 
 static const struct udevice_id rockchip_usb2phy_ids[] = {
        {
+               .compatible = "rockchip,rk3328-usb2phy",
+               .data = (ulong)&rk3328_usb2phy_cfgs
+       },
+       {
                .compatible = "rockchip,rk3399-usb2phy",
                .data = (ulong)&rk3399_usb2phy_cfgs,
        },
-- 
2.11.0

Reply via email to