Lines Matching refs:instance

324 	struct mtk_phy_instance *instance)
326 struct u2phy_banks *u2_banks = &instance->u2_banks;
334 if (instance->eye_src)
353 tmp |= P2F_RG_MONCLK_SEL_VAL(instance->index >> 1);
388 instance->index, fm_out, calibration_val,
404 struct mtk_phy_instance *instance)
406 struct u3phy_banks *u3_banks = &instance->u3_banks;
450 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index);
454 struct mtk_phy_instance *instance)
456 struct u2phy_banks *u2_banks = &instance->u2_banks;
458 u32 index = instance->index;
516 struct mtk_phy_instance *instance)
518 struct u2phy_banks *u2_banks = &instance->u2_banks;
520 u32 index = instance->index;
550 struct mtk_phy_instance *instance)
552 struct u2phy_banks *u2_banks = &instance->u2_banks;
554 u32 index = instance->index;
585 struct mtk_phy_instance *instance)
587 struct u2phy_banks *u2_banks = &instance->u2_banks;
589 u32 index = instance->index;
604 struct mtk_phy_instance *instance,
607 struct u2phy_banks *u2_banks = &instance->u2_banks;
629 struct mtk_phy_instance *instance)
631 struct u3phy_banks *u3_banks = &instance->u3_banks;
698 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index);
702 struct mtk_phy_instance *instance)
704 struct u3phy_banks *bank = &instance->u3_banks;
717 struct mtk_phy_instance *instance)
720 struct u3phy_banks *bank = &instance->u3_banks;
733 struct mtk_phy_instance *instance)
735 struct u3phy_banks *u3_banks = &instance->u3_banks;
787 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index);
791 struct mtk_phy_instance *instance)
793 struct u2phy_banks *u2_banks = &instance->u2_banks;
794 struct u3phy_banks *u3_banks = &instance->u3_banks;
796 switch (instance->type) {
800 u2_banks->com = instance->port_base + SSUSB_SIFSLV_V1_U2PHY_COM;
806 u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD;
807 u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA;
810 u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD;
819 struct mtk_phy_instance *instance)
821 struct u2phy_banks *u2_banks = &instance->u2_banks;
822 struct u3phy_banks *u3_banks = &instance->u3_banks;
824 switch (instance->type) {
826 u2_banks->misc = instance->port_base + SSUSB_SIFSLV_V2_MISC;
827 u2_banks->fmreg = instance->port_base + SSUSB_SIFSLV_V2_U2FREQ;
828 u2_banks->com = instance->port_base + SSUSB_SIFSLV_V2_U2PHY_COM;
832 u3_banks->spllc = instance->port_base + SSUSB_SIFSLV_V2_SPLLC;
833 u3_banks->chip = instance->port_base + SSUSB_SIFSLV_V2_CHIP;
834 u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V2_U3PHYD;
835 u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V2_U3PHYA;
844 struct mtk_phy_instance *instance)
846 struct device *dev = &instance->phy->dev;
848 if (instance->type != PHY_TYPE_USB2)
851 instance->bc12_en = device_property_read_bool(dev, "mediatek,bc12");
853 &instance->eye_src);
855 &instance->eye_vrt);
857 &instance->eye_term);
859 &instance->intr);
861 &instance->discth);
863 instance->bc12_en, instance->eye_src,
864 instance->eye_vrt, instance->eye_term,
865 instance->intr, instance->discth);
869 struct mtk_phy_instance *instance)
871 struct u2phy_banks *u2_banks = &instance->u2_banks;
875 if (instance->bc12_en) {
881 if (instance->eye_src) {
884 tmp |= PA5_RG_U2_HSTX_SRCTRL_VAL(instance->eye_src);
888 if (instance->eye_vrt) {
891 tmp |= PA1_RG_VRT_SEL_VAL(instance->eye_vrt);
895 if (instance->eye_term) {
898 tmp |= PA1_RG_TERM_SEL_VAL(instance->eye_term);
902 if (instance->intr) {
905 tmp |= PA1_RG_INTR_CAL_VAL(instance->intr);
909 if (instance->discth) {
912 tmp |= PA6_RG_U2_DISCTH_VAL(instance->discth);
919 struct mtk_phy_instance *instance = phy_get_drvdata(phy);
923 ret = clk_prepare_enable(instance->ref_clk);
929 ret = clk_prepare_enable(instance->da_ref_clk);
932 clk_disable_unprepare(instance->ref_clk);
936 switch (instance->type) {
938 u2_phy_instance_init(tphy, instance);
939 u2_phy_props_set(tphy, instance);
942 u3_phy_instance_init(tphy, instance);
945 pcie_phy_instance_init(tphy, instance);
948 sata_phy_instance_init(tphy, instance);
952 clk_disable_unprepare(instance->ref_clk);
953 clk_disable_unprepare(instance->da_ref_clk);
962 struct mtk_phy_instance *instance = phy_get_drvdata(phy);
965 if (instance->type == PHY_TYPE_USB2) {
966 u2_phy_instance_power_on(tphy, instance);
967 hs_slew_rate_calibrate(tphy, instance);
968 } else if (instance->type == PHY_TYPE_PCIE) {
969 pcie_phy_instance_power_on(tphy, instance);
977 struct mtk_phy_instance *instance = phy_get_drvdata(phy);
980 if (instance->type == PHY_TYPE_USB2)
981 u2_phy_instance_power_off(tphy, instance);
982 else if (instance->type == PHY_TYPE_PCIE)
983 pcie_phy_instance_power_off(tphy, instance);
990 struct mtk_phy_instance *instance = phy_get_drvdata(phy);
993 if (instance->type == PHY_TYPE_USB2)
994 u2_phy_instance_exit(tphy, instance);
996 clk_disable_unprepare(instance->ref_clk);
997 clk_disable_unprepare(instance->da_ref_clk);
1003 struct mtk_phy_instance *instance = phy_get_drvdata(phy);
1006 if (instance->type == PHY_TYPE_USB2)
1007 u2_phy_instance_set_mode(tphy, instance, mode);
1016 struct mtk_phy_instance *instance = NULL;
1027 instance = tphy->phys[index];
1031 if (!instance) {
1036 instance->type = args->args[0];
1037 if (!(instance->type == PHY_TYPE_USB2 ||
1038 instance->type == PHY_TYPE_USB3 ||
1039 instance->type == PHY_TYPE_PCIE ||
1040 instance->type == PHY_TYPE_SATA)) {
1041 dev_err(dev, "unsupported device type: %d\n", instance->type);
1046 phy_v1_banks_init(tphy, instance);
1048 phy_v2_banks_init(tphy, instance);
1054 phy_parse_property(tphy, instance);
1056 return instance->phy;
1141 struct mtk_phy_instance *instance;
1144 instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL);
1145 if (!instance) {
1150 tphy->phys[port] = instance;
1166 instance->port_base = devm_ioremap_resource(&phy->dev, &res);
1167 if (IS_ERR(instance->port_base)) {
1169 retval = PTR_ERR(instance->port_base);
1173 instance->phy = phy;
1174 instance->index = port;
1175 phy_set_drvdata(phy, instance);
1178 instance->ref_clk = devm_clk_get_optional(&phy->dev, "ref");
1179 if (IS_ERR(instance->ref_clk)) {
1181 retval = PTR_ERR(instance->ref_clk);
1185 instance->da_ref_clk =
1187 if (IS_ERR(instance->da_ref_clk)) {
1189 retval = PTR_ERR(instance->da_ref_clk);