Lines Matching refs:instance

290 			       struct mtk_phy_instance *instance)  in u2_phy_pll_26m_set()  argument
292 struct u2phy_banks *u2_banks = &instance->u2_banks; in u2_phy_pll_26m_set()
310 struct mtk_phy_instance *instance) in u2_phy_instance_init() argument
312 struct u2phy_banks *u2_banks = &instance->u2_banks; in u2_phy_instance_init()
338 u2_phy_pll_26m_set(tphy, instance); in u2_phy_instance_init()
340 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); in u2_phy_instance_init()
344 struct mtk_phy_instance *instance) in u2_phy_instance_power_on() argument
346 struct u2phy_banks *u2_banks = &instance->u2_banks; in u2_phy_instance_power_on()
358 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); in u2_phy_instance_power_on()
362 struct mtk_phy_instance *instance) in u2_phy_instance_power_off() argument
364 struct u2phy_banks *u2_banks = &instance->u2_banks; in u2_phy_instance_power_off()
376 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); in u2_phy_instance_power_off()
380 struct mtk_phy_instance *instance) in u3_phy_instance_init() argument
382 struct u3phy_banks *u3_banks = &instance->u3_banks; in u3_phy_instance_init()
416 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); in u3_phy_instance_init()
420 struct mtk_phy_instance *instance) in pcie_phy_instance_init() argument
422 struct u3phy_banks *u3_banks = &instance->u3_banks; in pcie_phy_instance_init()
476 struct mtk_phy_instance *instance) in sata_phy_instance_init() argument
478 struct u3phy_banks *u3_banks = &instance->u3_banks; in sata_phy_instance_init()
517 struct mtk_phy_instance *instance) in pcie_phy_instance_power_on() argument
519 struct u3phy_banks *bank = &instance->u3_banks; in pcie_phy_instance_power_on()
528 struct mtk_phy_instance *instance) in pcie_phy_instance_power_off() argument
531 struct u3phy_banks *bank = &instance->u3_banks; in pcie_phy_instance_power_off()
540 struct mtk_phy_instance *instance) in phy_v1_banks_init() argument
542 struct u2phy_banks *u2_banks = &instance->u2_banks; in phy_v1_banks_init()
543 struct u3phy_banks *u3_banks = &instance->u3_banks; in phy_v1_banks_init()
545 switch (instance->type) { in phy_v1_banks_init()
549 u2_banks->com = instance->port_base + SSUSB_SIFSLV_V1_U2PHY_COM; in phy_v1_banks_init()
555 u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; in phy_v1_banks_init()
556 u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; in phy_v1_banks_init()
559 u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; in phy_v1_banks_init()
568 struct mtk_phy_instance *instance) in phy_v2_banks_init() argument
570 struct u2phy_banks *u2_banks = &instance->u2_banks; in phy_v2_banks_init()
571 struct u3phy_banks *u3_banks = &instance->u3_banks; in phy_v2_banks_init()
573 switch (instance->type) { in phy_v2_banks_init()
575 u2_banks->misc = instance->port_base + SSUSB_SIFSLV_V2_MISC; in phy_v2_banks_init()
576 u2_banks->fmreg = instance->port_base + SSUSB_SIFSLV_V2_U2FREQ; in phy_v2_banks_init()
577 u2_banks->com = instance->port_base + SSUSB_SIFSLV_V2_U2PHY_COM; in phy_v2_banks_init()
581 u3_banks->spllc = instance->port_base + SSUSB_SIFSLV_V2_SPLLC; in phy_v2_banks_init()
582 u3_banks->chip = instance->port_base + SSUSB_SIFSLV_V2_CHIP; in phy_v2_banks_init()
583 u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V2_U3PHYD; in phy_v2_banks_init()
584 u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V2_U3PHYA; in phy_v2_banks_init()
593 struct mtk_phy_instance *instance) in phy_parse_property() argument
595 ofnode node = np_to_ofnode(instance->np); in phy_parse_property()
597 if (instance->type != PHY_TYPE_USB2) in phy_parse_property()
600 ofnode_read_u32(node, "mediatek,eye-vrt", &instance->eye_vrt); in phy_parse_property()
601 ofnode_read_u32(node, "mediatek,eye-term", &instance->eye_term); in phy_parse_property()
602 ofnode_read_u32(node, "mediatek,discth", &instance->discth); in phy_parse_property()
603 ofnode_read_u32(node, "mediatek,pre-emphasis", &instance->pre_emphasis); in phy_parse_property()
606 instance->eye_vrt, instance->eye_term, in phy_parse_property()
607 instance->discth, instance->pre_emphasis); in phy_parse_property()
611 struct mtk_phy_instance *instance) in u2_phy_props_set() argument
613 struct u2phy_banks *u2_banks = &instance->u2_banks; in u2_phy_props_set()
616 if (instance->eye_vrt) in u2_phy_props_set()
618 FIELD_PREP(PA1_RG_VRT_SEL, instance->eye_vrt)); in u2_phy_props_set()
620 if (instance->eye_term) in u2_phy_props_set()
622 FIELD_PREP(PA1_RG_TERM_SEL, instance->eye_term)); in u2_phy_props_set()
624 if (instance->discth) in u2_phy_props_set()
626 FIELD_PREP(PA6_RG_U2_DISCTH, instance->discth)); in u2_phy_props_set()
628 if (instance->pre_emphasis) in u2_phy_props_set()
630 FIELD_PREP(PA6_RG_U2_PRE_EMP, instance->pre_emphasis)); in u2_phy_props_set()
634 static int phy_type_syscon_get(struct udevice *dev, struct mtk_phy_instance *instance, in phy_type_syscon_get() argument
648 instance->type_sw_reg = args.args[0]; in phy_type_syscon_get()
649 instance->type_sw_index = args.args[1] & 0x3; /* <=3 */ in phy_type_syscon_get()
650 instance->type_sw = syscon_node_to_regmap(args.node); in phy_type_syscon_get()
651 if (IS_ERR(instance->type_sw)) in phy_type_syscon_get()
652 return PTR_ERR(instance->type_sw); in phy_type_syscon_get()
655 dev->name, instance->index, instance->type_sw_reg, in phy_type_syscon_get()
656 instance->type_sw_index); in phy_type_syscon_get()
661 static int phy_type_set(struct mtk_phy_instance *instance) in phy_type_set() argument
666 if (!instance->type_sw) in phy_type_set()
669 switch (instance->type) { in phy_type_set()
687 offset = instance->type_sw_index * BITS_PER_BYTE; in phy_type_set()
688 regmap_update_bits(instance->type_sw, instance->type_sw_reg, in phy_type_set()
697 struct mtk_phy_instance *instance = tphy->phys[phy->id]; in mtk_phy_init() local
700 ret = clk_enable(&instance->ref_clk); in mtk_phy_init()
706 ret = clk_enable(&instance->da_ref_clk); in mtk_phy_init()
709 clk_disable(&instance->ref_clk); in mtk_phy_init()
713 switch (instance->type) { in mtk_phy_init()
715 u2_phy_instance_init(tphy, instance); in mtk_phy_init()
716 u2_phy_props_set(tphy, instance); in mtk_phy_init()
719 u3_phy_instance_init(tphy, instance); in mtk_phy_init()
722 pcie_phy_instance_init(tphy, instance); in mtk_phy_init()
725 sata_phy_instance_init(tphy, instance); in mtk_phy_init()
738 struct mtk_phy_instance *instance = tphy->phys[phy->id]; in mtk_phy_power_on() local
740 if (instance->type == PHY_TYPE_USB2) in mtk_phy_power_on()
741 u2_phy_instance_power_on(tphy, instance); in mtk_phy_power_on()
742 else if (instance->type == PHY_TYPE_PCIE) in mtk_phy_power_on()
743 pcie_phy_instance_power_on(tphy, instance); in mtk_phy_power_on()
751 struct mtk_phy_instance *instance = tphy->phys[phy->id]; in mtk_phy_power_off() local
753 if (instance->type == PHY_TYPE_USB2) in mtk_phy_power_off()
754 u2_phy_instance_power_off(tphy, instance); in mtk_phy_power_off()
755 else if (instance->type == PHY_TYPE_PCIE) in mtk_phy_power_off()
756 pcie_phy_instance_power_off(tphy, instance); in mtk_phy_power_off()
764 struct mtk_phy_instance *instance = tphy->phys[phy->id]; in mtk_phy_exit() local
766 clk_disable(&instance->da_ref_clk); in mtk_phy_exit()
767 clk_disable(&instance->ref_clk); in mtk_phy_exit()
776 struct mtk_phy_instance *instance = NULL; in mtk_phy_xlate() local
792 instance = tphy->phys[index]; in mtk_phy_xlate()
796 if (!instance) { in mtk_phy_xlate()
802 instance->type = args->args[1]; in mtk_phy_xlate()
803 if (!(instance->type == PHY_TYPE_USB2 || in mtk_phy_xlate()
804 instance->type == PHY_TYPE_USB3 || in mtk_phy_xlate()
805 instance->type == PHY_TYPE_SATA || in mtk_phy_xlate()
806 instance->type == PHY_TYPE_PCIE)) { in mtk_phy_xlate()
813 phy_v1_banks_init(tphy, instance); in mtk_phy_xlate()
816 phy_v2_banks_init(tphy, instance); in mtk_phy_xlate()
823 phy_parse_property(tphy, instance); in mtk_phy_xlate()
824 phy_type_set(instance); in mtk_phy_xlate()
859 struct mtk_phy_instance *instance; in mtk_tphy_probe() local
863 instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); in mtk_tphy_probe()
864 if (!instance) in mtk_tphy_probe()
871 instance->port_base = map_sysmem(addr, 0); in mtk_tphy_probe()
872 instance->index = index; in mtk_tphy_probe()
873 instance->np = ofnode_to_np(subnode); in mtk_tphy_probe()
874 tphy->phys[index] = instance; in mtk_tphy_probe()
878 &instance->ref_clk); in mtk_tphy_probe()
883 &instance->da_ref_clk); in mtk_tphy_probe()
887 err = phy_type_syscon_get(dev, instance, subnode); in mtk_tphy_probe()