@@ -1510,6 +1510,30 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
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 ;
@@ -1938,6 +1962,84 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
1938
1962
{ /* sentinel */ }
1939
1963
};
1940
1964
1965
+ static const struct rockchip_usb2phy_cfg rk3576_phy_cfgs [] = {
1966
+ {
1967
+ .reg = 0x0 ,
1968
+ .num_ports = 1 ,
1969
+ .phy_tuning = rk3576_usb2phy_tuning ,
1970
+ .clkout_ctl = { 0x0008 , 0 , 0 , 1 , 0 },
1971
+ .port_cfgs = {
1972
+ [USB2PHY_PORT_OTG ] = {
1973
+ .phy_sus = { 0x0000 , 8 , 0 , 0 , 0x1d1 },
1974
+ .bvalid_det_en = { 0x00c0 , 1 , 1 , 0 , 1 },
1975
+ .bvalid_det_st = { 0x00c4 , 1 , 1 , 0 , 1 },
1976
+ .bvalid_det_clr = { 0x00c8 , 1 , 1 , 0 , 1 },
1977
+ .ls_det_en = { 0x00c0 , 0 , 0 , 0 , 1 },
1978
+ .ls_det_st = { 0x00c4 , 0 , 0 , 0 , 1 },
1979
+ .ls_det_clr = { 0x00c8 , 0 , 0 , 0 , 1 },
1980
+ .disfall_en = { 0x00c0 , 6 , 6 , 0 , 1 },
1981
+ .disfall_st = { 0x00c4 , 6 , 6 , 0 , 1 },
1982
+ .disfall_clr = { 0x00c8 , 6 , 6 , 0 , 1 },
1983
+ .disrise_en = { 0x00c0 , 5 , 5 , 0 , 1 },
1984
+ .disrise_st = { 0x00c4 , 5 , 5 , 0 , 1 },
1985
+ .disrise_clr = { 0x00c8 , 5 , 5 , 0 , 1 },
1986
+ .utmi_avalid = { 0x0080 , 1 , 1 , 0 , 1 },
1987
+ .utmi_bvalid = { 0x0080 , 0 , 0 , 0 , 1 },
1988
+ .utmi_ls = { 0x0080 , 5 , 4 , 0 , 1 },
1989
+ }
1990
+ },
1991
+ .chg_det = {
1992
+ .cp_det = { 0x0080 , 8 , 8 , 0 , 1 },
1993
+ .dcp_det = { 0x0080 , 8 , 8 , 0 , 1 },
1994
+ .dp_det = { 0x0080 , 9 , 9 , 1 , 0 },
1995
+ .idm_sink_en = { 0x0010 , 5 , 5 , 1 , 0 },
1996
+ .idp_sink_en = { 0x0010 , 5 , 5 , 0 , 1 },
1997
+ .idp_src_en = { 0x0010 , 14 , 14 , 0 , 1 },
1998
+ .rdm_pdwn_en = { 0x0010 , 14 , 14 , 0 , 1 },
1999
+ .vdm_src_en = { 0x0010 , 7 , 6 , 0 , 3 },
2000
+ .vdp_src_en = { 0x0010 , 7 , 6 , 0 , 3 },
2001
+ },
2002
+ },
2003
+ {
2004
+ .reg = 0x2000 ,
2005
+ .num_ports = 1 ,
2006
+ .phy_tuning = rk3576_usb2phy_tuning ,
2007
+ .clkout_ctl = { 0x2008 , 0 , 0 , 1 , 0 },
2008
+ .port_cfgs = {
2009
+ [USB2PHY_PORT_OTG ] = {
2010
+ .phy_sus = { 0x2000 , 8 , 0 , 0 , 0x1d1 },
2011
+ .bvalid_det_en = { 0x20c0 , 1 , 1 , 0 , 1 },
2012
+ .bvalid_det_st = { 0x20c4 , 1 , 1 , 0 , 1 },
2013
+ .bvalid_det_clr = { 0x20c8 , 1 , 1 , 0 , 1 },
2014
+ .ls_det_en = { 0x20c0 , 0 , 0 , 0 , 1 },
2015
+ .ls_det_st = { 0x20c4 , 0 , 0 , 0 , 1 },
2016
+ .ls_det_clr = { 0x20c8 , 0 , 0 , 0 , 1 },
2017
+ .disfall_en = { 0x20c0 , 6 , 6 , 0 , 1 },
2018
+ .disfall_st = { 0x20c4 , 6 , 6 , 0 , 1 },
2019
+ .disfall_clr = { 0x20c8 , 6 , 6 , 0 , 1 },
2020
+ .disrise_en = { 0x20c0 , 5 , 5 , 0 , 1 },
2021
+ .disrise_st = { 0x20c4 , 5 , 5 , 0 , 1 },
2022
+ .disrise_clr = { 0x20c8 , 5 , 5 , 0 , 1 },
2023
+ .utmi_avalid = { 0x2080 , 1 , 1 , 0 , 1 },
2024
+ .utmi_bvalid = { 0x2080 , 0 , 0 , 0 , 1 },
2025
+ .utmi_ls = { 0x2080 , 5 , 4 , 0 , 1 },
2026
+ }
2027
+ },
2028
+ .chg_det = {
2029
+ .cp_det = { 0x2080 , 8 , 8 , 0 , 1 },
2030
+ .dcp_det = { 0x2080 , 8 , 8 , 0 , 1 },
2031
+ .dp_det = { 0x2080 , 9 , 9 , 1 , 0 },
2032
+ .idm_sink_en = { 0x2010 , 5 , 5 , 1 , 0 },
2033
+ .idp_sink_en = { 0x2010 , 5 , 5 , 0 , 1 },
2034
+ .idp_src_en = { 0x2010 , 14 , 14 , 0 , 1 },
2035
+ .rdm_pdwn_en = { 0x2010 , 14 , 14 , 0 , 1 },
2036
+ .vdm_src_en = { 0x2010 , 7 , 6 , 0 , 3 },
2037
+ .vdp_src_en = { 0x2010 , 7 , 6 , 0 , 3 },
2038
+ },
2039
+ },
2040
+ { /* sentinel */ }
2041
+ };
2042
+
1941
2043
static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs [] = {
1942
2044
{
1943
2045
.reg = 0x0000 ,
@@ -2109,6 +2211,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
2109
2211
{ .compatible = "rockchip,rk3366-usb2phy" , .data = & rk3366_phy_cfgs },
2110
2212
{ .compatible = "rockchip,rk3399-usb2phy" , .data = & rk3399_phy_cfgs },
2111
2213
{ .compatible = "rockchip,rk3568-usb2phy" , .data = & rk3568_phy_cfgs },
2214
+ { .compatible = "rockchip,rk3576-usb2phy" , .data = & rk3576_phy_cfgs },
2112
2215
{ .compatible = "rockchip,rk3588-usb2phy" , .data = & rk3588_phy_cfgs },
2113
2216
{ .compatible = "rockchip,rv1108-usb2phy" , .data = & rv1108_phy_cfgs },
2114
2217
{}
0 commit comments