diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c index dfea2561af21478a3dbf27777190d68ba4deafbd..b4f055bcf868cba677c1133f0c55f713b42cfbfb 100644 --- a/drivers/phy/phy-rockchip-inno-usb2.c +++ b/drivers/phy/phy-rockchip-inno-usb2.c @@ -861,6 +861,41 @@ static int rk3328_usb2phy_tuning(struct rockchip_usb2phy *rphy) return 0; } +static int rv1103b_usb2phy_tuning(struct rockchip_usb2phy *rphy) +{ + /* Always enable pre-emphasis in SOF & EOP & chirp & non-chirp state */ + phy_update_bits(rphy->phy_base + 0x30, GENMASK(2, 0), 0x07); + + /* Set Tx HS pre_emphasize strength to 3'b001 */ + phy_update_bits(rphy->phy_base + 0x40, GENMASK(5, 3), (0x01 << 3)); + + /* Set RX Squelch trigger point configure to 4'b0000(112.5 mV) */ + phy_update_bits(rphy->phy_base + 0x64, GENMASK(6, 3), (0x00 << 3)); + + /* Turn off differential receiver by default to save power */ + phy_clear_bits(rphy->phy_base + 0x100, BIT(6)); + + /* Set 45ohm HS ODT value to 5'b10111 to increase driver strength */ + phy_update_bits(rphy->phy_base + 0x11c, GENMASK(4, 0), 0x17); + + /* Set Tx HS eye height tuning to 3'b011(462 mV)*/ + phy_update_bits(rphy->phy_base + 0x124, GENMASK(4, 2), (0x03 << 2)); + + /* Bypass Squelch detector calibration */ + phy_update_bits(rphy->phy_base + 0x1a4, GENMASK(7, 4), (0x01 << 4)); + phy_update_bits(rphy->phy_base + 0x1b4, GENMASK(7, 4), (0x01 << 4)); + + /* Set HS disconnect detect mode to single ended detect mode */ + phy_set_bits(rphy->phy_base + 0x70, BIT(2)); + + /* Set Host Disconnect Detection to 675mV */ + phy_update_bits(rphy->phy_base + 0x60, GENMASK(1, 0), 0x0); + phy_update_bits(rphy->phy_base + 0x64, GENMASK(7, 7), BIT(7)); + phy_update_bits(rphy->phy_base + 0x68, GENMASK(0, 0), 0x0); + + return 0; +} + static int rv1106_usb2phy_tuning(struct rockchip_usb2phy *rphy) { /* Set HS disconnect detect mode to single ended detect mode */ @@ -1481,6 +1516,51 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = { { /* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rv1103b_phy_cfgs[] = { + { + .reg = 0x20e10000, + .num_ports = 1, + .phy_tuning = rv1103b_usb2phy_tuning, + .clkout_ctl = { 0x50058, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x50050, 8, 0, 0, 0x1d1 }, + .bvalid_det_en = { 0x50100, 2, 2, 0, 1 }, + .bvalid_det_st = { 0x50104, 2, 2, 0, 1 }, + .bvalid_det_clr = { 0x50108, 2, 2, 0, 1 }, + .iddig_output = { 0x50050, 10, 10, 0, 1 }, + .iddig_en = { 0x50050, 9, 9, 0, 1 }, + .idfall_det_en = { 0x50100, 5, 5, 0, 1 }, + .idfall_det_st = { 0x50104, 5, 5, 0, 1 }, + .idfall_det_clr = { 0x50108, 5, 5, 0, 1 }, + .idrise_det_en = { 0x50100, 4, 4, 0, 1 }, + .idrise_det_st = { 0x50104, 4, 4, 0, 1 }, + .idrise_det_clr = { 0x50108, 4, 4, 0, 1 }, + .ls_det_en = { 0x50100, 0, 0, 0, 1 }, + .ls_det_st = { 0x50104, 0, 0, 0, 1 }, + .ls_det_clr = { 0x50108, 0, 0, 0, 1 }, + .utmi_avalid = { 0x50060, 10, 10, 0, 1 }, + .utmi_bvalid = { 0x50060, 9, 9, 0, 1 }, + .utmi_iddig = { 0x50060, 6, 6, 0, 1 }, + .utmi_ls = { 0x50060, 5, 4, 0, 1 }, + }, + }, + .chg_det = { + .opmode = { 0x50050, 3, 0, 5, 1 }, + .cp_det = { 0x50060, 13, 13, 0, 1 }, + .dcp_det = { 0x50060, 12, 12, 0, 1 }, + .dp_det = { 0x50060, 14, 14, 0, 1 }, + .idm_sink_en = { 0x50058, 8, 8, 0, 1 }, + .idp_sink_en = { 0x50058, 7, 7, 0, 1 }, + .idp_src_en = { 0x50058, 9, 9, 0, 1 }, + .rdm_pdwn_en = { 0x50058, 10, 10, 0, 1 }, + .vdm_src_en = { 0x50058, 12, 12, 0, 1 }, + .vdp_src_en = { 0x50058, 11, 11, 0, 1 }, + }, + }, + { /* sentinel */ } +}; + static const struct rockchip_usb2phy_cfg rv1106_phy_cfgs[] = { { .reg = 0xff3e0000, @@ -1976,6 +2056,9 @@ static const struct udevice_id rockchip_usb2phy_ids[] = { #ifdef CONFIG_ROCKCHIP_RK3588 { .compatible = "rockchip,rk3588-usb2phy", .data = (ulong)&rk3588_phy_cfgs }, #endif +#ifdef CONFIG_ROCKCHIP_RV1103B + { .compatible = "rockchip,rv1103b-usb2phy", .data = (ulong)&rv1103b_phy_cfgs }, +#endif #ifdef CONFIG_ROCKCHIP_RV1106 { .compatible = "rockchip,rv1106-usb2phy", .data = (ulong)&rv1106_phy_cfgs }, #endif