Lines Matching +full:power +full:- +full:down

1 // SPDX-License-Identifier: GPL-2.0
3 * mtu3_dr.c - dual role switch and host glue layer
49 * ip-sleep wakeup mode:
50 * all clocks can be turn off, but power domain should be kept on
56 switch (ssusb->uwk_vers) { in ssusb_wakeup_ip_sleep_set()
58 reg = ssusb->uwk_reg_base + PERI_WK_CTRL1; in ssusb_wakeup_ip_sleep_set()
63 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; in ssusb_wakeup_ip_sleep_set()
68 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; in ssusb_wakeup_ip_sleep_set()
73 reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL; in ssusb_wakeup_ip_sleep_set()
80 regmap_update_bits(ssusb->uwk, reg, msk, val); in ssusb_wakeup_ip_sleep_set()
90 ssusb->uwk_en = of_property_read_bool(dn, "wakeup-source"); in ssusb_wakeup_of_property_parse()
91 if (!ssusb->uwk_en) in ssusb_wakeup_of_property_parse()
95 "mediatek,syscon-wakeup", 2, 0, &args); in ssusb_wakeup_of_property_parse()
99 ssusb->uwk_reg_base = args.args[0]; in ssusb_wakeup_of_property_parse()
100 ssusb->uwk_vers = args.args[1]; in ssusb_wakeup_of_property_parse()
101 ssusb->uwk = syscon_node_to_regmap(args.np); in ssusb_wakeup_of_property_parse()
103 dev_info(ssusb->dev, "uwk - reg:0x%x, version:%d\n", in ssusb_wakeup_of_property_parse()
104 ssusb->uwk_reg_base, ssusb->uwk_vers); in ssusb_wakeup_of_property_parse()
106 return PTR_ERR_OR_ZERO(ssusb->uwk); in ssusb_wakeup_of_property_parse()
111 if (ssusb->uwk_en) in ssusb_wakeup_set()
119 xhci_cap = mtu3_readl(ssusb->ippc_base, U3D_SSUSB_IP_XHCI_CAP); in host_ports_num_get()
120 ssusb->u2_ports = SSUSB_IP_XHCI_U2_PORT_NUM(xhci_cap); in host_ports_num_get()
121 ssusb->u3_ports = SSUSB_IP_XHCI_U3_PORT_NUM(xhci_cap); in host_ports_num_get()
123 dev_dbg(ssusb->dev, "host - u2_ports:%d, u3_ports:%d\n", in host_ports_num_get()
124 ssusb->u2_ports, ssusb->u3_ports); in host_ports_num_get()
130 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_enable()
131 int num_u3p = ssusb->u3_ports; in ssusb_host_enable()
132 int num_u2p = ssusb->u2_ports; in ssusb_host_enable()
138 /* power on host ip */ in ssusb_host_enable()
141 /* power on and enable u3 ports except skipped ones */ in ssusb_host_enable()
144 if ((0x1 << i) & ssusb->u3p_dis_msk) { in ssusb_host_enable()
155 /* power on and enable all u2 ports */ in ssusb_host_enable()
157 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_enable()
175 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_disable()
176 int num_u3p = ssusb->u3_ports; in ssusb_host_disable()
177 int num_u2p = ssusb->u2_ports; in ssusb_host_disable()
181 /* power down and disable u3 ports except skipped ones */ in ssusb_host_disable()
183 if ((0x1 << i) & ssusb->u3p_dis_msk) in ssusb_host_disable()
191 /* power down and disable u2 ports except skipped ones */ in ssusb_host_disable()
193 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_disable()
201 /* power down host ip */ in ssusb_host_disable()
209 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_resume()
210 int u3p_skip_msk = ssusb->u3p_dis_msk; in ssusb_host_resume()
211 int u2p_skip_msk = ssusb->u2p_dis_msk; in ssusb_host_resume()
212 int num_u3p = ssusb->u3_ports; in ssusb_host_resume()
213 int num_u2p = ssusb->u2_ports; in ssusb_host_resume()
219 if (ssusb->otg_switch.is_u3_drd) in ssusb_host_resume()
223 /* power on host ip */ in ssusb_host_resume()
226 /* power on u3 ports except skipped ones */ in ssusb_host_resume()
236 /* power on all u2 ports except skipped ones */ in ssusb_host_resume()
252 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_suspend()
253 int num_u3p = ssusb->u3_ports; in ssusb_host_suspend()
254 int num_u2p = ssusb->u2_ports; in ssusb_host_suspend()
258 /* power down u3 ports except skipped ones */ in ssusb_host_suspend()
260 if ((0x1 << i) & ssusb->u3p_dis_msk) in ssusb_host_suspend()
268 /* power down u2 ports except skipped ones */ in ssusb_host_suspend()
270 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_suspend()
278 /* power down host ip */ in ssusb_host_suspend()
289 * power on host and power on/enable all ports in ssusb_host_setup()
295 /* if port0 supports dual-role, works as host mode by default */ in ssusb_host_setup()
296 ssusb_set_vbus(&ssusb->otg_switch, 1); in ssusb_host_setup()
301 if (ssusb->is_host) in ssusb_host_cleanup()
302 ssusb_set_vbus(&ssusb->otg_switch, 0); in ssusb_host_cleanup()
315 struct device *parent_dev = ssusb->dev; in ssusb_host_init()
334 of_platform_depopulate(ssusb->dev); in ssusb_host_exit()