tcphy             457 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_cfg_24m(struct rockchip_typec_phy *tcphy)
tcphy             465 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x830, tcphy->base + PMA_CMN_CTRL1);
tcphy             471 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(0x90, tcphy->base + XCVR_DIAG_LANE_FCM_EN_MGN(i));
tcphy             472 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(0x960, tcphy->base + TX_RCVDET_EN_TMR(i));
tcphy             473 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(0x30, tcphy->base + TX_RCVDET_ST_TMR(i));
tcphy             476 drivers/phy/rockchip/phy-rockchip-typec.c 	rdata = readl(tcphy->base + CMN_DIAG_HSCLK_SEL);
tcphy             479 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(rdata, tcphy->base + CMN_DIAG_HSCLK_SEL);
tcphy             482 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_cfg_usb3_pll(struct rockchip_typec_phy *tcphy)
tcphy             489 drivers/phy/rockchip/phy-rockchip-typec.c 		       tcphy->base + usb3_pll_cfg[i].addr);
tcphy             492 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_cfg_dp_pll(struct rockchip_typec_phy *tcphy)
tcphy             498 drivers/phy/rockchip/phy-rockchip-typec.c 	       tcphy->base + DP_CLK_CTL);
tcphy             502 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(dp_pll_cfg[i].value, tcphy->base + dp_pll_cfg[i].addr);
tcphy             505 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_tx_usb3_cfg_lane(struct rockchip_typec_phy *tcphy, u32 lane)
tcphy             507 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x7799, tcphy->base + TX_PSC_A0(lane));
tcphy             508 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x7798, tcphy->base + TX_PSC_A1(lane));
tcphy             509 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x5098, tcphy->base + TX_PSC_A2(lane));
tcphy             510 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x5098, tcphy->base + TX_PSC_A3(lane));
tcphy             511 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_000(lane));
tcphy             512 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0xbf, tcphy->base + XCVR_DIAG_BIDI_CTRL(lane));
tcphy             515 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_rx_usb3_cfg_lane(struct rockchip_typec_phy *tcphy, u32 lane)
tcphy             517 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0xa6fd, tcphy->base + RX_PSC_A0(lane));
tcphy             518 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0xa6fd, tcphy->base + RX_PSC_A1(lane));
tcphy             519 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0xa410, tcphy->base + RX_PSC_A2(lane));
tcphy             520 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x2410, tcphy->base + RX_PSC_A3(lane));
tcphy             521 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x23ff, tcphy->base + RX_PSC_CAL(lane));
tcphy             522 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x13, tcphy->base + RX_SIGDET_HL_FILT_TMR(lane));
tcphy             523 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x03e7, tcphy->base + RX_REE_CTRL_DATA_MASK(lane));
tcphy             524 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x1004, tcphy->base + RX_DIAG_SIGDET_TUNE(lane));
tcphy             525 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x2010, tcphy->base + RX_PSC_RDY(lane));
tcphy             526 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0xfb, tcphy->base + XCVR_DIAG_BIDI_CTRL(lane));
tcphy             529 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_dp_cfg_lane(struct rockchip_typec_phy *tcphy, u32 lane)
tcphy             533 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0xbefc, tcphy->base + XCVR_PSM_RCTRL(lane));
tcphy             534 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x6799, tcphy->base + TX_PSC_A0(lane));
tcphy             535 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x6798, tcphy->base + TX_PSC_A1(lane));
tcphy             536 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x98, tcphy->base + TX_PSC_A2(lane));
tcphy             537 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x98, tcphy->base + TX_PSC_A3(lane));
tcphy             539 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_000(lane));
tcphy             540 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_001(lane));
tcphy             541 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_010(lane));
tcphy             542 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_011(lane));
tcphy             543 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_100(lane));
tcphy             544 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_101(lane));
tcphy             545 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_110(lane));
tcphy             546 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_MGNFS_MULT_111(lane));
tcphy             547 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_CPOST_MULT_10(lane));
tcphy             548 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_CPOST_MULT_01(lane));
tcphy             549 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_CPOST_MULT_00(lane));
tcphy             550 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_TXCC_CPOST_MULT_11(lane));
tcphy             552 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x128, tcphy->base + TX_TXCC_CAL_SCLR_MULT(lane));
tcphy             553 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x400, tcphy->base + TX_DIAG_TX_DRV(lane));
tcphy             555 drivers/phy/rockchip/phy-rockchip-typec.c 	rdata = readl(tcphy->base + XCVR_DIAG_PLLDRC_CTRL(lane));
tcphy             557 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(rdata, tcphy->base + XCVR_DIAG_PLLDRC_CTRL(lane));
tcphy             560 drivers/phy/rockchip/phy-rockchip-typec.c static inline int property_enable(struct rockchip_typec_phy *tcphy,
tcphy             566 drivers/phy/rockchip/phy-rockchip-typec.c 	return regmap_write(tcphy->grf_regs, reg->offset, val | mask);
tcphy             569 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_dp_aux_set_flip(struct rockchip_typec_phy *tcphy)
tcphy             580 drivers/phy/rockchip/phy-rockchip-typec.c 	tx_ana_ctrl_reg_1 = readl(tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             581 drivers/phy/rockchip/phy-rockchip-typec.c 	if (!tcphy->flip)
tcphy             585 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             588 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy)
tcphy             601 drivers/phy/rockchip/phy-rockchip-typec.c 	val = readl(tcphy->base + CMN_TXPUCAL_CTRL);
tcphy             603 drivers/phy/rockchip/phy-rockchip-typec.c 	val = readl(tcphy->base + CMN_TXPDCAL_CTRL);
tcphy             605 drivers/phy/rockchip/phy-rockchip-typec.c 	val = readl(tcphy->base + CMN_TXPU_ADJ_CTRL);
tcphy             607 drivers/phy/rockchip/phy-rockchip-typec.c 	val = readl(tcphy->base + CMN_TXPD_ADJ_CTRL);
tcphy             612 drivers/phy/rockchip/phy-rockchip-typec.c 	tx_ana_ctrl_reg_1 = readl(tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             614 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             617 drivers/phy/rockchip/phy-rockchip-typec.c 	val = readl(tcphy->base + TX_DIG_CTRL_REG_2);
tcphy             620 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(val, tcphy->base + TX_DIG_CTRL_REG_2);
tcphy             629 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             633 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + PHY_DP_TX_CTL);
tcphy             637 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_2, tcphy->base + TX_ANA_CTRL_REG_2);
tcphy             640 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_2, tcphy->base + TX_ANA_CTRL_REG_2);
tcphy             642 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_ANA_CTRL_REG_3);
tcphy             645 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             648 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             650 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_ANA_CTRL_REG_5);
tcphy             656 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0x1001, tcphy->base + TX_ANA_CTRL_REG_4);
tcphy             660 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             663 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             670 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_2, tcphy->base + TX_ANA_CTRL_REG_2);
tcphy             673 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_2, tcphy->base + TX_ANA_CTRL_REG_2);
tcphy             690 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             693 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1);
tcphy             700 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TX_ANA_CTRL_REG_4);
tcphy             703 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TXDA_COEFF_CALC_CTRL);
tcphy             706 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(0, tcphy->base + TXDA_CYA_AUXDA_CYA);
tcphy             717 drivers/phy/rockchip/phy-rockchip-typec.c 	val = readl(tcphy->base + TX_DIG_CTRL_REG_2);
tcphy             719 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(val, tcphy->base + TX_DIG_CTRL_REG_2);
tcphy             722 drivers/phy/rockchip/phy-rockchip-typec.c static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode)
tcphy             724 drivers/phy/rockchip/phy-rockchip-typec.c 	const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
tcphy             728 drivers/phy/rockchip/phy-rockchip-typec.c 	ret = clk_prepare_enable(tcphy->clk_core);
tcphy             730 drivers/phy/rockchip/phy-rockchip-typec.c 		dev_err(tcphy->dev, "Failed to prepare_enable core clock\n");
tcphy             734 drivers/phy/rockchip/phy-rockchip-typec.c 	ret = clk_prepare_enable(tcphy->clk_ref);
tcphy             736 drivers/phy/rockchip/phy-rockchip-typec.c 		dev_err(tcphy->dev, "Failed to prepare_enable ref clock\n");
tcphy             740 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_deassert(tcphy->tcphy_rst);
tcphy             742 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip);
tcphy             743 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy_dp_aux_set_flip(tcphy);
tcphy             745 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy_cfg_24m(tcphy);
tcphy             748 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_cfg_dp_pll(tcphy);
tcphy             750 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_dp_cfg_lane(tcphy, i);
tcphy             752 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(PIN_ASSIGN_C_E, tcphy->base + PMA_LANE_CFG);
tcphy             754 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_cfg_usb3_pll(tcphy);
tcphy             755 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_cfg_dp_pll(tcphy);
tcphy             756 drivers/phy/rockchip/phy-rockchip-typec.c 		if (tcphy->flip) {
tcphy             757 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_tx_usb3_cfg_lane(tcphy, 3);
tcphy             758 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_rx_usb3_cfg_lane(tcphy, 2);
tcphy             759 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_dp_cfg_lane(tcphy, 0);
tcphy             760 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_dp_cfg_lane(tcphy, 1);
tcphy             762 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_tx_usb3_cfg_lane(tcphy, 0);
tcphy             763 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_rx_usb3_cfg_lane(tcphy, 1);
tcphy             764 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_dp_cfg_lane(tcphy, 2);
tcphy             765 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_dp_cfg_lane(tcphy, 3);
tcphy             768 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(PIN_ASSIGN_D_F, tcphy->base + PMA_LANE_CFG);
tcphy             771 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(DP_MODE_ENTER_A2, tcphy->base + DP_MODE_CTL);
tcphy             773 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_deassert(tcphy->uphy_rst);
tcphy             775 drivers/phy/rockchip/phy-rockchip-typec.c 	ret = readx_poll_timeout(readl, tcphy->base + PMA_CMN_CTRL1,
tcphy             779 drivers/phy/rockchip/phy-rockchip-typec.c 		dev_err(tcphy->dev, "wait pma ready timeout\n");
tcphy             784 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_deassert(tcphy->pipe_rst);
tcphy             789 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->uphy_rst);
tcphy             790 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->tcphy_rst);
tcphy             791 drivers/phy/rockchip/phy-rockchip-typec.c 	clk_disable_unprepare(tcphy->clk_ref);
tcphy             793 drivers/phy/rockchip/phy-rockchip-typec.c 	clk_disable_unprepare(tcphy->clk_core);
tcphy             797 drivers/phy/rockchip/phy-rockchip-typec.c static void tcphy_phy_deinit(struct rockchip_typec_phy *tcphy)
tcphy             799 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->tcphy_rst);
tcphy             800 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->uphy_rst);
tcphy             801 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->pipe_rst);
tcphy             802 drivers/phy/rockchip/phy-rockchip-typec.c 	clk_disable_unprepare(tcphy->clk_core);
tcphy             803 drivers/phy/rockchip/phy-rockchip-typec.c 	clk_disable_unprepare(tcphy->clk_ref);
tcphy             806 drivers/phy/rockchip/phy-rockchip-typec.c static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
tcphy             808 drivers/phy/rockchip/phy-rockchip-typec.c 	struct extcon_dev *edev = tcphy->extcon;
tcphy             834 drivers/phy/rockchip/phy-rockchip-typec.c 			dev_err(tcphy->dev, "get superspeed property failed\n");
tcphy             845 drivers/phy/rockchip/phy-rockchip-typec.c 		dev_err(tcphy->dev, "get polarity property failed\n");
tcphy             849 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->flip = property.intval ? 1 : 0;
tcphy             854 drivers/phy/rockchip/phy-rockchip-typec.c static int tcphy_cfg_usb3_to_usb2_only(struct rockchip_typec_phy *tcphy,
tcphy             857 drivers/phy/rockchip/phy-rockchip-typec.c 	const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
tcphy             859 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->usb3tousb2_en, value);
tcphy             860 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->usb3_host_disable, value);
tcphy             861 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->usb3_host_port, !value);
tcphy             868 drivers/phy/rockchip/phy-rockchip-typec.c 	struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
tcphy             869 drivers/phy/rockchip/phy-rockchip-typec.c 	const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
tcphy             874 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_lock(&tcphy->lock);
tcphy             876 drivers/phy/rockchip/phy-rockchip-typec.c 	new_mode = tcphy_get_mode(tcphy);
tcphy             884 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_cfg_usb3_to_usb2_only(tcphy, true);
tcphy             888 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == new_mode)
tcphy             891 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT) {
tcphy             892 drivers/phy/rockchip/phy-rockchip-typec.c 		ret = tcphy_phy_init(tcphy, new_mode);
tcphy             899 drivers/phy/rockchip/phy-rockchip-typec.c 		regmap_read(tcphy->grf_regs, reg->offset, &val);
tcphy             901 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy->mode |= new_mode & (MODE_DFP_USB | MODE_UFP_USB);
tcphy             904 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy_cfg_usb3_to_usb2_only(tcphy, false);
tcphy             910 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT)
tcphy             911 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_phy_deinit(tcphy);
tcphy             916 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_unlock(&tcphy->lock);
tcphy             922 drivers/phy/rockchip/phy-rockchip-typec.c 	struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
tcphy             924 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_lock(&tcphy->lock);
tcphy             925 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy_cfg_usb3_to_usb2_only(tcphy, false);
tcphy             927 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT)
tcphy             930 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->mode &= ~(MODE_UFP_USB | MODE_DFP_USB);
tcphy             931 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT)
tcphy             932 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_phy_deinit(tcphy);
tcphy             935 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_unlock(&tcphy->lock);
tcphy             947 drivers/phy/rockchip/phy-rockchip-typec.c 	struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
tcphy             948 drivers/phy/rockchip/phy-rockchip-typec.c 	const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
tcphy             952 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_lock(&tcphy->lock);
tcphy             954 drivers/phy/rockchip/phy-rockchip-typec.c 	new_mode = tcphy_get_mode(tcphy);
tcphy             965 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == new_mode)
tcphy             972 drivers/phy/rockchip/phy-rockchip-typec.c 	if (new_mode == MODE_DFP_DP && tcphy->mode != MODE_DISCONNECT) {
tcphy             973 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_phy_deinit(tcphy);
tcphy             974 drivers/phy/rockchip/phy-rockchip-typec.c 		ret = tcphy_phy_init(tcphy, new_mode);
tcphy             975 drivers/phy/rockchip/phy-rockchip-typec.c 	} else if (tcphy->mode == MODE_DISCONNECT) {
tcphy             976 drivers/phy/rockchip/phy-rockchip-typec.c 		ret = tcphy_phy_init(tcphy, new_mode);
tcphy             981 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->uphy_dp_sel, 1);
tcphy             983 drivers/phy/rockchip/phy-rockchip-typec.c 	ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL,
tcphy             987 drivers/phy/rockchip/phy-rockchip-typec.c 		dev_err(tcphy->dev, "failed to wait TCPHY enter A2\n");
tcphy             991 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy_dp_aux_calibration(tcphy);
tcphy             993 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(DP_MODE_ENTER_A0, tcphy->base + DP_MODE_CTL);
tcphy             995 drivers/phy/rockchip/phy-rockchip-typec.c 	ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL,
tcphy             999 drivers/phy/rockchip/phy-rockchip-typec.c 		writel(DP_MODE_ENTER_A2, tcphy->base + DP_MODE_CTL);
tcphy            1000 drivers/phy/rockchip/phy-rockchip-typec.c 		dev_err(tcphy->dev, "failed to wait TCPHY enter A0\n");
tcphy            1004 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->mode |= MODE_DFP_DP;
tcphy            1007 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT)
tcphy            1008 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_phy_deinit(tcphy);
tcphy            1010 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_unlock(&tcphy->lock);
tcphy            1016 drivers/phy/rockchip/phy-rockchip-typec.c 	struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
tcphy            1018 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_lock(&tcphy->lock);
tcphy            1020 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT)
tcphy            1023 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->mode &= ~MODE_DFP_DP;
tcphy            1025 drivers/phy/rockchip/phy-rockchip-typec.c 	writel(DP_MODE_ENTER_A2, tcphy->base + DP_MODE_CTL);
tcphy            1027 drivers/phy/rockchip/phy-rockchip-typec.c 	if (tcphy->mode == MODE_DISCONNECT)
tcphy            1028 drivers/phy/rockchip/phy-rockchip-typec.c 		tcphy_phy_deinit(tcphy);
tcphy            1031 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_unlock(&tcphy->lock);
tcphy            1041 drivers/phy/rockchip/phy-rockchip-typec.c static int tcphy_parse_dt(struct rockchip_typec_phy *tcphy,
tcphy            1044 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->grf_regs = syscon_regmap_lookup_by_phandle(dev->of_node,
tcphy            1046 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->grf_regs)) {
tcphy            1048 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->grf_regs);
tcphy            1051 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->clk_core = devm_clk_get(dev, "tcpdcore");
tcphy            1052 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->clk_core)) {
tcphy            1054 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->clk_core);
tcphy            1057 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->clk_ref = devm_clk_get(dev, "tcpdphy-ref");
tcphy            1058 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->clk_ref)) {
tcphy            1060 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->clk_ref);
tcphy            1063 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->uphy_rst = devm_reset_control_get(dev, "uphy");
tcphy            1064 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->uphy_rst)) {
tcphy            1066 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->uphy_rst);
tcphy            1069 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->pipe_rst = devm_reset_control_get(dev, "uphy-pipe");
tcphy            1070 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->pipe_rst)) {
tcphy            1072 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->pipe_rst);
tcphy            1075 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->tcphy_rst = devm_reset_control_get(dev, "uphy-tcphy");
tcphy            1076 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->tcphy_rst)) {
tcphy            1078 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->tcphy_rst);
tcphy            1084 drivers/phy/rockchip/phy-rockchip-typec.c static void typec_phy_pre_init(struct rockchip_typec_phy *tcphy)
tcphy            1086 drivers/phy/rockchip/phy-rockchip-typec.c 	const struct rockchip_usb3phy_port_cfg *cfg = tcphy->port_cfgs;
tcphy            1088 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->tcphy_rst);
tcphy            1089 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->uphy_rst);
tcphy            1090 drivers/phy/rockchip/phy-rockchip-typec.c 	reset_control_assert(tcphy->pipe_rst);
tcphy            1093 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->external_psm, 1);
tcphy            1094 drivers/phy/rockchip/phy-rockchip-typec.c 	property_enable(tcphy, &cfg->usb3tousb2_en, 0);
tcphy            1096 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->mode = MODE_DISCONNECT;
tcphy            1104 drivers/phy/rockchip/phy-rockchip-typec.c 	struct rockchip_typec_phy *tcphy;
tcphy            1111 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy = devm_kzalloc(dev, sizeof(*tcphy), GFP_KERNEL);
tcphy            1112 drivers/phy/rockchip/phy-rockchip-typec.c 	if (!tcphy)
tcphy            1122 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->base = devm_ioremap_resource(dev, res);
tcphy            1123 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->base))
tcphy            1124 drivers/phy/rockchip/phy-rockchip-typec.c 		return PTR_ERR(tcphy->base);
tcphy            1131 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy->port_cfgs = &phy_cfgs[index];
tcphy            1138 drivers/phy/rockchip/phy-rockchip-typec.c 	if (!tcphy->port_cfgs) {
tcphy            1144 drivers/phy/rockchip/phy-rockchip-typec.c 	ret = tcphy_parse_dt(tcphy, dev);
tcphy            1148 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->dev = dev;
tcphy            1149 drivers/phy/rockchip/phy-rockchip-typec.c 	platform_set_drvdata(pdev, tcphy);
tcphy            1150 drivers/phy/rockchip/phy-rockchip-typec.c 	mutex_init(&tcphy->lock);
tcphy            1152 drivers/phy/rockchip/phy-rockchip-typec.c 	typec_phy_pre_init(tcphy);
tcphy            1154 drivers/phy/rockchip/phy-rockchip-typec.c 	tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
tcphy            1155 drivers/phy/rockchip/phy-rockchip-typec.c 	if (IS_ERR(tcphy->extcon)) {
tcphy            1156 drivers/phy/rockchip/phy-rockchip-typec.c 		if (PTR_ERR(tcphy->extcon) == -ENODEV) {
tcphy            1157 drivers/phy/rockchip/phy-rockchip-typec.c 			tcphy->extcon = NULL;
tcphy            1159 drivers/phy/rockchip/phy-rockchip-typec.c 			if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
tcphy            1161 drivers/phy/rockchip/phy-rockchip-typec.c 			return PTR_ERR(tcphy->extcon);
tcphy            1186 drivers/phy/rockchip/phy-rockchip-typec.c 		phy_set_drvdata(phy, tcphy);