]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
phy: rockchip: inno-usb2: add phy definition for rk3036
authorHeiko Stuebner <heiko@sntech.de>
Sat, 3 May 2025 20:15:11 +0000 (22:15 +0200)
committerVinod Koul <vkoul@kernel.org>
Wed, 14 May 2025 11:19:29 +0000 (12:19 +0100)
The usb2phy on rk3036 is very similar to rk3128 but not 100% identical.
While most registers and bits are the same, a small fraction did get moved
around.

So we can re-use the phy-tuning function, but need a new set a bits.
The biggest change might be that the phy on rk3036 does not support the
charger detection, that rk3128 (and newer phys) have.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20250503201512.991277-3-heiko@sntech.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/rockchip/phy-rockchip-inno-usb2.c

index b5e6a864deebbcb33375001fc6ed67b2dfee6954..32fdd64d7c2a4d528cabc420b3a58319ddf43cf4 100644 (file)
@@ -1583,6 +1583,37 @@ static int rk3588_usb2phy_tuning(struct rockchip_usb2phy *rphy)
        return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3036_phy_cfgs[] = {
+       {
+               .reg = 0x17c,
+               .num_ports      = 2,
+               .phy_tuning     = rk3128_usb2phy_tuning,
+               .clkout_ctl     = { 0x017c, 11, 11, 1, 0 },
+               .port_cfgs      = {
+                       [USB2PHY_PORT_OTG] = {
+                               .phy_sus        = { 0x017c, 8, 0, 0, 0x1d1 },
+                               .bvalid_det_en  = { 0x017c, 14, 14, 0, 1 },
+                               .bvalid_det_st  = { 0x017c, 15, 15, 0, 1 },
+                               .bvalid_det_clr = { 0x017c, 15, 15, 0, 1 },
+                               .ls_det_en      = { 0x017c, 12, 12, 0, 1 },
+                               .ls_det_st      = { 0x017c, 13, 13, 0, 1 },
+                               .ls_det_clr     = { 0x017c, 13, 13, 0, 1 },
+                               .utmi_bvalid    = { 0x014c, 8, 8, 0, 1 },
+                               .utmi_id        = { 0x014c, 11, 11, 0, 1 },
+                               .utmi_ls        = { 0x014c, 10, 9, 0, 1 },
+
+                       },
+                       [USB2PHY_PORT_HOST] = {
+                               .phy_sus        = { 0x0194, 8, 0, 0, 0x1d1 },
+                               .ls_det_en      = { 0x0194, 14, 14, 0, 1 },
+                               .ls_det_st      = { 0x0194, 15, 15, 0, 1 },
+                               .ls_det_clr     = { 0x0194, 15, 15, 0, 1 }
+                       }
+               },
+       },
+       { /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3128_phy_cfgs[] = {
        {
                .reg = 0x17c,
@@ -2204,6 +2235,7 @@ static const struct rockchip_usb2phy_cfg rv1108_phy_cfgs[] = {
 
 static const struct of_device_id rockchip_usb2phy_dt_match[] = {
        { .compatible = "rockchip,px30-usb2phy", .data = &rk3328_phy_cfgs },
+       { .compatible = "rockchip,rk3036-usb2phy", .data = &rk3036_phy_cfgs },
        { .compatible = "rockchip,rk3128-usb2phy", .data = &rk3128_phy_cfgs },
        { .compatible = "rockchip,rk3228-usb2phy", .data = &rk3228_phy_cfgs },
        { .compatible = "rockchip,rk3308-usb2phy", .data = &rk3308_phy_cfgs },