Lines Matching +full:mt8183 +full:- +full:xhci

1 // SPDX-License-Identifier: GPL-2.0
3 * mtu3_dr.c - dual role switch and host glue layer
27 /* mt8183 */
65 * ip-sleep wakeup mode:
72 switch (ssusb->uwk_vers) { in ssusb_wakeup_ip_sleep_set()
74 reg = ssusb->uwk_reg_base + PERI_WK_CTRL1; in ssusb_wakeup_ip_sleep_set()
79 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; in ssusb_wakeup_ip_sleep_set()
84 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; in ssusb_wakeup_ip_sleep_set()
89 reg = ssusb->uwk_reg_base + PERI_WK_CTRL1_8195; in ssusb_wakeup_ip_sleep_set()
94 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0_8195; in ssusb_wakeup_ip_sleep_set()
99 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0_8195; in ssusb_wakeup_ip_sleep_set()
104 reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL; in ssusb_wakeup_ip_sleep_set()
111 regmap_update_bits(ssusb->uwk, reg, msk, val); in ssusb_wakeup_ip_sleep_set()
121 ssusb->uwk_en = of_property_read_bool(dn, "wakeup-source"); in ssusb_wakeup_of_property_parse()
122 if (!ssusb->uwk_en) in ssusb_wakeup_of_property_parse()
126 "mediatek,syscon-wakeup", 2, 0, &args); in ssusb_wakeup_of_property_parse()
130 ssusb->uwk_reg_base = args.args[0]; in ssusb_wakeup_of_property_parse()
131 ssusb->uwk_vers = args.args[1]; in ssusb_wakeup_of_property_parse()
132 ssusb->uwk = syscon_node_to_regmap(args.np); in ssusb_wakeup_of_property_parse()
134 dev_info(ssusb->dev, "uwk - reg:0x%x, version:%d\n", in ssusb_wakeup_of_property_parse()
135 ssusb->uwk_reg_base, ssusb->uwk_vers); in ssusb_wakeup_of_property_parse()
137 return PTR_ERR_OR_ZERO(ssusb->uwk); in ssusb_wakeup_of_property_parse()
142 if (ssusb->uwk_en) in ssusb_wakeup_set()
150 xhci_cap = mtu3_readl(ssusb->ippc_base, U3D_SSUSB_IP_XHCI_CAP); in host_ports_num_get()
151 ssusb->u2_ports = SSUSB_IP_XHCI_U2_PORT_NUM(xhci_cap); in host_ports_num_get()
152 ssusb->u3_ports = SSUSB_IP_XHCI_U3_PORT_NUM(xhci_cap); in host_ports_num_get()
154 dev_dbg(ssusb->dev, "host - u2_ports:%d, u3_ports:%d\n", in host_ports_num_get()
155 ssusb->u2_ports, ssusb->u3_ports); in host_ports_num_get()
161 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_enable()
162 int num_u3p = ssusb->u3_ports; in ssusb_host_enable()
163 int num_u2p = ssusb->u2_ports; in ssusb_host_enable()
175 if ((0x1 << i) & ssusb->u3p_dis_msk) { in ssusb_host_enable()
188 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_enable()
206 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_disable()
207 int num_u3p = ssusb->u3_ports; in ssusb_host_disable()
208 int num_u2p = ssusb->u2_ports; in ssusb_host_disable()
214 if ((0x1 << i) & ssusb->u3p_dis_msk) in ssusb_host_disable()
224 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_disable()
240 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_resume()
241 int u3p_skip_msk = ssusb->u3p_dis_msk; in ssusb_host_resume()
242 int u2p_skip_msk = ssusb->u2p_dis_msk; in ssusb_host_resume()
243 int num_u3p = ssusb->u3_ports; in ssusb_host_resume()
244 int num_u2p = ssusb->u2_ports; in ssusb_host_resume()
250 if (ssusb->otg_switch.is_u3_drd) in ssusb_host_resume()
283 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_suspend()
284 int num_u3p = ssusb->u3_ports; in ssusb_host_suspend()
285 int num_u2p = ssusb->u2_ports; in ssusb_host_suspend()
291 if ((0x1 << i) & ssusb->u3p_dis_msk) in ssusb_host_suspend()
301 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_suspend()
326 /* if port0 supports dual-role, works as host mode by default */ in ssusb_host_setup()
327 ssusb_set_vbus(&ssusb->otg_switch, 1); in ssusb_host_setup()
332 if (ssusb->is_host) in ssusb_host_cleanup()
333 ssusb_set_vbus(&ssusb->otg_switch, 0); in ssusb_host_cleanup()
346 struct device *parent_dev = ssusb->dev; in ssusb_host_init()
358 dev_info(parent_dev, "xHCI platform device register success...\n"); in ssusb_host_init()
365 of_platform_depopulate(ssusb->dev); in ssusb_host_exit()