Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: rockchip: inno-usb2: Add usb2 phys support for rk3576

The RK3576 SoC has two independent USB2.0 PHYs, and each PHY has
one port. This adds device specific data for it.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20241016073713.14133-4-frawang.cn@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

William Wu and committed by
Vinod Koul
3d7de6e8 0217f4ae

+103
+103
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
··· 1510 1510 BIT(2) << BIT_WRITEABLE_SHIFT | 0); 1511 1511 } 1512 1512 1513 + static int rk3576_usb2phy_tuning(struct rockchip_usb2phy *rphy) 1514 + { 1515 + int ret; 1516 + u32 reg = rphy->phy_cfg->reg; 1517 + 1518 + /* Deassert SIDDQ to power on analog block */ 1519 + ret = regmap_write(rphy->grf, reg + 0x0010, GENMASK(29, 29) | 0x0000); 1520 + if (ret) 1521 + return ret; 1522 + 1523 + /* Do reset after exit IDDQ mode */ 1524 + ret = rockchip_usb2phy_reset(rphy); 1525 + if (ret) 1526 + return ret; 1527 + 1528 + /* HS DC Voltage Level Adjustment 4'b1001 : +5.89% */ 1529 + ret |= regmap_write(rphy->grf, reg + 0x000c, GENMASK(27, 24) | 0x0900); 1530 + 1531 + /* HS Transmitter Pre-Emphasis Current Control 2'b10 : 2x */ 1532 + ret |= regmap_write(rphy->grf, reg + 0x0010, GENMASK(20, 19) | 0x0010); 1533 + 1534 + return ret; 1535 + } 1536 + 1513 1537 static int rk3588_usb2phy_tuning(struct rockchip_usb2phy *rphy) 1514 1538 { 1515 1539 int ret; ··· 1962 1938 { /* sentinel */ } 1963 1939 }; 1964 1940 1941 + static const struct rockchip_usb2phy_cfg rk3576_phy_cfgs[] = { 1942 + { 1943 + .reg = 0x0, 1944 + .num_ports = 1, 1945 + .phy_tuning = rk3576_usb2phy_tuning, 1946 + .clkout_ctl = { 0x0008, 0, 0, 1, 0 }, 1947 + .port_cfgs = { 1948 + [USB2PHY_PORT_OTG] = { 1949 + .phy_sus = { 0x0000, 8, 0, 0, 0x1d1 }, 1950 + .bvalid_det_en = { 0x00c0, 1, 1, 0, 1 }, 1951 + .bvalid_det_st = { 0x00c4, 1, 1, 0, 1 }, 1952 + .bvalid_det_clr = { 0x00c8, 1, 1, 0, 1 }, 1953 + .ls_det_en = { 0x00c0, 0, 0, 0, 1 }, 1954 + .ls_det_st = { 0x00c4, 0, 0, 0, 1 }, 1955 + .ls_det_clr = { 0x00c8, 0, 0, 0, 1 }, 1956 + .disfall_en = { 0x00c0, 6, 6, 0, 1 }, 1957 + .disfall_st = { 0x00c4, 6, 6, 0, 1 }, 1958 + .disfall_clr = { 0x00c8, 6, 6, 0, 1 }, 1959 + .disrise_en = { 0x00c0, 5, 5, 0, 1 }, 1960 + .disrise_st = { 0x00c4, 5, 5, 0, 1 }, 1961 + .disrise_clr = { 0x00c8, 5, 5, 0, 1 }, 1962 + .utmi_avalid = { 0x0080, 1, 1, 0, 1 }, 1963 + .utmi_bvalid = { 0x0080, 0, 0, 0, 1 }, 1964 + .utmi_ls = { 0x0080, 5, 4, 0, 1 }, 1965 + } 1966 + }, 1967 + .chg_det = { 1968 + .cp_det = { 0x0080, 8, 8, 0, 1 }, 1969 + .dcp_det = { 0x0080, 8, 8, 0, 1 }, 1970 + .dp_det = { 0x0080, 9, 9, 1, 0 }, 1971 + .idm_sink_en = { 0x0010, 5, 5, 1, 0 }, 1972 + .idp_sink_en = { 0x0010, 5, 5, 0, 1 }, 1973 + .idp_src_en = { 0x0010, 14, 14, 0, 1 }, 1974 + .rdm_pdwn_en = { 0x0010, 14, 14, 0, 1 }, 1975 + .vdm_src_en = { 0x0010, 7, 6, 0, 3 }, 1976 + .vdp_src_en = { 0x0010, 7, 6, 0, 3 }, 1977 + }, 1978 + }, 1979 + { 1980 + .reg = 0x2000, 1981 + .num_ports = 1, 1982 + .phy_tuning = rk3576_usb2phy_tuning, 1983 + .clkout_ctl = { 0x2008, 0, 0, 1, 0 }, 1984 + .port_cfgs = { 1985 + [USB2PHY_PORT_OTG] = { 1986 + .phy_sus = { 0x2000, 8, 0, 0, 0x1d1 }, 1987 + .bvalid_det_en = { 0x20c0, 1, 1, 0, 1 }, 1988 + .bvalid_det_st = { 0x20c4, 1, 1, 0, 1 }, 1989 + .bvalid_det_clr = { 0x20c8, 1, 1, 0, 1 }, 1990 + .ls_det_en = { 0x20c0, 0, 0, 0, 1 }, 1991 + .ls_det_st = { 0x20c4, 0, 0, 0, 1 }, 1992 + .ls_det_clr = { 0x20c8, 0, 0, 0, 1 }, 1993 + .disfall_en = { 0x20c0, 6, 6, 0, 1 }, 1994 + .disfall_st = { 0x20c4, 6, 6, 0, 1 }, 1995 + .disfall_clr = { 0x20c8, 6, 6, 0, 1 }, 1996 + .disrise_en = { 0x20c0, 5, 5, 0, 1 }, 1997 + .disrise_st = { 0x20c4, 5, 5, 0, 1 }, 1998 + .disrise_clr = { 0x20c8, 5, 5, 0, 1 }, 1999 + .utmi_avalid = { 0x2080, 1, 1, 0, 1 }, 2000 + .utmi_bvalid = { 0x2080, 0, 0, 0, 1 }, 2001 + .utmi_ls = { 0x2080, 5, 4, 0, 1 }, 2002 + } 2003 + }, 2004 + .chg_det = { 2005 + .cp_det = { 0x2080, 8, 8, 0, 1 }, 2006 + .dcp_det = { 0x2080, 8, 8, 0, 1 }, 2007 + .dp_det = { 0x2080, 9, 9, 1, 0 }, 2008 + .idm_sink_en = { 0x2010, 5, 5, 1, 0 }, 2009 + .idp_sink_en = { 0x2010, 5, 5, 0, 1 }, 2010 + .idp_src_en = { 0x2010, 14, 14, 0, 1 }, 2011 + .rdm_pdwn_en = { 0x2010, 14, 14, 0, 1 }, 2012 + .vdm_src_en = { 0x2010, 7, 6, 0, 3 }, 2013 + .vdp_src_en = { 0x2010, 7, 6, 0, 3 }, 2014 + }, 2015 + }, 2016 + { /* sentinel */ } 2017 + }; 2018 + 1965 2019 static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { 1966 2020 { 1967 2021 .reg = 0x0000, ··· 2211 2109 { .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs }, 2212 2110 { .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs }, 2213 2111 { .compatible = "rockchip,rk3568-usb2phy", .data = &rk3568_phy_cfgs }, 2112 + { .compatible = "rockchip,rk3576-usb2phy", .data = &rk3576_phy_cfgs }, 2214 2113 { .compatible = "rockchip,rk3588-usb2phy", .data = &rk3588_phy_cfgs }, 2215 2114 { .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs }, 2216 2115 {}